The document discusses the Object Data Management Group (ODMG) standards for object databases, highlighting key concepts such as object models, object definition language (ODL), and object query language (OQL). It outlines the characteristics of objects and literals within the ODMG framework, the definition and use of interfaces and classes, and the structure of collection types. Additionally, it addresses the use of object factories for generating objects and the principles of inheritance in class definitions.
Advance Database ManagementSystems : 15
Object Data Management Group (ODMG)
Prof Neeraj Bhargava
Vaibhav Khanna
Department of Computer Science
School of Engineering and Systems Sciences
Maharshi Dayanand Saraswati University Ajmer
2.
Slide 21- 2
Objectives
•Discuss the importance of standards (e.g.,
portability, interoperability)
• Introduce Object Data Management Group
(ODMG): object model, object definition
language (ODL), object query language (OQL)
• Present ODMG object binding to programming
languages (e.g., C++)
• Present Object Database Conceptual Design
3.
Slide 21- 3
TheObject Model of ODMG
• Provides a standard model for object
databases
• Supports object definition via ODL
• Supports object querying via OQL
• Supports a variety of data types and type
constructors
4.
Slide 21- 4
ODMGObjects 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
5.
Slide 21- 5
ODMGLiterals
• 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
6.
Slide 21- 6
ODMGInterface 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);
};
7.
Slide 21- 7
Built-inInterfaces for
Collection Objects
• A collection object inherits the basic
collection interface, for example:
– cardinality()
– is_empty()
– insert_element()
– remove_element()
– contains_element()
– create_iterator()
8.
Slide 21- 8
CollectionTypes
• 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()
Slide 21- 10
AtomicObjects
• Atomic objects are user-defined objects and are defined via
keyword class
• An example:
class Employee (extent all_emplyees key ssn)
{
attribute string name;
attribute string ssn;
attribute short age;
relationship Dept works_for;
void reassign(in string new_name);
}
11.
Slide 21- 11
ClassExtents
• An ODMG object can have an extent
defined via a class declaration
– Each extent is given a name and will contain all
persistent objects of that class
– For Employee class, for example, the extent is
called all_employees
– This is similar to creating an object of type
Set<Employee> and making it persistent
12.
Slide 21- 12
ClassKey
• A class key consists of one or more unique
attributes
• For the Employee class, the key is ssn
– Thus each employee is expected to have a unique
ssn
• Keys can be composite, e.g.,
– (key dnumber, dname)
13.
Slide 21- 13
ObjectFactory
• An object factory is used to generate individual
objects via its operations
• An example:
interface ObjectFactory {
Object new ();
};
• new() returns new objects with an object_id
• One can create their own factory interface by
inheriting the above interface
14.
Slide 21- 14
Interfaceand Class Definition
• ODMG supports two concepts for specifying
object types:
– Interface
– Class
• There are similarities and differences between
interfaces and classes
• Both have behaviors (operations) and state
(attributes and relationships)
15.
Slide 21- 15
ODMGInterface
• An interface is a specification of the abstract
behavior of an object type
– State properties of an interface (i.e., its attributes
and relationships) cannot be inherited from
– Objects cannot be instantiated from an interface
16.
Slide 21- 16
ODMGClass
• A class is a specification of abstract behavior
and state of an object type
– A class is Instantiable
– Supports “extends” inheritance to allow both
state and behavior inheritance among classes
– Multiple inheritance via “extends” is not allowed
17.
Assignment
• What doyou understand by collection object.
Give example of some interfaces related to
collection objects.
• Explain the concept of interface and class on
OODBMS