Chapter 1
Object Oriented
Database Systems
Objectives
Advanced database applications.
Unsuitability of RDBMSs for advanced database
applications.
Object-oriented concepts.
Problems of storing objects in relational database.
The next generation of database systems.
Basics of object-oriented database analysis and
design.
2 Object Oriented Database Systems 4/20/2018
Introduction
We have seen the widespread acceptance of RDBMSs
for traditional business applications such as:
o Order processing,
o Inventory control,
o Banking, and
o Airline reservations ….Etc.
However, existing RDBMSs have proven inadequate for
applications whose needs are quite different from those
of traditional business database applications.
o Those applications need to model very complex behavior.
3 Object Oriented Database Systems 4/20/2018
Advanced Database Applications
Computer-Aided Design/Manufacturing (CAD/CAM)
Computer-Aided Software Engineering (CASE)
Network Management Systems
Office Information Systems (OIS) and Multimedia
Systems
Digital Publishing
Geographic Information Systems (GIS)
Interactive and Dynamic Web sites
Other applications with complex and interrelated
objects and procedural data.
4 Object Oriented Database Systems 4/20/2018
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.
Even difficult to differentiate between multiple
relationships among two relations
Relational model is semantically overloaded.
5 Object Oriented Database Systems 4/20/2018
…
Poor Support for Integrity and Enterprise Constraints
Unfortunately, many commercial systems do not fully support
these constraints and it is necessary to build them into the
applications.
Homogeneous Data Structure
Relationalmodel assumes both horizontal and vertical
homogeneity.
Many RDBMSs now allow Binary Large Objects (BLOBs).
BLOBs are usually used to store large sized images,
audio/video or other multimedia data in binary
format .
The DBMS does not have any knowledge concerning
the content of the BLOB or its internal structure.
BLOBs cannot contain other BLOBs, so they cannot
take the form of composite objects.
6 Object Oriented Database Systems 4/20/2018
…
Limited Operations
RDBMs only have a fixed set of operations which
cannot be extended.
Difficulty Handling Recursive Queries
Extremely difficult to produce recursive queries, that is,
queries about relationships that a relation has with
itself
7 Object Oriented Database Systems 4/20/2018
Example - Recursive Query
• Assuming we have a recursive
relationship in a table named category.
• Getting the sub categories of a given
category is difficult.
• Example. Look at the following schema
and try to solve the above problem.
Category( catID, catName,parentCatId)
8 Object Oriented Database Systems 4/20/2018
Weaknesses of RDBMSs
Impedance Mismatch
Most DMLs lack computational completeness.
To overcome this, SQL can be embedded in a high-
level 3GL.
SQL and 3GLs use different models to represent
data
This produces an impedance mismatch - mixing
different programming paradigms.
Estimated that as much as 30% of programming
effort and code space is expended on this type of
conversion.
9 Object Oriented Database Systems 4/20/2018
…
Other Problems with RDBMSs
o Transactions are generally short-lived and
concurrency control protocols not suited for
long-lived transactions.
o Schema changes are difficult.
o RDBMSs are poor at navigational access.
10 Object Oriented Database Systems 4/20/2018
Object-Oriented Concepts
Abstraction, encapsulation, information hiding.
Objects and attributes.
Object identity.
Methods and messages.
Classes, subclasses, super classes, and
inheritance.
Overloading.
Polymorphism and dynamic binding.
11 Object Oriented Database Systems 4/20/2018
Abstraction
Process of identifying essential aspects
of an entity and ignoring unimportant
properties ( details).
Concentrate on what an object is and
what it does, before deciding how to
implement it.
12 Object Oriented Database Systems 4/20/2018
Encapsulation and Information Hiding
Encapsulation
Object contains both data structure and set of
operations used to manipulate it.
Information Hiding
Separate external aspects of an object from its
internal details, which are hidden from outside.
Eg. Private field vs. Public properties
Allows internal details of an object to be changed
without affecting applications that use it, provided
external details remain same.
Provides data independence.
13 Object Oriented Database Systems 4/20/2018
Object
Uniquely identifiable entity that contains
both the attributes that describe the state of
a real-world object and the actions
associated with it.
Definition very similar to that of an entity,
however, object encapsulates both state
and behavior; an entity only models state.
14 Object Oriented Database Systems 4/20/2018
Attributes
Contain current state of an object.
Attributes can be classified as simple or complex.
Simple attribute can be a primitive type such as
integer, string, etc., which takes on literal values.
Complex attribute can contain collections and/or
references to other objects.
Reference attribute represents relationship.
An object that contains one or more complex
attributes is called a complex object.
15 Object Oriented Database Systems 4/20/2018
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).
16 Object Oriented Database Systems 4/20/2018
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.
17 Object Oriented Database Systems 4/20/2018
…
Programming languages use variable names and
pointers/virtual memory addresses, which also compromise
object identity.
In C/C++, OID is physical address in process memory space,
which is too small - scalability requires that OIDs be valid
across storage volumes, possibly across different
computers.
Further, when object is deleted, memory is reused, which
may cause problems.
OID can never be reused even when an object is deleted
18 Object Oriented Database Systems 4/20/2018
Advantages of OIDs
They are efficient.
They are fast.
They cannot be modified by the user.
They are independent of content.
They cannot be used by another object even
when the object is no more in use (Deleted).
19 Object Oriented Database Systems 4/20/2018
Methods and Messages
Method
Defines behavior of an object, as a set of
encapsulated functions.
Message
Request from one object to another asking
second object to execute one of its
methods.
20 Object Oriented Database Systems 4/20/2018
Object Showing Attributes and Methods
21 Object Oriented Database Systems 4/20/2018
Example of a Method
22 Object Oriented Database Systems 4/20/2018
Class
Blueprint for defining a set of similar objects.
Objects in a class are called instances.
In some object-oriented systems, Class is also
an object with own class attributes and class
methods.
23 Object Oriented Database Systems 4/20/2018
Class Instance Share Attributes and Methods
24 Object Oriented Database Systems 4/20/2018
Subclasses, Super classes, and Inheritance
Inheritance allows one class of objects to be
defined as a special case of a more general class.
Special cases are subclasses and more general
cases are super classes.
Process of forming a superclass is generalization;
forming a subclass is specialization.
Subclass inherits all properties of its superclass and
can define its own unique properties.
Subclass can redefine inherited methods.
25 Object Oriented Database Systems 4/20/2018
…
All instances of subclass are also instances of
superclass.
Principle of substitutability states that instance of
subclass can be used whenever method/construct
expects instance of superclass.
Relationship between subclass and superclass
known as A KIND OF (AKO) relationship.
Four types of inheritance: single, multiple, repeated,
and selective.
26 Object Oriented Database Systems 4/20/2018
Single Inheritance
27 Object Oriented Database Systems 4/20/2018
Multiple Inheritance
28 Object Oriented Database Systems 4/20/2018
Repeated Inheritance
29 Object Oriented Database Systems 4/20/2018
Selective inheritance
Allows a subclass to inherit a limited number
of properties from the superclass.
This feature may provide similar functionality
to the view mechanism in relational
databases
30 Object Oriented Database Systems 4/20/2018
Overriding, Overloading, and
Polymorphism
Overriding
Process of redefining a member within a subclass.
Overloading
Allows name of a method to be reused with a class or across
classes.
Polymorphism
Means ‘many forms’. Three types: operation, inclusion,
and parametric.
Overloading is one kind of polymorphism– operation
A method defined in a superclass and inherited in its
subclasses is an example of inclusion polymorphism
Parametric polymorphism, or genericity as it is sometimes
called, uses types as parameters in generic type, or class,
declarations.
31 Object Oriented Database Systems 4/20/2018
Complex Objects
An object that consists of sub objects but is viewed
as a single object.
Objects participate in a A-PART-OF (APO)
relationship.
Contained object can be encapsulated within
complex object, accessed by complex object’s
methods.
Or have its own independent existence, and only an
OID is stored in complex object.
32 Object Oriented Database Systems 4/20/2018
Storing Objects in Relational Databases
One approach to achieving persistence with an OOPL
is to use an RDBMS as the underlying storage
engine.
Requires mapping class instances (i.e. objects) to one
or more tuples distributed over one or more relations.
To handle class hierarchy, have two basics tasks to
perform:
(1) design relations to represent class hierarchy;
(2) design how objects will be accessed.
33 Object Oriented Database Systems 4/20/2018
…
34 Object Oriented Database Systems 4/20/2018
Mapping Classes to Relations
A number of strategies for mapping classes to
relations, although each results in a loss of semantic
information.
(1) Map each class or subclass to a relation:
Staff (staffNo, fName, lName, position, sex, DOB, salary)
Manager (staffNo, bonus, mgrStartDate)
SalesPersonnel (staffNo, salesArea, carAllowance)
Secretary (staffNo, typingSpeed)
35 Object Oriented Database Systems 4/20/2018
…
(2) Map each subclass to a relation
Manager (staffNo, fName, lName, position, sex,
DOB, salary, bonus, mgrStartDate)
SalesPersonnel (staffNo, fName, lName, position,
sex, DOB, salary, salesArea, carAllowance)
Secretary (staffNo, fName, lName, position, sex,
DOB, salary, typingSpeed)
(3) Map the hierarchy to a single relation
Staff (staffNo, fName, lName, position, sex, DOB,
salary, bonus, mgrStartDate, salesArea,
carAllowance, typingSpeed, typeFlag)
36 Object Oriented Database Systems 4/20/2018
Next Generation Database Systems
First Generation DBMS: Network and Hierarchical
Required complex programs for even simple
queries.
Minimal data independence.
No widely accepted theoretical foundation.
Second Generation DBMS: Relational DBMS
Helped overcome these problems.
Third Generation DBMS: OODBMS and ORDBMS.
37 Object Oriented Database Systems 4/20/2018
History of Data Models
38 Object Oriented Database Systems 4/20/2018
Object-Oriented Database Design Vs
Conceptual Data Models (CDM)
39 Object Oriented Database Systems 4/20/2018
Relationships
Relationships represented using reference
attributes, typically implemented using OIDs.
Consider how to represent following binary
relationships according to their cardinality:
1:1
1:*
*:*.
40 Object Oriented Database Systems 4/20/2018
1:1 Relationship Between Objects A and B
Add reference attribute to A and, to maintain
referential integrity, reference attribute to B.
41 Object Oriented Database Systems 4/20/2018
1:* Relationship Between Objects A and B
Add reference attribute to B and attribute containing set
of references to A.
42 Object Oriented Database Systems 4/20/2018
*:* Relationship Between Objects A and B
Add attribute containing set of references to each
object.
For relational database design, would decompose *:N
into two 1:* relationships linked by intermediate entity.
Can also represent this model in an ODBMS.
43 Object Oriented Database Systems 4/20/2018
*:* Relationships
44 Object Oriented Database Systems 4/20/2018
Alternative Design for *:* Relationships
45 Object Oriented Database Systems 4/20/2018
Referential Integrity
Several techniques to handle referential integrity:
Do not allow user to explicitly delete objects.
o System is responsible for “garbage collection”.
Allow user to delete objects when they are no longer
required.
o System may detect invalid references automatically and
set reference to NULL or disallow the deletion.
Allow user to modify and delete objects and
relationships when they are no longer required.
o System automatically maintains the integrity of objects.
o Inverse attributes can be used to maintain referential
integrity.
46 Object Oriented Database Systems 4/20/2018
Object-Oriented Data Model
No one agreed up on object data model. One
definition:
Object-Oriented Data Model (OODM)
Data model that captures semantics of objects supported in
object-oriented programming.
Object-Oriented Database (OODB)
Persistent and sharable collection of objects defined by an
ODM.
Object-Oriented DBMS (OODBMS)
Manager of an ODB.
47 Object Oriented Database Systems 4/20/2018
Object-Oriented Data Model
Zdonik and Maier present a threshold model
that an OODBMS must, at a minimum,
satisfy:
It must provide database functionality.
It must support object identity.
It must provide encapsulation.
It must support objects with complex state.
48 Object Oriented Database Systems 4/20/2018
…
Khoshafian and Abnous define OODBMS as:
OO = Abstract Data Types (ADTs) + Inheritance + Object
identity
OODBMS = OO + Database capabilities.
Parsaye et al. gives:
1. High-level query language with query optimization.
2. Support for persistence, atomic transactions: concurrency
and recovery control.
3. Support for complex object storage, indexes, and access
methods.
OODBMS = OO system + (1), (2), and (3).
49 Object Oriented Database Systems 4/20/2018
Commercial OODBMSs
GemStone from Gemstone Systems Inc.,
Objectivity/DB from Objectivity Inc.,
ObjectStore from Progress Software Corp.,
Ontos from Ontos Inc.,
FastObjects from Poet Software Corp.,
Jasmine from Computer Associates/Fujitsu,
Versant from Versant Corp.
50 Object Oriented Database Systems 4/20/2018
Origins of the Object-Oriented Data
Model
51 Object Oriented Database Systems 4/20/2018
Quiz # 1
1. Write at least three weakness of RDBMSs
2. What is the difference between an Entity
and an object
3. Object Identifier (OID) is dependent on
the state of an object( True/False)
4. One approach to Polymorphism is
Generality (True/False)
5. An instance of a subclass is also an
instance of a superclass (True/False)
52 Object Oriented Database Systems 4/20/2018
END
53 Object Oriented Database Systems 4/20/2018