0% found this document useful (0 votes)
24 views29 pages

OODB

Uploaded by

harts.toys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views29 pages

OODB

Uploaded by

harts.toys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

OODB

Conventional Database Systems


and Applications
• Uniformity: Large numbers of similarly structured
data items, all of which having essentially the
same size (in bytes).
• Record Orientation: Basic data items consist of
(fixed-length) records.
• Small Data Items: Each record (tuple) is short –
a tuple rarely requires more than a few hundred
bytes.
• Atomic Fields: Fields within a tuple are short,
length typically within a specific range, first
normal form holds.
Who Needs Object-Oriented
Databases ?
• Computer-aided design (CAD)
• Computer-aided software engineering
(CASE)
• Multimedia databases
• Office information systems (OIS)
• Expert database systems
OODBMS vs RDBMS
• RDBMS have been around for more than 20 years,
OODBMS are relatively new.
• RDBMS can handle >1010 records, OODBMS up to 107.
• OODBM good for storing complex descriptions (e.g., a
plant schematic), RDMSs appropriate for simple, “flat”
data.
• RDBMS control the DB market (>90%), OODBMS own
<5% of the market.
• Most commercial RDBMS come with an “Object-
Relational” extension which implements an object
database on top of a RDBMS
Impedence Missmath

Main Memory

Transform and type checking

SQL
Object-Oriented Paradigm
• Our environment exclusively consists of objects
• Together with the objects comes their behavior; i.e. objects
are described by their functionality
• Mostly we know the functionality of objects but we don't
know how this functionality is realized (encapsulation)
• Objects react to messages
• Only the objects themselves decide in which way they
react to a message
• Different objects may react to the same message in
different ways (polymorphism)
• Objects inherit characteristics and abilities as a result of
their membership of a special class or category
• The concepts of inheritance and polymorphism can best be
exploited if the underlying system supports run-time type
checking and late binding - the operation to be used is
choosen at run time and converted to a program address
OODB

Main Memory

Transform and type checking

SQL
Definisi
• Menurut Kim 1991:
– OODM :
Model data lojik yang merupakan hasil
Capture dari semantik objek yang didukung
oleh OOP
– OODB:
koleksi objek yang di share dan bersifat
persisten yang didefinisikan dalam OODM
– OODBMS:
Pengelolaan OODB
Object Data Model
Traditional Semantic OO Special
DB System Data Model Programming Requiement
• Persistence •Object ID
•Sharing •Encapsuation
•Transaction • Generalization •Inheritance • Versioning
•Concurrent •Type & Class
Control •Aggregation •Methods • Schema
•Recovery •Complex Evolution
•Security Object
•Integrity •Polymorphism
•Query •Extenxibility

Object Data Model


Struktur Object
• Object digambarkan dengan:
– Variable
– Message
– Method

Contoh Class
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();
};
• Methods to read and set the other variables are also needed with
strict encapsulation
• Methods are defined separately
– E.g. int employment-length() { return today() – start-date;}
int set-address(string new-address) { address = new-address;}
Inheritance
• Place classes into a specialization/IS-A
hierarchy
– variables/messages belonging to class person are
inherited by class employee as well as customer
• Result is a class hierarchy

Note analogy with ISA Hierarchy in the E-R model


Class Hierarchy Definition
class person{
string name;
string address:
};
class customer isa person {
int credit-rating;
};
class employee isa person {
date start-date;
int salary;
};
class officer isa employee {
int office-number,
int expense-account-number,
};
Example of Multiple Inheritance

Class DAG for banking example.


Object Identity
• An object retains its identity even if some or all of the
values of variables or definitions of methods change
over time.
• Object identity is a stronger notion of identity than in
programming languages or data models not based
on object orientation.
– Value – data value; e.g. primary key value used in relational
systems.
– Name – supplied by user; used for variables in procedures.
– Built-in – identity built into data model or programming
language.
• no user-supplied identifier is required.
• Is the form of identity used in object-oriented systems.
Object Identifiers
• Object identifiers used to uniquely identify objects
– Object identifiers are unique:
• no two objects have the same identifier
• each object has only one object identifier
– E.g., the spouse field of a person object may be an identifier
of another person object.
– can be stored as a field of an object, to refer to another
object.
– Can be
• system generated (created by database) or
• external (such as social-security number)
– System generated identifiers:
• Are easier to use, but cannot be used across database systems
• May be redundant if unique identifier already exists
Object Containment

• Each component in a design may contain other components


• Can be modeled as containment of objects. Objects containing;
other objects are called composite objects.
• Multiple levels of containment create a containment hierarchy
– links interpreted as is-part-of, not is-a.
• Allows data to be viewed at different granularities by different
users.
Skema Data
• Kotak untuk Objek
• Oval untuk relasi antar objek
Index
Doc_In
Entries : INT

Document
Capter
Containt
Title : String Title : String
Number : Int Revision : Int Index

Name : String

Auther
OO VS EER Data Modeling
• OO • EER
– Class – Entity type
– Object – Entity Instance
– Association – Relationship
– Inheritance of – Inheritance of
atribut attribut
– Inheritance of – No representation
behavior of behavior
Database Architecture
• Extended Database System
– Menyediakan fungsi untuk query basiswata
– Programer dapat berinteraksi dengan :
• Aplikasu bahasa pemrograman
• Bahasa SQL
• Database Programming Language
– Perluasan dari OOP, seperti C++, Java yang
menyediakan persistensi, concurrent control, dll
– Bahasa query dan OOP dieksekusi dalam lingkungan
aplikasi, berbagi data dan sstem yang sama
Database Architecture….
• Object Manager (persistent object stores)
– Sebuah paket yang disediakan leh file system atau
virtual memori
– Menyediakan repositori untuk object persistent
– Jangan melibatkan query atau bahasa pemrograman
– Aplikasi yang sederhana
• Database System Generator
– Mengijinkan implementator basisdata untuk
membangun DBMS untuk kebutuhannya
Database Architecture

DB Programing Language

Extended DBS
Database
System
generator
Object Manager
ODMS
• Database Prog. Language • Extended RDB System
– O2 – Postgres
– ObjectStore – Starburst
– Objectivity – Algres
– ONTOS – Ingres
– Versant – Sybase
– GBase – Xidak Orion
– STATICE • Object Manager
– MCC Orion – POMS
– Itasca – Mneme
• Database Syst. Generator – ObServer
– Exodus – Camelot
– Genesis – LOOM
OQL
• Stand Alone:
– Select struct (n: p.name, s: p.sex) from people
as p where p.age < 18

• Embedded in C++:
– D_oql_execute(teenagers, “Select p from
people as p where p.age < 18”
Operand
• Constans:
– 1, true, “string”, Nill
• Named Object
– People; President
• Variable
– P; p.age or p->age; I[i]
Operator
• Numerical: +, - , *, /, mod, abs
• Comarison : =, !=, >, <, >=
• Boolean : not, and, or
• Constructor:
– Object Employee(name:”John”, Salary:15000)
– Collection :Vector(1, 2, 3)
– Structure : struct(name: P.name, age: p.age)
– Literal Collection : set(1,2,3)
Operator on Collections
• Set
– Intersection, union, except
• Selection
– Select result(x, y, …) from col1 as x, col2 as y,…
where predicate(x,y,…)
• Quantificators
– For All x in collection
– Exist x in collection
• Conversion
– Element(singleton)
– Flatten(collection_of_collection)
OQL Select – From - Where
Select <list of values> from <list of collection
and typical member> where <condition>
• Collection in Fromcan be any expression
that evaluate to a collection

You might also like