Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.

Similar presentations


Presentation on theme: "Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object."— Presentation transcript:

1 Chapter 18 Object Database Management Systems

2 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object database management Object-oriented principles Architectures for object database management Object database definition and manipulation in SQL:1999 Object database definition and manipulation in Oracle 9i

3 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Motivation: Complex Data Most relational DBMSs support only a few data types. Many business applications require large amounts of complex data such as images, audio, and video. The need to integrate complex data with simple data drives the demand for object database technology.

4 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Motivation: Type System Mismatch Increasing use of database access in procedural code Different data types used in programming languages versus DBMSs Data type mismatch makes software more difficult to develop. A relational DBMS cannot perform elementary operations on complex data.

5 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Application Examples Dental Office Support Real Estate Listing Service Auto Insurance Claims

6 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Principles An object is a combination of data and procedures. A class is a prototype that defines the variables and methods common to all objects of the class. Three underlying principles: encapsulation, inheritance and polymorphism.

7 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Encapsulation Objects can be accessed only through their interfaces. Classes can be reused rather than just individual procedures. More complex classes can be defined using simpler classes. Provides a form of data independence.

8 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Bond Class Example CLASS Bond { // VARIABLES: ATTRIBUTE Float IntRate; ATTRIBUTE Date Maturity; // METHODS: Float Yield(); // Computes the Bond’s Yield };

9 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Inheritance Sharing of data and code among similar classes (classes and subclasses). Inherit variables and methods from parent classes When using the subclasses, the methods in the parent classes can be used. Inheritance provides an improved organization of software and incremental reusability.

10 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Inheritance Examples

11 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Multiple Inheritance Example

12 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Polymorphism Ability of a computing system to choose among multiple implementations Benefits –Fewer, more reusable methods –incremental modification of code Requesting a method execution involves sending a message to an object Client-server processing and object- oriented computing are closely related.

13 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Processing a Message

14 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Binding Associating an implementation with a message Static binding –Performed at compile-time –More efficient but less flexible Dynamic binding –Performed at run-time (late binding) –More flexible but less efficient

15 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Strong Type Checking Complex expressions can involve many methods and objects Incompatibility errors common in code Ability to ensure that programming code contains no incompatibility errors An important kind of error checking for object-oriented coding

16 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Programming Languages versus DBMSs Programming languages have used object- oriented principles for many years. Programming languages emphasize software maintenance and code reusability. Object DBMSs are more recent. Encapsulation usually is relaxed so that an object’s data can be referenced in a query. Inheritance mechanisms usually are simpler in DBMSs

17 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Architectures for Object Database Management Adding object-oriented features to a DBMS is a good idea Many approaches about the features to add and how features should be added. Some approaches provide small extensions that leave object features outside the DBMS. Other approaches involve a complete rewrite of the DBMS to accommodate objects Marketplace will determine best approaches

18 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Large Objects and External Software Storage of large objects in a database along with external software to manipulate large objects. Complex data are stored in a field using the BLOB (binary large object) data type. The large object approach is simple to implement and universal. The large object approach suffers from serious performance drawbacks.

19 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Large Object Architecture

20 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Specialized Media Servers The use of a dedicated server to manage complex data outside of a database. Programmers use an application programming interface (API) to access complex data. Provide good performance for specific kinds of complex data. The range of operations may be limited. May perform poorly when combining simple and complex data.

21 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Specialized Media Server Architecture

22 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Object database middleware The use of middleware to manage complex data stored outside of a database along with traditional data stored in a database. Provides a way to integrate complex data stored on PCs and remote servers with relational databases. Object middleware can suffer performance problems because of a lack of integration with a DBMS.

23 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Object Middleware Approach

24 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Object Relational DBMS for User-Defined Types A relational DBMS extended with an object query processor for user-defined data types. Complex data is added as a user-defined type. User-defined functions can be defined and then used in SQL statements. SQL:1999 provides the standard for object relational DBMSs. Provide good integration of complex data but reliability may be a concern.

25 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Component Architecture for Object Relational DBMSs

26 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented DBMS A new kind of DBMS designed especially for objects. Object-oriented DBMSs have an object query processor and an object kernel. The Object Data Management Group (ODMG) provides the standard for object- oriented DBMSs.

27 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Component Architecture for Object-Oriented DBMSs

28 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Summary of Architectures

29 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Object Database Features in SQL:1999 Very large standard Core language part Packages Details about basic and enhanced object support Two levels of conformance

30 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. SQL:1999 Packages

31 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. User-Defined Types Bundles data and procedures Support definition of structured types, not just extensions of standard types User-defined types can be used as data types for columns in tables, passed as parameters, and returned as values. User-defined functions can be used in expressions in the SELECT, the WHERE, and the HAVING clauses.

32 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. User-Defined Type Example

33 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Explicit Methods Return single values and use input parameters Implicit first parameter: part of user- defined type CREATE METHOD statement for method body Mutation methods: change values Procedures and functions not associated with types

34 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Implicit Methods Automatically exist for all user-defined types Constructor method: creates an empty instance Observer methods: retrieve values Mutation methods: change values

35 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. User-Defined Type using an Array Example 2: Polygon type using an ARRAY CREATE TYPE Polygon AS ( Corners Point ARRAY[10], Color INTEGER ) METHOD Area() RETURNS FLOAT, -- Computes the area METHOD Scale (Factor FLOAT) RETURNS Polygon -- Computes a new polygon scaled by factor NOT FINAL;

36 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Table Definitions Traditional style: foreign keys to link tables Typed tables: supports object identifiers and object references Row type constructor: supports rows as variables and parameters

37 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Example of table definition with a row type

38 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Table Definition with a User- Defined Type

39 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Subtable Families A table can be declared as a subtable of another table. A subtable inherits the columns of its parent tables. SQL:1999 limits inheritance for tables to single inheritance. Set inclusion determines the relationship of a table to its subtables.

40 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Subtable Example

41 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Side effects when manipulating rows in subtable families On insert into a subtable, a corresponding row is inserted into each parent table. On update in a parent table, the column is also updated in all direct and indirect subtables that inherit the column. On update of an inherited column, the column is changed in the corresponding rows of direct and indirect parent tables. On delete, every corresponding row in both parent and subtables is also deleted.

42 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Manipulating Complex Objects and Subtable Families Path expressions to manipulate columns with row references. References to methods in expressions using the dot notation Testing membership in a specific table without being a member of any subtables.

43 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Using the ROW Keyword

44 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Obtaining Object Identifiers

45 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Example of path expression versus traditional expression

46 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Oracle 9i Object Features Supports most parts of the SQL:1999 object packages User-defined types Typed tables Other object features

47 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. User-Defined Type Example

48 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Inheritance

49 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Typed Tables

50 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Inheritance for Typed Tables

51 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Inserting into Typed Tables

52 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Path Expressions

53 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Other Object Features Type substitutability for subtables Hierarchical views Nested tables

54 McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Summary Three principles of object-oriented computing guide the development of object DBMSs. A number of object DBMS architectures are commercially available. SQL:1999 supports definition and manipulation of object relational databases. Oracle 9i is a significant implementation of the SQL:1999 object packages


Download ppt "Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object."

Similar presentations


Ads by Google