5.3 Exercise
Based on UML class diagram for a purchase order application below, create an object-
relational data model using Oracle 9i platform. Guideline:
a Name and Address are defined as column objects
b Phonelist is defined as varray type
c Order details is defined as nested table
d Other classes are defined as object types and only some
of these types are extended to tables
+personId : String +personName : Name
+personAddress : Address +phoneNumber : PhoneList
+birthDate : Date
Person
+firstName : String +midName : String
-lastName : String
Name
+street : String +city : String
-state : String +poscode : String
Address
-Has 1
-refers_to 1
-lives_at 1
-belongs_to 1
-employeeId : String -startDate : Date
-title : String
Employee
-customerId : String -companyName : String
Customer {optional,disjoint}
-orderId : String -orderDate : Date
-requiredDate : Date -shippedDate : Date
-shipAddress : Address
Orders
-orderId : String -productId : String
-unitPrice : Currency -discount : int
OrderDetails
-shipperId : String -companyName : String
-phoneNumber : PhoneList
Shippers
-phoneNumber : String
PhoneList
-productId : String -productName : String
-unitPrice : Currency -quantityPerUnit : int
Product
-Has 1
-belongsTo 1..
-Has 1
-belongsTo 1..
-Has 1
-Refers_to
-Refers_to 1
-Has -places
0..1
-is_made_by -Receives
0..1 -is_received_by
-is_shipped_by
-ships_order 0..1
Figure 5-13: UML class diagram for a Purchase Order application
36
5.4 Self Review Questions
1. What is the output of logical design phase?
2. How UML class diagram terminology differs from SQL3 and Oracle 9i in terms
of class and relationship?
3. Do you agree that all object types need to be extended to object tables? Give
your reasons.
4. What type of class that is usually mapped into nested table?
5. What kind of attribute, which can be mapped into VARRAY type?
37
6 Introduction
SQL3, which also referred as SQL: 1999 is an extension of SQL92 standard SQL92. The purpose of the extensions is fulfilling the needs of incorporating some of object-
oriented features in developing database applications. These are the features in SQL3 that introduce object-oriented structure in its superset, SQL92:
1. User-defined types ADTs, row types 2. User-defined functions and procedures
3. Type constructors for collection types sets, lists, and multisets 4. Type constructors for row types and reference types
5. Support for large objects BLOBs and CLOBs
The objectives of this practical include :
To map object-relational data model on physical design To write DDL statement using SQL3 syntax based on object relational
schema
38
6.1 Theoretical Background