KEMBAR78
Object oriented database | PPTX
TOPIC
Object Oriented Database
Present By:
Md. Hasan Imam Bijoy
Student of C.S.E
Email: hasan15-11743@diu.edu.bd
Daffodil International University, Dhaka, Bangladesh.
Presentation Outline:
 Object Definitions
 Object Structures
 Object-Oriented Concepts
 Object-Oriented Databases
 Object Query Language(OQL) with Example
 Object-Oriented SQL
 Advantage of OODBS etc.
Definition of an Object
 Object – User defined complex data types
• An object has structure of state (variable) and methods
(behavior/operation)
 An Object is described by four characteristics:
• Identifier : a system-wide unique id for an object
• Name : an object may also have a unique name in DB
(optional)
• Lifetime: determines if the object is persistent or transient
• Structure: Construction of objects using type constructor
Object Structure
The State (current value) of a complex object may be constructed
from other objects (or other vales) by suing certain type
constructor
Can be represent by (I,C,V)
 I is an unique id
 C is a type constructor
 V is the object state
Basic types : Atom, tuple and set
Collection type : list, bag and array
Object Oriented Concept
Abstract Data Types
 Class definition, provide extension to complex attribute types
Encapsulation
 Implementation of operation and object structure hidden
 Inheritance
 Sharing of data withing hierarchy scope, support code
reusability
Polymorphism
 Operator overloading
Object Oriented Database
Abstract Data Types
 A database system that incorporates all the important
object-oriented concepts
 Some additional feature
 Unique Object identifiers
 Persistent object handling
Object Query Language (OQL)
Declarative Query Language
 Not Computationally Complete
 Syntax based on SQL(Select, from where)
 Additional flexibility (queries with user defined operators and types)
Example of OQL
The following is a sample query
“what ate the name of the black product?”
Select distinct p.name
From Products p
Where p.color = “Black”
 Valid in both SQL and OQL, but result are different .
Result of the Query (SQL)
Product No Name Color
P1 Ford Mustang Black
P2 Toyota Celica Green
P3 Mercedes SLK Black
Result:
Name
Ford Mustang
Mercedes SLK
 The statement queries a relational
database
 Returns a table with rows
Original Table:
Result of the Query (OQL)
Product No Name Color
P1 Ford Mustang Black
P2 Toyota Celica Green
P3 Mercedes SLK Black
Original Table:
Result:
String String
Ford Mustang Mercedes SLK
 The statement queries a object
oriented database
 Returns a collection of object
Comparison
Queries look very similar in SQL and OQL, sometimes they are the
same
In fact , the result they give are very different
Query returns:
OQL SQL
Object Tuple
Collection of Objects Table
Object Oriented SQL – SQL3
Foundation for OO database management systems –
ORACLE8, DB2, etc.
New features – “relation” & “Object oriented”
Relational Feature – new data types, new predicts,
enhanced semantics, additional security and an active
database
Object Oriented Features – support for functions and
procedures
User Define Datatypes
 Creating a “row type”
Example:
Create row type AddressType(
street char(50)
city char(20));
Create row type StarType(
Name char(30)
Address AddressType)
Creating Data types
 Creating “Table”
• Create table Address of type AddressType;
• Create table MovieStar of type StarType;
• Instances of Row types are tuples in table;
Sample Query
 Find the name 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”;
Complex Data & Queries:
A Water Resource Management example
 A Database of state wide water projects
 Includes a library of picture sliders
 Indexing according to predefined concepts –
prohibitively expensive
 Type of Queries
 Geographic locations
 Reservoir levels during droughts
 Recent flood condition, etc.
Complex Data & Queries:
Addressing these queries
 Linking this database to landmarks on a topographic
map
 Examining the captions for each slide
 Implementing image-understanding programs
 Inspecting images and ascertaining attributes
These type of queries necessitate dedicated “methods”
Creating Function
 Create function one() returns int as “select 1 as RESULT”
language “SQL”
Select one() as answer:
Result
Answer
1
Creating “Table” & “Methods”
 Implementation:
Create tables slides(
id int,
date date,
Caption document,
pictureCD_Image,
method containsName
(name varchar)
return boolean
as external name “matching”
language ‘C’ );
Implementation
 Sample Query
Find a picture of a reservoir with lower level which
is in “Sacramento”
Select slides P, landmark L
Where isLowWaterLevel (P.picture) and
P.containsName (L.name) and L. name=“Sacramento”;
Object-Relational Mapping
 Object-Relational Mapping (ORM) systems built on top of traditional relational databases
 Implementor provides a mapping from objects to relations
 Objects are purely transient, no permanent object identity
 Objects can be retried from database
 System uses mapping to fetch relevant data from relations and construct objects
 Updated objects are stored back in database by generating corresponding update/insert/delete statements
 The Hibernate ORM system is widely used
 described in Section 9.4.2
 Provides API to start/end transactions, fetch objects, etc.
 Provides query language operating directly on object model
 queries translated to SQL
 Limitations: overheads, especially for bulk updates
Advantage of OODBMS
 Designer can specify the structure of objects and
their behavior (methods)
 Better interaction with object-oriented language
such as Java and C++
 Definition of complex and user-defined types
 Encapsulation of operations and user-defined
methods
A Water Resource Management example
 A Database of state wide water projects
 Includes a library of picture sliders
 Indexing according to predefined concepts –
prohibitively expensive
 Type of Queries
 Geographic locations
 Reservoir levels during droughts
 Recent flood condition, etc.
Thank you

Object oriented database

  • 1.
    TOPIC Object Oriented Database PresentBy: Md. Hasan Imam Bijoy Student of C.S.E Email: hasan15-11743@diu.edu.bd Daffodil International University, Dhaka, Bangladesh.
  • 2.
    Presentation Outline:  ObjectDefinitions  Object Structures  Object-Oriented Concepts  Object-Oriented Databases  Object Query Language(OQL) with Example  Object-Oriented SQL  Advantage of OODBS etc.
  • 3.
    Definition of anObject  Object – User defined complex data types • An object has structure of state (variable) and methods (behavior/operation)  An Object is described by four characteristics: • Identifier : a system-wide unique id for an object • Name : an object may also have a unique name in DB (optional) • Lifetime: determines if the object is persistent or transient • Structure: Construction of objects using type constructor
  • 4.
    Object Structure The State(current value) of a complex object may be constructed from other objects (or other vales) by suing certain type constructor Can be represent by (I,C,V)  I is an unique id  C is a type constructor  V is the object state Basic types : Atom, tuple and set Collection type : list, bag and array
  • 5.
    Object Oriented Concept AbstractData Types  Class definition, provide extension to complex attribute types Encapsulation  Implementation of operation and object structure hidden  Inheritance  Sharing of data withing hierarchy scope, support code reusability Polymorphism  Operator overloading
  • 6.
    Object Oriented Database AbstractData Types  A database system that incorporates all the important object-oriented concepts  Some additional feature  Unique Object identifiers  Persistent object handling
  • 7.
    Object Query Language(OQL) Declarative Query Language  Not Computationally Complete  Syntax based on SQL(Select, from where)  Additional flexibility (queries with user defined operators and types)
  • 8.
    Example of OQL Thefollowing is a sample query “what ate the name of the black product?” Select distinct p.name From Products p Where p.color = “Black”  Valid in both SQL and OQL, but result are different .
  • 9.
    Result of theQuery (SQL) Product No Name Color P1 Ford Mustang Black P2 Toyota Celica Green P3 Mercedes SLK Black Result: Name Ford Mustang Mercedes SLK  The statement queries a relational database  Returns a table with rows Original Table:
  • 10.
    Result of theQuery (OQL) Product No Name Color P1 Ford Mustang Black P2 Toyota Celica Green P3 Mercedes SLK Black Original Table: Result: String String Ford Mustang Mercedes SLK  The statement queries a object oriented database  Returns a collection of object
  • 11.
    Comparison Queries look verysimilar in SQL and OQL, sometimes they are the same In fact , the result they give are very different Query returns: OQL SQL Object Tuple Collection of Objects Table
  • 12.
    Object Oriented SQL– SQL3 Foundation for OO database management systems – ORACLE8, DB2, etc. New features – “relation” & “Object oriented” Relational Feature – new data types, new predicts, enhanced semantics, additional security and an active database Object Oriented Features – support for functions and procedures
  • 13.
    User Define Datatypes Creating a “row type” Example: Create row type AddressType( street char(50) city char(20)); Create row type StarType( Name char(30) Address AddressType)
  • 14.
    Creating Data types Creating “Table” • Create table Address of type AddressType; • Create table MovieStar of type StarType; • Instances of Row types are tuples in table;
  • 15.
    Sample Query  Findthe name 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”;
  • 16.
    Complex Data &Queries: A Water Resource Management example  A Database of state wide water projects  Includes a library of picture sliders  Indexing according to predefined concepts – prohibitively expensive  Type of Queries  Geographic locations  Reservoir levels during droughts  Recent flood condition, etc.
  • 17.
    Complex Data &Queries: Addressing these queries  Linking this database to landmarks on a topographic map  Examining the captions for each slide  Implementing image-understanding programs  Inspecting images and ascertaining attributes These type of queries necessitate dedicated “methods”
  • 18.
    Creating Function  Createfunction one() returns int as “select 1 as RESULT” language “SQL” Select one() as answer: Result Answer 1
  • 19.
    Creating “Table” &“Methods”  Implementation: Create tables slides( id int, date date, Caption document, pictureCD_Image, method containsName (name varchar) return boolean as external name “matching” language ‘C’ );
  • 20.
    Implementation  Sample Query Finda picture of a reservoir with lower level which is in “Sacramento” Select slides P, landmark L Where isLowWaterLevel (P.picture) and P.containsName (L.name) and L. name=“Sacramento”;
  • 21.
    Object-Relational Mapping  Object-RelationalMapping (ORM) systems built on top of traditional relational databases  Implementor provides a mapping from objects to relations  Objects are purely transient, no permanent object identity  Objects can be retried from database  System uses mapping to fetch relevant data from relations and construct objects  Updated objects are stored back in database by generating corresponding update/insert/delete statements  The Hibernate ORM system is widely used  described in Section 9.4.2  Provides API to start/end transactions, fetch objects, etc.  Provides query language operating directly on object model  queries translated to SQL  Limitations: overheads, especially for bulk updates
  • 22.
    Advantage of OODBMS Designer can specify the structure of objects and their behavior (methods)  Better interaction with object-oriented language such as Java and C++  Definition of complex and user-defined types  Encapsulation of operations and user-defined methods
  • 23.
    A Water ResourceManagement example  A Database of state wide water projects  Includes a library of picture sliders  Indexing according to predefined concepts – prohibitively expensive  Type of Queries  Geographic locations  Reservoir levels during droughts  Recent flood condition, etc.
  • 24.

Editor's Notes

  • #2 NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image.