321F Lect09-Ch27 - OODB - v1
321F Lect09-Ch27 - OODB - v1
Lecture 9
INTRODUCTION TO OBJECT DBMS
Wyman Wang
School of Science and Technology
Content
Advanced database applications.
Unsuitability of RDBMSs for advanced database applications.
Object-oriented concepts.
Problems of storing objects in relational database.
Basics of object-oriented database analysis and design.
2
Advanced Database Applications
Computer-Aided Design/Manufacturing (CAD/CAM)
Computer-Aided Software Engineering (CASE)
Office Information Systems (OIS) and Multimedia Systems
Geographic Information Systems (GIS)
3
Computer-Aided Design (CAD)
Stores data related to mechanical and electrical design, for example,
buildings, airplanes, and integrated circuit chips.
Such design has some common characteristics:
◦ Data has many types, each with a small number of instances.
◦ Design may be very large.
◦ Design is not static but evolves through time.
◦ Involves version control and configuration management.
4
Weaknesses of RDBMSs
Poor Representation of “Real World” Entities
◦ Normalization leads to relations that do not correspond to entities in “real
world”.
Semantic Overloading
◦ Relational model has only one construct for representing data and data
relationships: the relation.
5
Weaknesses of RDBMSs
Limited Operations
◦ RDBMs only have a fixed set of operations which cannot be extended.
6
Weaknesses of RDBMSs
Difficult to Handle Recursive Queries
◦ Extremely difficult to produce recursive queries.
7
Object-Oriented Concepts
Abstraction, encapsulation, information hiding.
Objects and attributes.
Object identity.
Methods and messages.
Classes, subclasses, superclasses, and inheritance.
Overloading.
Polymorphism and dynamic binding.
8
Object Identity
Object identifier (OID) assigned to object when it is created that is:
◦ System-generated.
◦ Unique to that object.
◦ Invariant.
◦ Independent of the values of its attributes (that is, its state).
◦ Invisible to the user (ideally).
9
Object Identity - Implementation
In RDBMS, object identity is value-based: primary key is used to
provide uniqueness.
Primary keys do not provide type of object identity required in OO
systems:
◦ key only unique within a relation, not across entire system;
◦ key generally chosen from attributes of relation, making it dependent on
object state.
10
Advantages of OIDs
They are efficient.
They are fast.
They cannot be modified by the user.
They are independent of content.
11
Object-Oriented Database
Design
OODM: Object-Oriented data model
Relational DM: Relational data model
12
Example 1 - A Typical Relational
Schema
Consider an example, where an organization maintains the information about its
departments and employees. They store information about the department in Dept table
and the employees in Employee table as follows:
DeptID is the primary key of Dept table (parent table). The DeptID in Employee table is the
foreign key references Dept table.
EmpID is the primary key of Employee table.
13
Example 1 - A Typical Relational
Schema
14
Example 2 – Convert Example 1
into Object Tables using Object
Identifier (OID)
Assume the OID for DeptID D001 is OID1, and D002 is OID 2.
Also, for EmpID E001 is OID 3, and so on. As shown below:
15
Example 2 – Convert Example 1
into Object Tables using Object
Identifier (OID)
16
Relationships
◦ Relationships are represented using reference attributes, typically
implemented using OIDs.
◦ Consider how to represent the following binary relationships
according to their cardinality.
◦ 1:1
◦ 1:*
◦ *:*
17
1:1 Between Objects A and B
◦ Add reference attribute to A and, to maintain referential integrity,
reference attribute to B.
18
1:* Between Objects A and B
◦ Add reference attribute to B and attribute containing set of
references to A.
19
*:* Between Objects A and B
◦ Add attribute containing set of references to each object.
◦ For relational database design, we decompose *:* into two 1:*
relationships linked by intermediate entity. We can also represent
this model in an ODBMS.
20
*:* Between Objects A and B
21
Alternative Design for *:*
Between Objects A and B
22
Referential Integrity
◦ Do not allow user to explicitly delete objects.
◦ System is responsible for “garbage collection”.
◦ Allow user to delete objects when they are no longer required.
◦ System may detect invalid references automatically and set reference to NULL or
reject the deletion.
◦ Allow user to modify and delete objects and relationships when
they are no longer required.
◦ System automatically maintains the integrity of objects.
◦ Inverse attributes can be used to maintain referential integrity.
23
Reference
Chapter 27 of Connolly, T and Begg, C, Database Systems: A practical
Approach to Design, Implementation, and Management (6th ed.),
Boston: Pearson Education.
24