Solution of Assignment No. 3
Object Oriented DBMS – CS713
Muhammad Mustafa - MS120400114
Question No.1
(15 Marks)
Discuss the important considerations
for Object Definition Language (ODL). Elaborate the Object Interchange Format
(OIF) with Examples.
Answer:
Important
Considerations for Object Definition Language (ODL):
·
ODL should not
be dependent on programming languages.
·
ODL should not
be a full fledge programming language. ODL should define the objects only and
not the manipulating techniques should be there in ODL.
·
ODL should also
be compatible with Interface Definition Language (IDL) given by OMG
·
ODL should be
extendible and practical. If it is required to add some more functionality by
other groups, ODL should allow it. And then it should be able to be used in
practical.
·
Just like in
other DBMSs the Data Definition Language is provided, ODL is meant to serve the
same purpose.
·
ODL only defines
the signatures of the object structures. Implementation is left to be carried
out by other language.
·
It is not a
manipulation language. It only provides the APIs for different programming
languages.
Object Interchange
Format (OIF):
·
It is a
specification language that provides us a mechanism how to dump the state of
ODMS to a set of files and how to load them from the same files afterwards
·
It should
provide the facility to support all the states of ODMS
·
OIF characterize
the states of ODMS using object identifiers, type bindings, attribute values,
and link to other files.
·
For Example:
o
mustafa Employee{};
In this example an instance of an employee is
created. System will assign it an identifier automatically, and a tag ‘mustafa’
has also been assigned. Later we can access the object with tag ‘mustafa’. Here
the object is uninitialized.
o
Interface
Employee{
attribute string
name;
attribute unsigned
short age;
}
Now
using this definition we can create objects in many ways as followings:
-
ali Employee{
“ali”, 25}
-
ali
Employee{name “ali”, age 25}
-
ali Employee{age
25, name “ali”}
Question No.2 (20
Marks)
Classify the basic guiding principles in C++
binding in ODL/OML. How many kinds of structured literals are supported to C++
ODL? Discuss with examples. How many operations are generally considered in it?
Guiding
principles in C++ binding in ODL/OML have the following two classifications:
·
C++ syntax for working
with persistent objects in ODMS should be no different than the C++ syntax for working
with transient objects in a general C++ programming language.
·
The data types
available in ODMS should be similar to those used in general C++ programming
language.
Following
five types of structured literals are supported to C++ ODL:
·
d_String
String can be created.
String can be appended by another string. String length can be calculated.
String can be searched.
·
d_Interval
It is time duration
between two time points. Interval can be created. Another interval can be added
or subtracted from the existing interval. Interval can be shifted to forward or
backward
·
d_Date
Date can be created.
Days can be counted of the year from current date. Days can be added or
subtracted from the data.
·
d_Time
This is a point of
time. Time can be created. Seconds, minutes, hours, days etc can be added or
subtracted from the current time.
·
d_TimeStamp
·
Time and data of
any event can be created and referred to as time stamp.
Following
four type of operation are generally considered in OML.
·
Objects
can be created
e.g.
d_Ref<Schedule> schedule1 = new Schedule;
·
Created
objects can be deleted
e.g.
schedule.delete_object()
·
Objects
can be modified
Modification is made
within the methods and once a modification is made it is notified as committed
as obj_ref->mark_modified()
Question No.3
(Marks 15)
Discourse the Object Oriented
composition of Oracle. Differentiate between Existence Dependent Aggregation
and Existence Independent Aggregation with their examples.
Answer:
OO Composition of
Oracle:
Nested
tables are used to keep the composition relationship between objects and
referential integrity is used.
Existence Dependent
Aggregation:
It
is a type of aggregation in which when a containing object is deleted, all the
contained objects are also deleted.
For
the implementation of this type of aggregation the ID of containing object is
also added in the contained objects. So when the containing object is deleted
the contained objects are also deleted.
Lab
|
Lab_ID
Description
|
Computer
|
Lab_ID
Comp_ID
Description
|
Printer
|
Lab_ID
Printer_ID
Description
|
Chair
|
Lab_ID
Chair_ID
Description
|
Non-Existence Dependent
Aggregation:
It
is a type of aggregation in which when a containing object is deleted, the
contained objects are not deleted.
For
the implementation of this type of aggregation a new aggregation table is
introduced and the ID of containing object and contained objects are kept in
the aggregate table. So when the containing object is deleted the contained
objects are not deleted.
Aggregate
|
Lab_ID
Part_ID
|
Computer
|
Lab_ID
Comp_ID
Description
|
Printer
|
Lab_ID
Printer_ID
Description
|
Chair
|
Lab_ID
Chair_ID
Description
|
Lab
|
Lab_ID
Description
|
Download: Click Here