Chapter 22
Chapter 22
Navathe
Slide 22- 1
Chapter 22
Object-Relational and Extended-Relational Systems
Chapter Outline
22.1 Overview of Object-Relational Features of SQL 22.2 Evolution and Current Trends 22.3 The Informix Server 22.4 Object-Relational Features of Oracle 22.5 Implementation and Related Issues for Extended Type Systems 22.6 The Nested Relational Model 22.7 Summary
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Slide 22- 3
Chapter Objectives
What are the shortcoming of the current DBMSs? What has led to these shortcomings? How Informix Universal Server and Oracle have addressed some of the challenges
Slide 22- 4
SQL was specified in 1970s SQL was enhanced substantially in 1989 and 1992 A new standard called SQL3 added objectoriented features A subset of SQL3 standard, now known as SQL99 has been approved
Slide 22- 5
SQL/Framework, SQL/Foundation, SQL/Bindings, SQL/Object New parts addressing temporal, transaction aspects of SQL SQL/CLI (Call Level Interface) SQL/PSM (Persistent Stored Modules)
Slide 22- 6
SQL/Foundation
New types New predicates Relational operators Rules and triggers User defined types Transaction capabilities Stored routines
Slide 22- 7
SQL/CLI
SQL/CLI stands for SQL Call Level Interface SQL/CLI provides rules that allow execution of application code without providing source code
Avoids the need for preprocessing Contains about 50 routines for tasks such as connection to the SQL server
Slide 22- 8
SQL/PSM
Specifies facilities for partitioning an application between a client and a server Enhances performance by minimizing network traffic SQL Bindings included Embedded SQL SQL/Temporal deals with historical data
Slide 22- 9
Type constructors to specify complex objects Mechanism to specify object-identity Mechanism for encapsulation of operations Mechanism to support inheritance
Slide 22- 10
Two types: row and array Known as user-defined types (UDTs) Syntax for a row type
An example:
CREATE TYPE Addr_type AS ( street VARCHAR (45), city VARCHAR (25), zip CHAR (5));
Slide 22- 11
An array type is specified for an attribute whose value will be a collection Example:
CREATE TYPE Comp_type AS ( comp_name VARCHAR (2). location VARCHAR (20) ARRAY [10] );
Slide 22- 12
A user-defined type can also be used to specify the row types of a table:
CREATE TABLE Company OF Comp_type (REF IS comp_id SYSTEM GENERATED, PRIMARY KEY (comp_name));
Options:
Slide 22- 13
Attributes as References
Keyword SCOPE specifies the table whose tuples can be referenced by a reference attribute via the dereferencing notation ->
E.g., e.company->comp_name
Slide 22- 14
Encapsulation of Operations
A construct similar to the class definition Users can create a named user-defined type with its own methods in addition to attributes:
CREATE TYPE <type-name> ( list of attributes declaration of EQUAL and LESS THAN methods declaration of other methods );
Slide 22- 15
Method Syntax
Syntax:
METHOD <name> (<arg-list>) RETURNS <type>;
An example
CREATE TYPE Addr_type AS ( street VARCHAR (45), city VARCHAR (25), zip CHAR (5) ) METHOD apt_no ( ) RETURNS CHAR(8);
Slide 22- 16
Inheritance in SQL
Slide 22- 17
WITH RECURSIVE is used to specify recursive queries User accounts may have a role that specifies the level of authorization and privileges;
Trigger granularity allows row-level and statement-level triggers SQL3 also supports programming languages facilities
Slide 22- 18
RDBMS ODBMS Network Hierarchical While legacy systems are replaced by new offerings, we may encounter various issues
Copyright 2007 Ramez Elmasri and Shamkant B. Navathe
Interoperability concerns:
Slide 22- 19
Current Trends
Main force behind development of ORDBMSs: meet the challenges of new applications:
Slide 22- 20
Combines relational and object database technologies Consider two dimensions of DBMS applications:
Slide 22- 21
Observe the possible quadrants Quadrant 1 (x=0, y=0): simple data, simple query Quadrant 2 (x=0, y=1): simple data, complex query Quadrant 3 (x=1, y=0): complex data, simple query Quadrant 4 (x=1, y=1): complex data, complex query Traditional RDBMSs belong to Quadrant 2 Many object DBMSs belong to Quadrant 3 Informix Universal belongs to Quadrant 4 It extends the basic relational model by incorporating a variety of features that make it object-relational
Slide 22- 22
Support for extensible data types Support for user-defined routines Implicit notion of inheritance Support for indexing extensions Database Blade API
Slide 22- 23
DBMS is treated as razor into which data blade modules can be inserted A number of new data types are provided
Slide 22- 24
Opaque type:
Distinct type:
Row type:
Collection type:
Slide 22- 25
Informix supports user-defined functions and routines to manipulate user-defined types Functions are implemented
Slide 22- 26
Data Operation
Slide 22- 27
The above line creates an index on the table employee using the value of the city function
Slide 22- 28
External data are mapped to a table in the database called virtual table interface The interface enables the user to defined operations that can be used as proxies
Slide 22- 29
a single data type called doc whose instances are large objects
Slide 22- 30
Section 22.4
Object-Relational Features of Oracle
Slide 22- 31
RBLOB (binary large object) CLOB (character large object) BFILE (binary file stored outside the database) NCLOB (fixed-width multibyte CLOB)
Slide 22- 32
Section 22.5:
Implementation and Related Issues
The ORDBMS must dynamically link a user-defined function in its address space Client-server issues:
if a server needs to perform a function, it is best to do so in the DBMS (server) address space
Queries should be possible to run inside functions Efficient storage and access of data
Slide 22- 33
Other Issues
Slide 22- 34
Nested relational mode: Removes the restriction of the first normal form (1NF) No commercial database supports a nested relational model Visual representation:
DEPENDENT
Slide 22- 35
Simple value attributes Multi-valued simple attributes Multi-valued composite attributes Single-valued composite attributes
Slide 22- 36
Extension made to
NEST UNNEST
Slide 22- 37
Example of NEST
Nested relation PROJS within EMP_PROJ_NESTED groups together the tuples with the same value for the attributes that are not specified in the NEST operation
Slide 22- 38
Example of UNNEST
Slide 22- 39
Summary
An overview of the object-oriented features in SQL-99 Current trends in DBMS that led to the development of object-relational models Features of Informix Universal Server and Oracle Nested relational models
Slide 22- 40