Oriented
DBMS
Database
that stores data
elements as objects. Uses
object-oriented concepts.
The term object oriented is
abbreviated by OO or O-O
Object
1.
2.
Example
Object attributes for branch instance
Attribute
BranchNo
Street
City
Postcode
SalesStaff
c/r
Manager
Values
B003
simple
163 main st
Islamabad
22010
Ali khan; Atif khan
Amjad khan
Features of OO
1.Object Identity
An OO database provides a unique
identity to each independent
object stored in the database.
This unique identity is
implemented via a unique system
generated object identifier OID.
The value of OID is not visible to
the user but it is used internally by
the system to identify each object
uniquely.
2.Abstraction
1.
2.
Encapsulation
The concept of encapsulation means that an
object contains both data structure and the set
of operations that can be used to manipulate
it.
Example
Define class Employee:
type tuple( name:
string;
birthdate:
date;
salary:
float; );
operations create-emp:
employee;
destroy-emp: boolean;
End employee;
Information hiding
3.Methods and
Messages
Example
method void updatesalary(float
increment)
{
Salary=salary+increment
}
It is a method use to update a member
of staffs salary.
Messages
Messages are the means by which
objects
4.Classes
Example
class
BRANCH
attributes
branchno
city
postcode
methods
print()
getpostcode(
)
Branchno=b003
City=london
Postcode=78jj
Branchno=b005
City=london
Postcode=09jik
Subclasses,
Superclasses
and objects
inheritance
Some
may have similar
Example
person
Superclasses
staff
manager
SalesStaff
subclasses
Multiple inheritance
Example:
manager
SalesStaff
salesmanager
Repeated inheritance
Example
staff
salesstaff
manager
salesmanager
Selective inheritance
Overriding
and
overloading
Overloading
Overloading allows the name of a
method to be reused within a
class definition.
This means that a single message
can perform different functions
depending on which object
receive it.
For example:
Overloading print method for
branch object and staff object
Staff
Staffno
Name
Position
Dob
salary
Manager
Salesperson
Bonus
mgrstartdate
Salesarea
carallowance
Secretary
typingspeed
Staff(staffno,name,position,dob,salary
)
Manager(staffno,bonus,mgrstartdate)
Salesperson(staffno,salesarea,carallo
wence)
Secretary(staffno,typingspeed)
Map each subclass to a relation
A second approach is to map each
subclass to a relation.
In this approach we lost semantic
information , it is no longer clear
that the relations are subclasses.
Manager(staffno,name,dob,position,salary,
bonus,mgrstartdate)
Salesperson(staffno,name,dob,position,sala
ry,salesarea,carallowence)
Secretary(staffno,name,dob,position,salary,
typingspeed)
Map the hierarchy to a single
relation
The third approach is to map the entire
hierarchy to a relation.
Again we lost some semantic information
and it will produce an unwanted number
of nulls for attributes that do not apply
to the tuple.
Staff(staffno,name,dob,position,sal
ary,bonus,mgrstartdate,salesarea,c
arallowence,typingspeed)
For example for a manager tuple
the attributes like
salesarea,carallowence,typingspee
d will be null.
Automatic (user-defined)
objects
These are specified using
keyword class in ODL.
Class employee
{
attribute
string
name;
attribute
date
birthdate;
attribute
enum gender{M,F}
gender;
relationship department
workfor
Void reassign(in string new-dname);
};
Object definition
language (ODL)
The ODL is designed to create an
object database schema.
Class
Class
inheritance
relationships
1.1
1:N
M:N
Has faculty
person
department
offers
Works in
faculty
advises
student
courses
section
gradstudent
advisor
Architecture
ClientServer
Database server
Object server