– Part III
11
Chapter 28 Object-Oriented DBMSs: Standards and Systems
Review Questions
28.1 Discuss the main concepts of the ODMG Object Model. Give an example to illustrate each of
the concepts.
The ODMG OM is a superset of the OMG OM and specifies the following basic modeling
primitives:
The basic modeling primitives are the object and the literal. Only an object has a unique
28.2 What is the function of the ODMG Object Definition Language?
ODL is a language for defining the specifications of object types for ODMG-compliant
systems, equivalent to the Data Definition Language (DDL) of traditional DBMSs. Its main
28.3 What is the function of the ODMG Object Query Language?
12
28.4 How does the ODMG GROUP BY clause differ from the SQL GROUP BY clause? Give an
example to illustrate your answer.
28.5 How does the ODMG aggregate functions differ from the SQL aggregate functions? Give an
example to illustrate your answer.
The OQL aggregate functions can be applied within the select clause or to the result of the
28.6 What is the function of the ODMG Object Interchange Format?
28.7 Briefly discuss how the ODMG C++ language binding works.
A C class library is provided containing classes and functions that implement the ODL
Exercises
28.8 Map the object-oriented design for the Hotel case study produced in Exercise 27.22 to the ODMG
ODL.
class Hotel {
(extent hotels key hotelNo)
– Part III
13
}
class Room {
(extent rooms key hotelNo, roomNo)
}
class Guest {
(extent guests key guestNo)
}
class Booking {
(extent bookings key (hotelNo, guestNo, dateFrom))
attribute string hotelNo;
– Part III
14
Show how the following queries would be written in OQL:
(a) List all hotels.
(b) List all single rooms with a price below £20.00 per night.
(c) List the names and addresses of all guests.
(d) List the price and type of all rooms at the Grosvenor Hotel.
type prices {attribute price : float; type: char;}
(e) List all guests currently staying at the Grosvenor Hotel.
SELECT g
(f) List the details of all rooms at the Grosvenor Hotel, including the name of the guest
staying in the room, if the room is occupied.
– Part III
15
SELECT g.name
(g) List the guest details (guestNo, name and address) of all guests staying at the Grosvenor
Hotel.
28.11 Map the object-oriented database design for the DreamHome case study produced in Exercise
27.25 to the ODMG ODL.
Partial solution as follows:
– Part III
16
}
class Staff extends Person {
(extent staff key staffNo)
}
class Manager extends Staff {
(extent managers)
}
class PropertyForRent {
(extent rentals key propertyNo)
– Part III
17
class Client extends Person{
(extent clients key clientNo)
28.12 Map the object-oriented database design for the University Accommodation Office case study
produced in Exercise 27.26 to the ODMG ODL.
28.13 Map the object-oriented database design for the EasyDrive School of Motoring case study
produced in Exercise 27.27 to the ODMG ODL.
28.14 Map the object-oriented database design for the Wellmeadows case study produced in
Exercise 27.28 to the ODMG ODL.
class Ward {
– Part III
18
relationship list<WaitingList> HasWaitingList
}
class Person {
attribute struct PName {string fName, string lName} name;
}
deftype struct Qualification {date qDate, string qType, string institutionName;}
deftype struct WorkExperience {date sDate, date fDate, string position, string orgName;}
class Staff extends Person {
(extent staff key staffNo, NIN)
attribute string staffNo;
attribute string NIN;
}
– Part III
19
class Nurse extends Staff {
}
class Consultant extends Staff {
(extent consultants)
}
class StaffRota {
(extent rotas)
deftype struct NextOfKin {string nName, string nRelationship, string nAddress, string nTelNo;}
deftype struct OutPatientAppointment {date outPatDate, time outPatTime;}
class Patient extends Person{
(extent patients key patNo)
– Part III
20
}
class Doctor {
(extent gps key (docName, clinicNo))
}
class Appointment {
(extent appointments key appNo)
}
class WaitingList {
(extent waiting )
}
class Medication {
(extent medications)
– Part III
21
attribute string unitsDay;
class Pharmaceutical {
(extent drugs key drugNo)
attribute string drugNo;
attribute string dName;
class Non-Surgical/Surgical {
(extent supplies key itemNo)
attribute string itemNo;
attribute string iName;
– Part III
22
attribute string reqNo;
class Supplier {
(extent suppliers key supplierNo)
attribute string supplierNo;