KEMBAR78
ADBMS Object and Object Relational Databases | PPTX
Course specification
Advances in Database Management Systems
Course: M.Tech.(CSE)
Subject Code: 20MTCSE21
Credits: 03 [3:0:0]
Contact Hours: 45
Semester: II Semester
Maximum Marks: 100
By
Dr. M.K. Jayanthi Kannan, M.E.,MS.,MBA., M.Phil., Ph.D.,
Professor,
Faculty of Engineering & Technology,
JAIN Deemed To-Be University,
Bengaluru.
https://scholar.google.com/citations?user=8iCLmDkAAAAJ&hl=en
https://sa.linkedin.com/in/dr-m-k-jayanthi-kannan-979a7830
Staff Room: 324- 8.
Office Hours : 8.30 AM -4 PM
Department of Computer
Science and Engineering,
FET Block,
MODULE 1: OBJECT AND OBJECT-RELATIONAL
DATABASES 9 HOURS
 Overview of Object Database Concepts,
 Object Database Extensions to SQL,
 The ODMG Object Model and the Object
Definition Language ODL,
 Object Database Conceptual Design,
 The Object Query Language OQL,
 Overview of the C++ Language
 Binding in the ODMG Standard
OUTLINE
 Motivating Example
 Structured Data types
 Database design for ORDBMS
 OODBMS
 Comparing RDBMS, OODBMS and ORDBMS.
INTRODUCTION
 Database systems that were based on the object data
model were known originally as object-oriented
databases (OODBs) but are now referred to as
object databases (ODBs).
 Databases are fundamental components in many
software systems.
 Another reason for the creation of object-oriented
databases is the vast increase in the use of object-
oriented programming languages for developing
software applications.
4
INTRODUCTION
 Relational database systems support a small, fixed
collection of data types (e.g., integers, dates, strings),
which were adequate for traditional application domains
such as administrative data processing.
 In many application domains, however, much more
complex kinds of data must be handled.
 to support such applications, a DBMS must support
complex data types.
 Object-oriented concepts have strongly influenced
efforts to enhance database support for complex data
and have led to the development of object-database
systems
 Object-database systems have developed along two
distinct paths:
1. Object-oriented database systems
2. Object-relational database systems
MOTIVATING EXAMPLE
New Data Types
• User-defined data types
• Structured types
• Inheritance
• Object Identity
 A binary large object (BLOB) is just a long stream of
bytes.
 DBMS's support consists of storing and retrieving
BLOBs in such a manner that a user does not have to
worry about the size of the BLOB.
 BLOB can span several pages, processing of the BLOB
has to be done by the user's application program.
 semantics of the data is heavily dependent on the host
language application code and cannot be enforced by the
DBMS.
 structured types and inheritance, there is no support in the
relational model.
MANIPULATING THE NEW KINDS OF DATA
 ORDBMS provides
 User-defined methods
 Operators for structured types
 Operators for reference types
 Traditional relational systems offer limited flexibility in the
data types available.
 Data is stored in tables, and the type of each field value is
limited to a simple atomic type (e.g., integer or string).
 This limited type system can be extended in three main
ways:
 user-defined abstract data types
 structured types
 reference types.
STRUCTURED DATA TYPES
 type constructors allows to define new types with internal
structure.
 Types defined using type constructors re called structured types
 common type constructors include:
 ROW(n1 t1, ..., nn tn
 listof(base)
 ARRAY(base)
 setof(base)
 bagof(base)
 Those using listof, ARRAY, bagof, or setof as the
outermost type constructor are sometimes referred to
as collection types, or bulk data types.
 We can construct more complex data types from atomic
types and user-defined types using type constructor
 Collection types:
 Set
 Bag
 List
 Array
 Dictionary
14
OBJECTS AND OBJECT IDENTITY
 In object-database systems, data objects can be given
an object identifier (oid), which is some value that is
unique in the database across time.
 The DBMS is responsible for generating oids and
ensuring that an oid identifies an object uniquely over its
entire lifetime.
 In some systems, all tuples stored in any table are
objects and are automatically assigned unique oids;
 in other systems, a user can specify the tables for which
the tuples are to be assigned oids.
DATABASE DESIGN FOR AN ORDBMS
RDBMS Database Design
 In an RDBMS, we must store each video stream as a
BLOB and each location sequence as tuples in a table
Probes Loc(pid: integer, time: timestamp, lat: real, long:
real)
Probes Video(pid: integer, camera: string, video: BLOB)
 This design is about the best we can achieve in an
RDBMS. However, it suffers from several drawbacks.
ORDBMS DATABASE DESIGN
 ORDBMS supports a much better solution:
 we can store the video as an ADT object and write
methods that capture any special manipulation that we
wish to perform.
 we are allowed to store structured types such as lists, we
can store the location sequence for a probe in a single
tuple, along with the video information!
 This layout eliminates the need for joins in queries that
involve both the sequence and video information
OBJECT IDENTITY
 Differences between reference types and structured
types
1. Deletion
2. Update
3. Sharing versus copying
 storage distinctions between reference types and non
reference types, which might affect performance:
 Storage overhead
 Clustering
 Structured objects can thus be more efficient than
reference types if they are typically accessed in their
entirety.
OBJECT IDENTITY VERSUS FOREIGN KEY
 Using an oid to refer to an object is similar to using a
foreign key to refer to a tuple in another relation, but not
quite the same.
 An oid can point to an object that is stored anywhere in
the database
EXTENDING THE ER MODEL
 Extended ER model is used for ORDBMS design that
supports structured attributes (i.e., sets, lists, arrays as
attribute values)
Using Nested Collections
 Nested collections offer great modeling power, but also
raise difficult design decisions.
OODBMS
 OODBMS as a programming language with support for
persistent objects.
 OODBMSs support collection types and makes it
possible to provide a query language over collections.
 A standard has been developed by the Object Database
Management Group (ODMG) and is called Object Query
Language, or OQL.
 OQL is similar to SQL, with a SELECT–FROM–
WHERE–style syntax
 OQL allows the aggregate operation COUNT to be
applied to a list to compute the length of the list.
 OQL also supports reference types, path expressions,
ADTs and inheritance, type extents, and SQL-style
nested queries.
THE ODMG DATA MODEL AND ODL
 The ODMG data model is the basis for an OODBMS, just
like the relational data model is the basis for an RDBMS.
 A database contains a collection of objects, which are
similar to entities in the ER model.
 The properties of a class are specified using ODL and
are of three kinds:
 Attributes
 Relationships
 Methods.
 Attributes have an atomic type or a structured type.
 ODL supports the set, bag, list, array, and struct type
constructors.
 Relationships have a type that is either a reference to an
object or a collection of such references.
 A relationship captures how an object is related to one or
more objects of the same class or of a different class.
 Methods are functions that can be applied to objects of
the class.
 The keyword interface is used to define a class.
 For each interface, we can declare an extent, which is
the name for the current set of objects of that class.
OQL
 The ODMG query language OQL was deliberately
designed to have syntax similar to SQL, in order to make
it easy for users familiar with SQL to learn OQL
 OQL also supports DISTINCT, HAVING, explicit nesting
of subqueries, view definitions, and other SQL features.
 Query language proposed for ODMG object model
 OQL syntax for queries is similar SQL, with additional
features for ODMG concepts
COMPARING RDBMS WITH OODBMS
AND ORDBMS
RDBMS versus ORDBMS
 An RDBMS does not support the extensions to the
relational model.
 The simplicity of the data model makes it easier to
optimize queries for efficient execution.
 A relational system is easier to use because there are
fewer features to master.
 On the other hand, it is less versatile than an ORDBMS.
OODBMS VERSUS ORDBMS: SIMILARITIES
 both supports user-defined ADTs, structured types, object
identity and reference types, and inheritance.
 Both support a query language for manipulating collection
types.
 ORDBMSs support an extended form of SQL, and
OODBMSs support ODL/OQL.
OODBMS VERSUS ORDBMS: DIFFERENCES
 OODBMSs try to add DBMS functionality to a
programming language, whereas ORDBMSs try to add
richer data types to a relational DBMS.
1. OODBMSs aim to achieve seamless integration with a
programming language such as C++, Java or Smalltalk.
2. OODBMS is aimed at applications where an object-
centric viewpoint is appropriate; that is, typical user
sessions consist of retrieving a few objects and working
on them for long periods, with related objects.
 An ORDBMS is optimized for applications where large
data collections are the focus, even though objects may
have rich structure and be fairly large.
 It is expected that applications will retrieve data from disk
extensively, and that optimizing disk accesses is still the
main concern for efficient execution.
3. The query facilities of OQL are not supported efficiently in
most OODBMSs, whereas the query facilities are the
centerpiece of an ORDBMS.

INHERITANCE
 Inheritance allows us to create new types (called
subtypes) that extend existing types (called supertypes).
 Any operations that apply to the supertype also apply to
the subtype.
 We can overload methods by defining the same method
for sub- and supertypes.
ODMG Objects and Literals
• The basic building blocks of the object model are
– Objects
– Literals
• An object has four characteristics
1. Identifier: unique system-wide identifier
2. Name: unique within a particular database and/or program; it
is optional
3. Lifetime: persistent vs. transient
4. Structure: specifies how object is constructed by the type
constructor and whether it is an atomic object
ODMG Literals
• A literal has a current value but not an
identifier
• Three types of literals
1. atomic: predefined; basic data type values (e.g.,
short, float, boolean, char)
2. structured: values that are constructed by type
constructors (e.g., date, struct variables)
3. collection: a collection (e.g., array) of values or
objects
ODMG Interface Definition:
An Example
• Note: interface is ODMG’s keyword for class/type
interface Date:Object {
enum weekday{sun,mon,tue,wed,thu,fri,sat};
enum Month{jan,feb,mar,…,dec};
unsigned short year();
unsigned short month();
unsigned short day();
…
boolean is_equal(in Date other_date);
};
Built-in Interfaces for
Collection Objects
• A collection object inherits the basic
collection interface, for example:
– cardinality()
– is_empty()
– insert_element()
– remove_element()
– contains_element()
– create_iterator()
Collection Types
• Collection objects are further specialized into
types like a set, list, bag, array, and dictionary
• Each collection type may provide additional
interfaces, for example, a set provides:
– create_union()
– create_difference()
– is_subset_of(
– is_superset_of()
– is_proper_subset_of()
Object Inheritance Hierarchy
MODULE SUMMARY
OBJECT AND OBJECT-RELATIONAL DATABASES
We discussed the following topics ,
Overview of Object Database Concepts,
Object Database Extensions to SQL,
The ODMG Object Model and the Object
Definition Language ODL,
Object Database Conceptual Design,
The Object Query Language OQL,

ADBMS Object and Object Relational Databases

  • 1.
    Course specification Advances inDatabase Management Systems Course: M.Tech.(CSE) Subject Code: 20MTCSE21 Credits: 03 [3:0:0] Contact Hours: 45 Semester: II Semester Maximum Marks: 100 By Dr. M.K. Jayanthi Kannan, M.E.,MS.,MBA., M.Phil., Ph.D., Professor, Faculty of Engineering & Technology, JAIN Deemed To-Be University, Bengaluru. https://scholar.google.com/citations?user=8iCLmDkAAAAJ&hl=en https://sa.linkedin.com/in/dr-m-k-jayanthi-kannan-979a7830 Staff Room: 324- 8. Office Hours : 8.30 AM -4 PM Department of Computer Science and Engineering, FET Block,
  • 2.
    MODULE 1: OBJECTAND OBJECT-RELATIONAL DATABASES 9 HOURS  Overview of Object Database Concepts,  Object Database Extensions to SQL,  The ODMG Object Model and the Object Definition Language ODL,  Object Database Conceptual Design,  The Object Query Language OQL,  Overview of the C++ Language  Binding in the ODMG Standard
  • 3.
    OUTLINE  Motivating Example Structured Data types  Database design for ORDBMS  OODBMS  Comparing RDBMS, OODBMS and ORDBMS.
  • 4.
    INTRODUCTION  Database systemsthat were based on the object data model were known originally as object-oriented databases (OODBs) but are now referred to as object databases (ODBs).  Databases are fundamental components in many software systems.  Another reason for the creation of object-oriented databases is the vast increase in the use of object- oriented programming languages for developing software applications. 4
  • 5.
    INTRODUCTION  Relational databasesystems support a small, fixed collection of data types (e.g., integers, dates, strings), which were adequate for traditional application domains such as administrative data processing.  In many application domains, however, much more complex kinds of data must be handled.  to support such applications, a DBMS must support complex data types.  Object-oriented concepts have strongly influenced efforts to enhance database support for complex data and have led to the development of object-database systems
  • 6.
     Object-database systemshave developed along two distinct paths: 1. Object-oriented database systems 2. Object-relational database systems
  • 7.
    MOTIVATING EXAMPLE New DataTypes • User-defined data types • Structured types • Inheritance • Object Identity
  • 8.
     A binarylarge object (BLOB) is just a long stream of bytes.  DBMS's support consists of storing and retrieving BLOBs in such a manner that a user does not have to worry about the size of the BLOB.  BLOB can span several pages, processing of the BLOB has to be done by the user's application program.
  • 9.
     semantics ofthe data is heavily dependent on the host language application code and cannot be enforced by the DBMS.  structured types and inheritance, there is no support in the relational model.
  • 10.
    MANIPULATING THE NEWKINDS OF DATA  ORDBMS provides  User-defined methods  Operators for structured types  Operators for reference types
  • 11.
     Traditional relationalsystems offer limited flexibility in the data types available.  Data is stored in tables, and the type of each field value is limited to a simple atomic type (e.g., integer or string).  This limited type system can be extended in three main ways:  user-defined abstract data types  structured types  reference types.
  • 12.
    STRUCTURED DATA TYPES type constructors allows to define new types with internal structure.  Types defined using type constructors re called structured types  common type constructors include:  ROW(n1 t1, ..., nn tn  listof(base)  ARRAY(base)  setof(base)
  • 13.
     bagof(base)  Thoseusing listof, ARRAY, bagof, or setof as the outermost type constructor are sometimes referred to as collection types, or bulk data types.  We can construct more complex data types from atomic types and user-defined types using type constructor
  • 14.
     Collection types: Set  Bag  List  Array  Dictionary 14
  • 15.
    OBJECTS AND OBJECTIDENTITY  In object-database systems, data objects can be given an object identifier (oid), which is some value that is unique in the database across time.  The DBMS is responsible for generating oids and ensuring that an oid identifies an object uniquely over its entire lifetime.  In some systems, all tuples stored in any table are objects and are automatically assigned unique oids;  in other systems, a user can specify the tables for which the tuples are to be assigned oids.
  • 16.
    DATABASE DESIGN FORAN ORDBMS RDBMS Database Design  In an RDBMS, we must store each video stream as a BLOB and each location sequence as tuples in a table Probes Loc(pid: integer, time: timestamp, lat: real, long: real) Probes Video(pid: integer, camera: string, video: BLOB)  This design is about the best we can achieve in an RDBMS. However, it suffers from several drawbacks.
  • 17.
    ORDBMS DATABASE DESIGN ORDBMS supports a much better solution:  we can store the video as an ADT object and write methods that capture any special manipulation that we wish to perform.  we are allowed to store structured types such as lists, we can store the location sequence for a probe in a single tuple, along with the video information!  This layout eliminates the need for joins in queries that involve both the sequence and video information
  • 18.
    OBJECT IDENTITY  Differencesbetween reference types and structured types 1. Deletion 2. Update 3. Sharing versus copying
  • 19.
     storage distinctionsbetween reference types and non reference types, which might affect performance:  Storage overhead  Clustering  Structured objects can thus be more efficient than reference types if they are typically accessed in their entirety.
  • 20.
    OBJECT IDENTITY VERSUSFOREIGN KEY  Using an oid to refer to an object is similar to using a foreign key to refer to a tuple in another relation, but not quite the same.  An oid can point to an object that is stored anywhere in the database
  • 21.
    EXTENDING THE ERMODEL  Extended ER model is used for ORDBMS design that supports structured attributes (i.e., sets, lists, arrays as attribute values) Using Nested Collections  Nested collections offer great modeling power, but also raise difficult design decisions.
  • 22.
    OODBMS  OODBMS asa programming language with support for persistent objects.  OODBMSs support collection types and makes it possible to provide a query language over collections.  A standard has been developed by the Object Database Management Group (ODMG) and is called Object Query Language, or OQL.  OQL is similar to SQL, with a SELECT–FROM– WHERE–style syntax
  • 24.
     OQL allowsthe aggregate operation COUNT to be applied to a list to compute the length of the list.  OQL also supports reference types, path expressions, ADTs and inheritance, type extents, and SQL-style nested queries.
  • 25.
    THE ODMG DATAMODEL AND ODL  The ODMG data model is the basis for an OODBMS, just like the relational data model is the basis for an RDBMS.  A database contains a collection of objects, which are similar to entities in the ER model.  The properties of a class are specified using ODL and are of three kinds:  Attributes  Relationships  Methods.
  • 26.
     Attributes havean atomic type or a structured type.  ODL supports the set, bag, list, array, and struct type constructors.  Relationships have a type that is either a reference to an object or a collection of such references.  A relationship captures how an object is related to one or more objects of the same class or of a different class.
  • 27.
     Methods arefunctions that can be applied to objects of the class.  The keyword interface is used to define a class.  For each interface, we can declare an extent, which is the name for the current set of objects of that class.
  • 29.
    OQL  The ODMGquery language OQL was deliberately designed to have syntax similar to SQL, in order to make it easy for users familiar with SQL to learn OQL  OQL also supports DISTINCT, HAVING, explicit nesting of subqueries, view definitions, and other SQL features.  Query language proposed for ODMG object model  OQL syntax for queries is similar SQL, with additional features for ODMG concepts
  • 30.
    COMPARING RDBMS WITHOODBMS AND ORDBMS RDBMS versus ORDBMS  An RDBMS does not support the extensions to the relational model.  The simplicity of the data model makes it easier to optimize queries for efficient execution.  A relational system is easier to use because there are fewer features to master.  On the other hand, it is less versatile than an ORDBMS.
  • 31.
    OODBMS VERSUS ORDBMS:SIMILARITIES  both supports user-defined ADTs, structured types, object identity and reference types, and inheritance.  Both support a query language for manipulating collection types.  ORDBMSs support an extended form of SQL, and OODBMSs support ODL/OQL.
  • 32.
    OODBMS VERSUS ORDBMS:DIFFERENCES  OODBMSs try to add DBMS functionality to a programming language, whereas ORDBMSs try to add richer data types to a relational DBMS. 1. OODBMSs aim to achieve seamless integration with a programming language such as C++, Java or Smalltalk. 2. OODBMS is aimed at applications where an object- centric viewpoint is appropriate; that is, typical user sessions consist of retrieving a few objects and working on them for long periods, with related objects.
  • 33.
     An ORDBMSis optimized for applications where large data collections are the focus, even though objects may have rich structure and be fairly large.  It is expected that applications will retrieve data from disk extensively, and that optimizing disk accesses is still the main concern for efficient execution. 3. The query facilities of OQL are not supported efficiently in most OODBMSs, whereas the query facilities are the centerpiece of an ORDBMS. 
  • 34.
    INHERITANCE  Inheritance allowsus to create new types (called subtypes) that extend existing types (called supertypes).  Any operations that apply to the supertype also apply to the subtype.  We can overload methods by defining the same method for sub- and supertypes.
  • 36.
    ODMG Objects andLiterals • The basic building blocks of the object model are – Objects – Literals • An object has four characteristics 1. Identifier: unique system-wide identifier 2. Name: unique within a particular database and/or program; it is optional 3. Lifetime: persistent vs. transient 4. Structure: specifies how object is constructed by the type constructor and whether it is an atomic object
  • 37.
    ODMG Literals • Aliteral has a current value but not an identifier • Three types of literals 1. atomic: predefined; basic data type values (e.g., short, float, boolean, char) 2. structured: values that are constructed by type constructors (e.g., date, struct variables) 3. collection: a collection (e.g., array) of values or objects
  • 38.
    ODMG Interface Definition: AnExample • Note: interface is ODMG’s keyword for class/type interface Date:Object { enum weekday{sun,mon,tue,wed,thu,fri,sat}; enum Month{jan,feb,mar,…,dec}; unsigned short year(); unsigned short month(); unsigned short day(); … boolean is_equal(in Date other_date); };
  • 39.
    Built-in Interfaces for CollectionObjects • A collection object inherits the basic collection interface, for example: – cardinality() – is_empty() – insert_element() – remove_element() – contains_element() – create_iterator()
  • 40.
    Collection Types • Collectionobjects are further specialized into types like a set, list, bag, array, and dictionary • Each collection type may provide additional interfaces, for example, a set provides: – create_union() – create_difference() – is_subset_of( – is_superset_of() – is_proper_subset_of()
  • 41.
  • 60.
    MODULE SUMMARY OBJECT ANDOBJECT-RELATIONAL DATABASES We discussed the following topics , Overview of Object Database Concepts, Object Database Extensions to SQL, The ODMG Object Model and the Object Definition Language ODL, Object Database Conceptual Design, The Object Query Language OQL,