Академический Документы
Профессиональный Документы
Культура Документы
Chapter Outline
20.1 Overview of O-O Concepts 20.2 O-O Identity, Object Structure and Type Constructors 20.3 Encapsulation of Operations, Methods and Persistence 20.4 Type and Class Hierarchies and Inheritance 20.5 Complex Objects 20.6 Other O-O Concepts 20.7 Summary & Current Status
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Chapter 20-2
The physical representation of data is visible only to the implementor of the object Messages and responses provide the only external interface to an object. The term message does not necessarily imply physical message passing. Messages can be implemented as procedure invocations.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Object Identifiers
Object identifiers used to uniquely identify objects ( 32 or 64 bit integers)
Object identifiers are unique:
no two objects have the same identifier each object has only one object identifier
Constructors
Basic types: atom, tuple and set Collection type: list, bag and array
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Chapter 20-10
Chapter 20-11
Chapter 20-12
We use i1, i2, i3, . . . to stand for unique systemgenerated object identifiers. Consider the following objects:
o1 = (i1, atom, Houston) o2 = (i2, atom, Bellaire) o3 = (i3, atom, Sugarland) o4 = (i4, atom, 5) o5 = (i5, atom, Research) o6 = (i6, atom, 1988-05-22) o7 = (i7, set, {i1, i2, i3})
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Chapter 20-13
Chapter 20-14
Chapter 20-15
Chapter 20-16
Chapter 20-17
Chapter 20-18
Chapter 20-19
Chapter 20-20
The main idea is to define the behavior of a type of object based on the operations that can be externally applied to objects of that type. In general, the implementation of an operation can be specified in a general-purpose programming language that provides flexibility and power in defining the operations.
Chapter 20-21
Chapter 20-22
Chapter 20-23
Reachability Mechanism: Make the object reachable from some persistent object.
An object B is said to be reachable from an object A if a sequence of references in the object graph lead from object A to object B.
Chapter 20-24
Chapter 20-26
Chapter 20-27
Chapter 20-28
Chapter 20-29
Chapter 20-30
Chapter 20-31
Chapter 20-32
Chapter 20-33
class Employee (extent all_emp key ssn) { attribute string name; attribute string ssn; attribute short age; relationship Dept works_for inverse dept :: has; void reassign (in string new_name); };
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Chapter 20-34
EER DIAGRAM
Person
Student
Lecturer
N
worksFor
1
Department
Chapter 20-35
inverse Lecturer::worksFor; };
Chapter 20-37
Chapter 20-38
Chapter 20-39
Chapter 20-40
Chapter 20-41
Chapter 20-42
Student# Course#
1 2 3 C1 T2 T2
4
5
Q9
F
Course# CourseName
C1 F3 Q9 computing flower arranging quantum mechanics
T2
theology
Comparison
RDBs vs. OODBs.
RDBs have only one construct i.e. Relation, whereas the type system of OODBs is much richer and complex. RDBs require primary keys and foreign keys for implementing relationships, OODBs simply dont. Optimization of queries in OODBs is much complex than RDBs, but is mainly inspired from the Optimization techniques in RDBs. OODBs support complex data whereas RDBs dont. OODBs are much faster than RDBs but are less mature to handle large volumes of data. There is more acceptance and domination of RDBs in the market than that for OODBs.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
The following is a sample query what are the names of the black product? Select distinct p.name From products p Where p.color = black
Valid in both SQL and OQL, but results are different.
Original table
- The statement queries a relational database. => Returns a table with rows.
Result
Name
Ford Mustang Mercedes SLK
Original table P2
P3
Mercedes SLK
Black
Chapter 20-53
Summary (2) Programming language compatibility: Both persistent and transient objects are handled uniformly. Objects are made persistent by being attached to a persistent collection. Type hierarchies and inheritance: Object types can be specified by using a type hierarchy, which allows the inheritance of both attributes and methods of previously defined types.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Chapter 20-54
Summary (3)
Extents: All persistent objects of a particular type can be stored in an extent. Extents corresponding to a type hierarchy have set/subset constraints enforced on them. Support for complex objects: Both structured and unstructured complex objects can be stored and manipulated. Polymorphism and operator overloading: Operations and method names can be overloaded to apply to different object types with different implementations.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Chapter 20-55
Summary (4)
Versioning: Some OO systems provide support for maintaining several versions of the same object. Comparison : RDBMS & OODBMS
Chapter 20-56
Current Status
OODB market not growing much per se. Currently around $250M as opposed to the relational DB revenue upwards of $50B. O-O ideas are being used in a large number of applications, without explicitly using the OODB platform to store data. Growth: O-O tools for modeling and analysis, O-O Programming Languages like Java and C++ Compromise Solution Proposed: Object Relational DB Management (Informix Universal Server, Oracle 10i, IBMs UDB, DB2/II )
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Ramez Elmasri and Shamkant Navathe
Chapter 20-57