Advanced Database Chapter One
Advanced Database Chapter One
systems
Chapter One:
Concepts for Object-Oriented
Databases
Example 1 (contd.)
Object Identity, Object Structure,
and Type Constructors Examples (4)
Example 1 (contd.)
We use i1, i2, i3, . . . to stand for unique system-
generated object identifiers. Consider the
following objects:
o = (i1, atom, ‘Houston’)
1
o = (i4, atom, 5)
4
Reachability mechanism
works by making the object reachable from
some other persistent object.
An object B is said to be reachable from an
object A if a sequence of references in the
database lead from object A to object B.
Persistence (3)
Persistence (4)
From above example, we can define a class
DEPARTMENT_SET whose objects are of type
set(DEPARTMENT).
We can create an object of type
DEPARTMENT_SET, and give it a persistent name
ALL_DEPARTMENTS.
Any DEPARTMENT object that is added to the set
of ALL_DEPARTMENTS by using the add_dept
operation becomes persistent by virtue of its being
reachable from ALL_DEPARTMENTS.
Type (Class) Hierarchies and Inheritance
Type (Class) Hierarchies and
Inheritance (1)
Another main characteristic of ODBs is that they
allow type hierarchies and inheritance.
A type is defined by assigning it a type name and
then defining a number of attributes (instance
variables) and operations (methods) for the type.
In the simplified model we use in this section, the
attributes and operations are together called functions.
TYPE_NAME: function, function, . . . , function
Example.
PERSON: Name, Address, Birthdate, Age, SSN
Type (Class) Hierarchies and
Inheritance (2)
Subtype: is useful when the designer or user
must create a new type that is similar but not
identical to an already defined type.
The subtype then inherits all the functions of
the predefined type, which is referred to as the
supertype.
Type (Class) Hierarchies and
Inheritance (3)
Example (1):
PERSON: Name, Address, Birthdate, Age, SSN
EMPLOYEE: Name, Address, Birthdate, Age,
SSN, Salary, HireDate, Seniority
STUDENT: Name, Address, Birthdate, Age,
SSN, Major, GPA
OR:
EMPLOYEE subtype-of PERSON: Salary,
HireDate, Seniority
STUDENT subtype-of PERSON: Major, GPA
Type (Class) Hierarchies and
Inheritance (4)
Example (2):
Consider a type that describes objects in plane geometry,
which may be defined as follows:
GEOMETRY_OBJECT: Shape, Area,
ReferencePoint
Now suppose that we want to define a number of
subtypes for the GEOMETRY_OBJECT type, as
follows:
RECTANGLE subtype-of GEOMETRY_OBJECT:
Width, Height
TRIANGLE subtype-of GEOMETRY_OBJECT:
Side1, Side2, Angle
CIRCLE subtype-of GEOMETRY_OBJECT: Radius
Type (Class) Hierarchies and
Inheritance (5)
Example (2) (contd.):
An alternative way of declaring these three
subtypes is to specify the value of the Shape
attribute as a condition that must be satisfied for
objects of each subtype:
RECTANGLE subtype-of
GEOMETRY_OBJECT (Shape=‘rectangle’):
Width, Height
TRIANGLE subtype-of GEOMETRY_OBJECT
(Shape=‘triangle’): Side1, Side2, Angle
CIRCLE subtype-of GEOMETRY_OBJECT
(Shape=‘circle’): Radius
Type (Class) Hierarchies and
Inheritance (6)
Extents
In most ODBs, an extent is defined to store the
collection of persistent objects for each type or
subtype.
Persistent Collection:
This holds a collection of objects that is stored
permanently in the database and hence can be
accessed and shared by multiple programs
Transient Collection:
This exists temporarily during the execution of a
program but is not kept when the program
terminates
Thank U!