[go: up one dir, main page]

0% found this document useful (0 votes)
42 views35 pages

Chapter - 01 - Oodb - CS

The document provides an overview of Object-Oriented Database Management Systems (OODBMS), explaining their structure, advantages, and key features such as persistence and versioning. It contrasts OODBMS with Relational Database Management Systems (RDBMS) and introduces concepts like Object Definition Language (ODL) and Object Query Language (OQL). Additionally, it discusses the ODMG Object Model, characteristics of object-oriented databases, and the differences between OODBMS and Object-Relational Database Management Systems (ORDBMS).

Uploaded by

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

Chapter - 01 - Oodb - CS

The document provides an overview of Object-Oriented Database Management Systems (OODBMS), explaining their structure, advantages, and key features such as persistence and versioning. It contrasts OODBMS with Relational Database Management Systems (RDBMS) and introduces concepts like Object Definition Language (ODL) and Object Query Language (OQL). Additionally, it discusses the ODMG Object Model, characteristics of object-oriented databases, and the differences between OODBMS and Object-Relational Database Management Systems (ORDBMS).

Uploaded by

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

CHAPTER - 1

Concepts for Object-Oriented databases

Compiled by: Temesgen Tilahun

Compiled by: Temesgen Tilahun


Object-oriented Database Management System

 An object-oriented database management system (OODBMS),


sometimes shortened to ODBMS for object database management
system, is a database management system (DBMS) that supports the
modelling and creation of data as objects.

 This includes some kind of support for classes of objects and the
inheritance of class properties and methods by subclasses and their
objects.

Compiled by: Temesgen Tilahun 2


ODBMS

 The advantage of the ODBMS when writing applications using the OOP
approach is the removal of impedance mismatch; that is, the program manages
and works with objects instead of rows of data that must be combined into an
object.

 Many RDBMS vendors have extended their offerings into the object-relational
database management system (ORDBMS).

 Of course, superimposing some object-oriented concepts on relational


databases does not provide the full feature set of an ODBMS.

Compiled by: Temesgen Tilahun 3


Object-Oriented Databases

 Put simply, object-oriented databases (OODB) are databases that represent data in the
form of objects and classes.

 In object-oriented terminology, an object is a real-world entity, and a class is a


collection of objects.

 Object-oriented databases follow the fundamental principles of object-oriented


programming (OOP).

 The combination of relational model features (concurrency, transaction, and


recovery) with object-oriented principles results in an objected database model.

Compiled by: Temesgen Tilahun 4


Object-Oriented Databases

 The object-oriented database model (OODBM) is an alternative implementation to


that of a relational model.

 An object-oriented database is similar in principle to an object-oriented programming


language.

 An object-oriented database management system is a hybrid application that uses a


combination of object-oriented and relational database principles to process data.

 That said, we can use the following formula to outline the OODBM: Object-Oriented
Programming + Relational Database Features = Object-Oriented Database Model

Compiled by: Temesgen Tilahun 5


RDBMS vs. ODBMS

 Relational database management systems (RDBMS) currently are the most widely-
deployed type of DBMS.

 The relational abstraction of rows and columns accessed using Structured Query
Language (SQL) is well understood by most IT professionals.

 In contrast, object database systems can be better-suited for storing and manipulating
complex data relationships.

 It can be more difficult for applications to access data with many relationships stored
across multiple tables in an RDBMS than to access the data as an object in an ODBMS.

Compiled by: Temesgen Tilahun 6


Characteristics of Object-Oriented Databases

 Object-oriented databases combine the object-oriented programming concepts

and database capabilities to provide an integrated application development

system.

 In addition to basic object-oriented programming concepts such as

encapsulation, inheritance, polymorphism and dynamic binding.

 Object-oriented database also supports persistence and versioning.

Compiled by: Temesgen Tilahun 7


Persistence

 Persistence is one of the most important characteristics of object-oriented database


systems.

 In an object-oriented programming language (OOPL), objects are transient in nature,


that is, they exist only during program execution and disappear after the program
terminates.

 In order to convert an OOPL into a persistent programming language (or database


programming language), the objects need to be made persistent, that is, objects should
persist even after the program termination.

 Object Oriented Databases store persistent objects permanently on the secondary


storage.

Compiled by: Temesgen Tilahun 8


Persistence

 The data stored in OO database is accessed directly from the object-


oriented programming language using the native type system of the
language.

 Whenever a persistent object is created, the system returns a persistent


object identifier.

 Persistent OID is implemented through a persistent pointer , which points


to an object in the database and remains valid even after the termination
of program.
Compiled by: Temesgen Tilahun 9
Versioning

 Another important feature of OODBMS is versioning.

 Versioning allows maintaining multiple versions of an object, and


OODBMS provide capabilities for dealing with all the versions of the
object.

 This feature is especially useful for designing and engineering


applications in which the older version of the object that contains tested
and verified design should be retained until its new version is tested and
released.
Compiled by: Temesgen Tilahun 10
ODMG Object Model

 The object data management group (ODMG), a subgroup of the object


management group (OMG), has designed the object model for object-oriented
database systems.

 The OMG is a pool of hundreds of object vendors whose purpose is to set


standards for object technology.

 Later, it was revised into ODMG 2.0, which included a common architecture
and definitions for an OODBMS, definitions for an object model, an object
definition language (ODL), and object query language (OQL).

Compiled by: Temesgen Tilahun 11


Concepts and terminologies related to object model

 Objects: An object is the most basic element of an object model and it consists

of two components:

1. State (attributes and relationships) and

2. Behavior (operations).

 An object in the object model is described by four characteristics, namely,

identifier , name , lifetime and structure.

Compiled by: Temesgen Tilahun 12


Concepts and terminologies related to object model

1. Identifier: Each object is assigned a unique system generated identifier (OID) that
identifies it within the database.

2. Name: Some objects are also assigned a unique name within a particular database that can
be used to refer to that object in the program.

3. Lifetime: The lifetime of an object specifies whether the object is persistent (that is a
database object) or transient (a programming language object).

4. Structure: The structure of an object specifies how the object is created using a certain
type constructor. Various type constructors used in the object model are atom , tuple (or
row), set , list , bag and array.

Compiled by: Temesgen Tilahun 13


Concepts and terminologies related to object model

 Literal: A literal is basically a constant value that does not have an object identifier.
 Literal can be of three types, namely, atomic , collection and structured.

1. Atomic literals correspond to the values of basic data types of the object model
including long, short, and unsigned integers, floating point numbers, Boolean values,
character, string and enumeration type values.

2. Collection literals define a value that is a collection of objects or values such as set,
array, list, bag, etc., but the collection itself does not have an object identifier.

3. Structured literals correspond to the values that are constructed using the tuple type
constructor. It includes built-in structures like Date, Interval, Time and Timestamp.
Compiled by: Temesgen Tilahun 14
Concepts and terminologies related to object model

 Atomic (user-defined) Objects: A user-defined object that is not a collection

object is called an atomic object.

 In order to create object types (or instances) for atomic objects, the class

keyword is used which specifies the properties (state) and operations (behavior)

for the object types.

 The properties define the state of an object type and are described by
attributes and relationships.
Compiled by: Temesgen Tilahun 15
Concepts and terminologies related to object model

 Interface: Unlike a class that specifies both the abstract state and abstract
behavior of an object type, an interface specifies only the abstract behavior of
an object type.

 An interface cannot be instantiated that means objects cannot be created for


an interface.

 An interface is defined using the keyword interface.

 Note: An interface may also specify properties (along with the operations) of
an object type; however, these cannot be inherited from the interface.
Compiled by: Temesgen Tilahun 16
Concepts and terminologies related to object model

 Inheritance: The object model employs two types of inheritance relationships.


 One is behavior inheritance or interface inheritance in which the supertype is an interface and the
subtype is either a class or an interface.

 The behavior inheritance is specified using the colon (:) symbol.

 Another kind of inheritance relationship is EXTENDS Relationship, which requires both the
supertype and the subtype to be classes.

 This type of inheritance is specified using the keyword extends, and it cannot be used for
implementing multiple inheritance.

 Note that if a class is used as a subtype in multiple inheritance then it can inherit state and behavior
from at most one other class using extends in addition to inheriting from several interfaces via (:).

Compiled by: Temesgen Tilahun 17


Concepts and terminologies related to object model

 Extents: In ODMG object model, an extent can be declared for any object type

(defined using class declaration), and it contains all the persistent objects of

that class.

 An extent is given a name and is declared using the keyword extent.

 Whenever extents are declared, the database system automatically enforces

set/subset relationship between the extents of a supertype and its subtype.

Compiled by: Temesgen Tilahun 18


Object Definition Language (ODL)

 Object definition language, a part of ODMG 2.0 standard, has been designed to
represent the structure of an object-oriented database.

 ODL serves the same purpose as DDL (part of SQL), and is used to support various
constructs specified in the ODMG object model.

 The database schema is defined independently of any programming language, and


then the specific language bindings are used to map ODL constructs to the constructs
in specific programming languages like C++, Java, or Smalltalk.

 The main purpose of ODL is to model object specifications (classes and interfaces) and
their characteristics.

Compiled by: Temesgen Tilahun 19


Object Definition Language (ODL)

 Any class in the design process has three characteristics that are attributes,
relationships, and methods.

 The syntax for defining a class in ODL is shown here.

class <name>
{
<list of properties>
};

Compiled by: Temesgen Tilahun 20


Object Definition Language (ODL)

 Here, class is a keyword and the list of properties may be attributes,


relationships or methods.

 For example, consider the Online Book database and its objects BOOK,
AUTHOR, PUBLISHER and CUSTOMER .

 An Entity in E-R data model or a tuple in relational data model


corresponds to an object in object data model, and an entity set or a
relation corresponds to a class.

Compiled by: Temesgen Tilahun 21


 See the Handout PDF Examples from page 4 up to page 6.

Compiled by: Temesgen Tilahun 22


Table 1 - Graphical notations for representing ODL
schema constructs

Compiled by: Temesgen Tilahun 23


Table 2 - Graphical object database schema for Online
Book database

Compiled by: Temesgen Tilahun 24


Object Query Language (OQL)

 Object Query Language (OQL) is a standard query language designed for the
ODMG object model.

 It resembles SQL (used for relational databases) but it also supports object-
oriented concepts of the object model, such as object identity, inheritance,
relationship sets, operations, etc.

 An OQL can query object databases either interactively (that is by writing ad


hoc queries) or OQL queries can be embedded in object-oriented programming
languages like C++, Java, Smalltalk, etc.

Compiled by: Temesgen Tilahun 25


Object Query Language (OQL)

 Each Query in OQL needs an entry point to the database for processing.

 Generally, the name of an extent of a class is used as an entry point; however,


any named persistent object (either an atomic object or a collection object) can
also be used as a database entry point.

 Using an extent name as an entry point in a query returns a reference to a


persistent collection of objects.

 In OQL, such a collection is referred to by an iterator variable (similar to tuple


variable in SQL) that ranges over each object in the collection.
Compiled by: Temesgen Tilahun 26
Object Query Language (OQL)

 The basic OQL syntax is “SELECT- FROM - WHERE” as for SQL.

 For example, the query to retrieve the titles of all textbooks can be
specified as:

SELECT b.Book_title

FROM books b

WHERE b.Category = ‘Textbook’;

Compiled by: Temesgen Tilahun 27


Object Query Language (OQL)

 Here, books is an extent of class BOOK and b is an iterator variable.

 The query retrieves only the persistent objects that satisfy the condition
and the collection of these objects is referred to by b.

 For each textbook object in b , the value of Book_title is retrieved and


displayed.

 As the type of Book_title is a string, the result of the query is a set of


strings.

Compiled by: Temesgen Tilahun 28


Object Query Language (OQL)

 In order to access the related attributes and objects of the object under
collection, we can specify a path expression.

 It starts at the persistent object name or at the iterator variable, then it is


followed by zero or more relationship set names or attribute names
connected using the dot notation.

 To understand the path expression, consider a query that displays the


titles of all the books purchased by Allen, which is shown here.

Compiled by: Temesgen Tilahun 29


Object Query Language (OQL)

SELECT b.Book_title
FROM books b
WHERE b.purchasedby.Name = ‘Allen’;

 Here, the query retrieves a collection of all the books that are purchased
by the customer Allen using the path expression b.purchasedby.Name

 If Allen has purchased more than one copy of the same book the query
will result in a bag of strings.

Compiled by: Temesgen Tilahun 30


Object Query Language (OQL)

 With the use of DISTINCT clause the same query will return a set of

strings as shown here.

SELECT DISTINCT b.Book_title

FROM books b

WHERE b.purchasedby.Name = ‘Allen’;

Compiled by: Temesgen Tilahun 31


Object Query Language (OQL)

 If we want to retrieve a list of books purchased by Allen,

 We can use ORDER BY clause.

 For example, the following query results in a list of books purchased by Allen
in the ascending order by Category and in the descending order by Price.
SELECT DISTINCT b.Book_title
FROM books b
WHERE b.purchasedby.Name = ‘Allen’
ORDER BY b.Category ASC , b.Price DESC;

Compiled by: Temesgen Tilahun 32


OODBMS VERSUS ORDBMS

 The two kinds of object databases are similar in terms of their functionalities.

 Both the databases support structured types, object identity and reference

types.

 In addition, both support a query language for accessing and manipulating

complex data types and common DBMS functionality such as concurrency

control and recovery.

Compiled by: Temesgen Tilahun 33


Differences between OODBMS and ORDBMS

Compiled by: Temesgen Tilahun 34


Thank You !

?
Compiled by: Temesgen Tilahun 35

You might also like