1. Advanced Database Systems
Object Oriented Database
MIT 302
Reference: Object-Oriented Database {Concepts, Examples, Pros and Cons} (phoenixnap.com), et al
2. Objective
• To examine and learn the concepts of object-oriented
database design
• To understand the need to transition to object-oriented
database from the relational one
• To prepare for designing an object-oriented database
system using software tools, ei, LUCITCHART, UML 2.0 or
other latest version, Postgresql, or Mysql
3. Background
• Object Oriented Databases are a result of the advancement of
database systems from relational database management system
RDBMS
• Instead of dealing with entities, objects are dealt with
• It is the industry trend nowadays, though, majority of the world is
still on relational database
• OODB harmoniously dances with OO Programming languages, ie.
Java and c++, among others
• Postgresql is ideal sql
4. Object Database (Object-Oriented Database {Concepts, Examples, Pros and Cons} (phoenixnap.com)
• An object database is managed by an object-
oriented database management system (OODBMS). The database
combines object-oriented programming concepts with relational
database principles.
• Objects are the basic building block and an instance of a class, where
the type is either built-in or user-defined.
• Classes provide a schema or blueprint for objects, defining the
behavior.
• Methods determine the behavior of a class.
• Pointers help access elements of an object database and establish
relations between objects.
6. Object Oriented DB (Object-Oriented Database {Concepts, Examples, Pros and Cons} (phoenixnap.com)
7. OODB (Object-Oriented Database {Concepts, Examples, Pros and Cons} (phoenixnap.com)
• The main characteristic of objects in OODBMS is the
possibility of user-constructed types. An object
created in a project or application saves into a
database as is.
• Object-oriented databases directly deal with data as
complete objects. All the information comes in one
instantly available object package instead of multiple
tables.
8. Object classes
Similar objects (have the same attributes, respond to the same messages) are
grouped into a class.
The attributes and associated methods are defined once for the class.
Al objects in a class have the same:
variable types
message interface
methods
They may differ in the values assigned to variables
Classes are analogous to entity sets in the ER model.
Example: all branch objects would be described by a single Branch class.
10. 10
Class attributes describes the general characteristics of the class,
such as totals or averages( ex: total no of branches)
Class methods are used to change or query the state of class attributes
There are special class methods to create new instances of the class:
new --constructor
destructor
In the following example, employment-length is a derived attribute.
For strict encapsulation, methods to read and set other variables are
also needed
11. class employee {
/*Variables */
string name;
string address;
date start-date;
int salary;
/* Messages */
int annual-salary;
string get-name;
string get-address;
int set-address ( string new-address)
int employment-length;
};
12. Object-Oriented Programming Concepts
• Polymorphism
• Inheritance
• Encapsulation
• Abstraction
These four attributes describe the critical characteristics of object-oriented management systems
13. Polymorphism
• is an object-oriented programming concept that refers
to the ability of a variable, function or object to take on
multiple forms. A language that features polymorphism
allows developers to program in the general rather than
program in the specific. www.techopedia.com/definition/28106/polymorphism-
general-programming
14. Inheritance
• is the procedure in which one class inherits the attributes
and methods of another class. The class whose properties
and methods are inherited is known as the Parent class.
And the class that inherits the properties from the parent
class is the Child class. www.analyticsvidhya.com/blog/2020/10/inheritance-object-
oriented-programmi…
Source: Wikipedia.org
15. Inheritance allows one class (subclass) to be defined as a special
case of a more general class (superclass).
The process of forming a superclass is referred to as generalization.
The process of forming a subclass is referred to as specialization.
By default, a subclass inherits all the properties of its superclass(es)
and, additionally, defines its own unique properties.
A subclass can redefine inherited methods.
All instances of the subclass are also instances of the superclass.
Principle of substitutability: we can use an instance of the subclass
whenever a method or a construct expects an instance
of the superclass..
16. The relation between the subclass and superclass: A KIND OF (AKO)
The relation between an instance and its class: IS-A.
Examples:
Manager is AKO Staff.
Susan Deer IS-A Manager.
Inheritance:
1. Single inheritance: the subclass inherits from no more than one
superclass
2. Multiple inheritance: the subclass inherits from more than one
superclass ===> conflicts!
18. Repeated inheritance: a special case of multiple inheritance
superclasses inherit from a common superclass
The inheritance mechanism must ensure that the subclass does
not inherits properties twice.
Staff
Manager Sales_Staff
Sales_Manager
4. Selective inheritance:allows a subclass to inherit a limited
number of properties from the superclass.
19. Object Identity
Each object is assigned an Object Identifier (OID) when it is
created that is:
system generated
unique to that object
invariant
independent of the values of its attributes
inivisible to the user
Other concepts:
overriding (+ overloading)
polymorphism & dynamic binding
complex objects
persistence
20.
21. OODBMS
Hierarchical Data Model
Network Data Model
Relational Data Model
ER Data Model
Semantic Data Model
Object-Relational Data Model Object Oriented Data Model
1960 -
1970
First generation DBMS
1970 - 1980 Second generation DBMS
E. Codd, 1970
IMS
Chen, 1976
Third generation DBMS
Hammer, McLeod,
1981
1980-2000
22. Encapsulation
• is one of the core concepts in object-oriented
programming. It describes the bundling of data and
methods operating on this data into one unit. It is often
used to implement an information-hiding mechanism.
Source: Object-Oriented Database {Concepts,
Examples, Pros and Cons} (phoenixnap.com)
23. Abstraction (stackify.com/oop-concept-abstraction/)
• key concepts of object-oriented programming (OOP) languages
• Its main goal is to handle complexity by hiding unnecessary
details from the user
• That enables the user to implement more complex logic on top
of the provided abstraction without understanding or even
thinking about all the hidden complexity
24. Example of OQL query
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.
25. Result of the query (SQL)
Product no Name Color
P1 Ford Mustang Black
P2 Toyota Celica Green
P3 Mercedes SLK Black
- The statement queries a relational database.
=> Returns a table with rows.
Name
Ford Mustang
Mercedes SLK
Result
Original table
26. Comparison
Queries look very similar in SQL and OQL,
sometimes they are the same
In fact, the results they give are very different
Query returns:
OQL SQL
Object
Collection of objects
Tuple
Table
27. SQL3 “Object-oriented SQL”
• Foundation for several OO database management systems –
ORACLE8, DB2, etc
• New features – “relational” & “Object oriented”
• Relational Features – new data types, new predicates,
enhanced semantics, additional security and an active
database
• Object Oriented Features – support for functions and
procedures
28. User defined Data Types
Creating a “row type”
Example:
create row type AddressType(
street char(50),
city char(20));
create row type StarType(
name char(30),
address AddressType);
29. Creating Data Types (contd.)
Creating “Table”
create table Address of type AddressType;
create table MovieStar of type StarType;
Instances of Row types are tuples in tables
30. Sample Query
Find the names and street addresses of those MovieStars
who stay in the city “Columbus”:
select MovieStar.name,
MovieStar.address.street
from MovieStar
where MovieStar.address.city = “Columbus”;
32. Requirement for this Trimester
1. This requirement shall be undertaken by INDIVIDUAL or by GROUP OF 2
2. Email me if you intend to do it alone or
3. Email me the name of your GROUP and MEMBERS. Please, indicate who is the
Project Manager
4. Immediately, choose a company, and send the profile of it
5. Your chosen company shall be the subject for your DATABASE DESIGN
6. You may choose whether your design shall be RELATIONAL DATABASE or OBJECT-
ORIENTED DATABASE
7. If it is Relational, you may use UML 2.0 thru LUCIDCHART and MYSQL
8. If it is Object-Oriented, you use UML 2.0 thru LUCIDCHART and Postgresql
9. By accomplishing item 1-6, you earned 10-point QUIZ