Object Oriented Oracle Wenny Rahayu download
Object Oriented Oracle Wenny Rahayu download
https://ebookgate.com/product/object-oriented-oracle-wenny-
rahayu/
https://ebookgate.com/product/the-principles-of-object-oriented-
javascript-zakas/
ebookgate.com
https://ebookgate.com/product/php-object-oriented-solutions-1st-
edition-david-powers/
ebookgate.com
https://ebookgate.com/product/object-oriented-programming-
with-c-2-e-second-edition-sahay/
ebookgate.com
https://ebookgate.com/product/object-oriented-design-and-patterns-2nd-
edition-cay-s-horstmann/
ebookgate.com
Object oriented programming with ABAP Objects 1st Edition
James Wood
https://ebookgate.com/product/object-oriented-programming-with-abap-
objects-1st-edition-james-wood/
ebookgate.com
https://ebookgate.com/product/object-oriented-programming-in-c-7th-
print-with-corrections-edition-lafore/
ebookgate.com
https://ebookgate.com/product/management-of-the-object-oriented-
development-process-1st-edition-liping-liu/
ebookgate.com
https://ebookgate.com/product/actionscript-3-0-design-patterns-object-
oriented-programming-techniques-1st-ed-edition-william-sanders/
ebookgate.com
https://ebookgate.com/product/beginning-c-3-0-an-introduction-to-
object-oriented-programming-1st-edition-jack-purdum/
ebookgate.com
Object-Oriented
Oracle
David Taniar
Monash University, Australia
Eric Pardede
La Trobe University, Australia
IRM Press
Publisher of innovative scholarly and professional
information technology titles in the cyberage
Copyright © 2006 by Idea Group Inc. All rights reserved. No part of this book may be reproduced,
stored or distributed in any form or by any means, electronic or mechanical, including photocopying,
without written permission from the publisher.
Product or company names used in this book are for identification purposes only. Inclusion of the
names of the products or companies does not indicate a claim of ownership by IGI of the trademark
or registered trademark.
Object-oriented Oracle / Wenny Rahayu, David Taniar and Eric Pardede, editors.
p. cm.
Summary: " The book covers comprehensive and fundamental aspects of the implementation of
object-oriented modeling in a DBMS that was originated as a pure Relational Database, Oracle"--
Provided by publisher.
Includes bibliographical references and index.
ISBN 1-59140-810-5 (hardcover : alk. paper) -- ISBN 1-59140-607-2 (softcover : alk. paper) -- ISBN
1-59140-608-0 (ebook : alk. paper)
1. Oracle (Computer file) 2. Object-oriented methods (Computer science) I. Rahayu, Wenny, 1968-
II. Taniar, David. III. Pardede, Eric, 1975-
QA76.9.D26O23 2005
005.1'1--dc22
2005005340
All work contributed to this book is new, previously-unpublished material. The views expressed in this
book are those of the authors, but not necessarily of the publisher.
Object-Oriented
O r a cl e
Table of Contents
Preface
Distinguishing Features
Topical Coverage
II. This chapter particularly focuses on the static aspect of the object-oriented
conceptual model, including the inheritance, association, and aggregation re-
lationships.
Chapter IV justifies how the dynamic aspect of the object-oriented concep-
tual model (encapsulation and object-oriented methods) is implemented using
the new features of Oracle™, namely member procedures and functions.
Chapter V describes generic methods in Oracle™. This covers generic meth-
ods found in the object-oriented conceptual model, including the inheritance,
association, and aggregation relationships. The generic methods comprise typi-
cal database operations (e.g., update, delete, and insert) applied to the mem-
ber attributes of a class. The use of generic methods is a direct implementation
of object-oriented encapsulation features.
Chapter VI focuses on user-defined queries. New SQL features, covering
referencing and dereferencing using ref, super- and subclass accesses using
treat, nesting techniques using the and table, are explained. The chapter also
discusses the varray and nested-table collection types, object references deref,
the is dangling clause, and object attributes.
Chapter VII introduces a university case study that contains a database to
maintain the running of courses in a university. This case study shows the en-
tire database-application development life-cycle process from the object-ori-
ented design to transformation for implementation in Oracle™.
Finally, Chapter VIII presents another case study based on a retailer-chain
company. In addition to using the object-oriented conceptual model for the
database design, implementation is carried out using Oracle™ Form Devel-
oper. The aim is to show how a window-based database application can be
developed using the object-oriented technology in Oracle™.
Intended Audience
• Database Practitioners
Object orientation in Oracle™ has now opened a wide opportunity in
exploring new ways for building database applications. This book shows
how object-oriented features can be adapted for database-application
development. It describes not only the practical aspects of database-
application development, but also the theoretical foundations that lead to
xi
Although we have fully tested all code included in this book, should there be
any problems or confusion about the code, please do not hesitate to contact
us.
We would appreciate if you could also share any other comments or feedback
with us so that we can incorporate them in a future edition. Comments and
feedback may be sent directly to the publisher at
Object-Oriented Oracle™
Idea Group Inc.
701 East Chocolate Avenue, Suite 200
Hershey, PA 17033-1240, USA
xiii
Acknowledgments
Object-Oriented Oracle™ would not have been published without the sup-
port of a number of parties. We owe them our gratitude.
First of all, we would like to thank Mehdi Khosrow-Pour and Jan Travers of
Idea Group Publishing for believing in us on this project. They supported our
ideas in writing a book on this topic, and only because of their encouragement
and trust, this book becomes a realization.
We would also like to thank the team at Idea Group for keeping the schedule
on track. Their communication and support were very efficient and profes-
sional. We were glad for this opportunity to collaborate with them.
Finally, we would like to express our sincere thanks to our respective em-
ployers, the Department of Computer Science and Computer Engineering, La
Trobe University, Australia, and the School of Business Systems, Monash
University, Australia, for the facilities and time that we received during the
writing of this book. Without these, the book would not have been written in
the first place.
J. W. Rahayu
D. Taniar
E. Pardede
Chapter I
Object-Relational
Approaches
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
2 Rahayu, Taniar and Pardede
The static aspects of OOCM involve the creation of the objects and classes that
also includes decisions regarding their attributes. In addition, the static aspects
of OOCM are also concerned with the relationship between objects, that is,
inheritance, association, and aggregation.
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 3
get_age ( ) methods
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
4 Rahayu, Taniar and Pardede
name = ‘Adam’
work = Department
set_details ( )
put_details ( )
Inheritance Relationships
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 5
Person superclass
name
address
is a
Student subclass
student_ID
major
Consider Figure 1.3 as an example. Suppose there are two classes: Person and
Student. In this case, every student must be a person, so Student class inherits
from Person class. All features that apply to a person are applicable to a
student, and every student is a person. A student will also have a name and an
address from Person class. Moreover, a student can have additional features.
Therefore, the inheritance mechanism can be viewed as an extension of a
superclass.
On the other hand, rather than being considered as an extension, inheritance
can be viewed as a restriction on the superclass by hiding previously exported
features of the superclass. Figure 1.4 shows an example of using inheritance as
a restriction. Beside features such as name, address, and so forth, Employee
class has an attribute salary, whereas Volunteer class, which is a special case
of employee, does not receive any salary.
is a
Vo lunteer subclass
no_salary
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
6 Rahayu, Taniar and Pardede
Association Relationships
One-to-One Association
In this type, only one object can be connected with another object of the other
type for the particular association link, and vice versa.
For example, in Figure 1.5, Staff class and Office class are connected through
a work_in association link. The link is one-to-one type because only one staff
can work in one office, and one office can have only one staff working in it.
One-to-Many Association
In this type, the first object can be connected only with one of the second
object, but the second object can connect with many of the first object.
1 work_in 1
Staff Office
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 7
1… enrolled_in 1
Student Department
1… takes 1…
Student Subject
For example, in Figure 1.6, Student class and Department class are connected
through an enrolled_in association link. The link is one-to-many type because
one student can enroll only in one department, but one department can have
many students enrolled in it.
Many-to-Many Association
In this type, one object can be connected with many objects of the other type
for the particular association link, and vice versa.
For example, in Figure 1.7, Student class and Subject class are connected
through a takes association link. The link is a many-to-many type because one
student can take many subjects, and one subject can be taken by many
students.
Aggregation Hierarchies
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
8 Rahayu, Taniar and Pardede
PC
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 9
When the existence of the part object is fully dependent on the whole object,
then the aggregation relationship is of an existence-dependent type. In this type
of aggregation, whenever the whole object is removed, then all its associated
part objects will also be removed. Thus, no part object can exist without an
associated whole object. This is the most common type of aggregation, where
the whole object is more like a container object. When the existence of a part
object is independent of any whole object, we will have an existence-
independent aggregation.
Existence-dependent and existence-independent compositions are two aggre-
gation types in which the dependencies between the whole object and its part
objects are significant.
Figure 1.9 shows an example of an existence-dependent composition. In the
example, a Course Outline object is an encapsulation of several part objects,
that is, Course Objectives, Course Contents, and Course Schedule. When a
whole object is accessed, its part objects can be identified without the necessity
to trace every link from the Course Outline object. In an existence-dependent
type of composition, the deletion of a course outline will cause the deletion of
that particular course outline and all of its elements.
In an existence-independent type of composition, the existence of the part is
independent. For example, in Figure 1.10, if for some reason Travel Docu-
ments is removed, the ticket, itinerary, and passport still exist.
1… 1… 1…
Course Objectives Course Content Course Schedule
1… 1… 1…
Tickets Itinerary Passport
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
10 Rahayu, Taniar and Pardede
1 1
CPU Hard Disk
1…
1… 1…
Binary File Text File
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 11
Homogeneous Composition
Hard Disk
1
1…
Hard-Disk Controller
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
12 Rahayu, Taniar and Pardede
Attributes
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 13
Methods as a routine can be divided into two main parts: the generic method
and user-defined method.
Generic Methods
Generic methods are used to access attributes of an object. The concept behind
the need for generic methods is encapsulation, in which attributes associated
with an object can be accessed directly only by the methods of the object itself.
In object orientation, attributes refer to simple or primitive types (such as
integer, string, etc.), user-defined objects (such as Person, Student, etc.), or
collection types (such as list, array, set, and bag). Generic methods should
provide ways for accessing the different types of attributes.
Generic methods may have the following operations: retrieval, update,
delete, or insert. The retrieval generic methods are methods to retrieve the
attributes’ values. They are actually read-only methods and are often known as
queries. The update generic methods are used to update the values of the
specified attributes. The delete generic methods are used to delete the specified
attributes’ values. Since the update and the delete generic methods manipulate
the values of the specified attributes, they are often associated with the data-
manipulation language (DML). The insert generic methods insert new values to
the specified attributes. This is similar to the concept of object creation in an
object-oriented environment.
All of the above operations (i.e., retrieve, update, delete, and insert) can be
applied to inheritance, association, and aggregation hierarchies. Generic meth-
ods on inheritance hierarchies are methods that access attributes in inheritance
hierarchies. Normally, the method is declared in a subclass and accesses the
value of the superclasses’ attributes, and it may also access local attributes
(attributes of the subclass) as well.
Generic methods on association structures are methods that access attributes
of classes along an association structure. If two classes are associated through
an association relationship, methods declared in one class may access at-
tributes of the other class.
Generic methods on aggregation hierarchies are methods that access attributes
of other specified classes in an aggregation hierarchy. If the method is declared
in a whole class, the methods may access attributes of its part classes. The
opposite is applied if the method is declared in a part class, where it may access
attributes of the whole class as well as its own. Figure 1.16 illustrates the
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
14 Rahayu, Taniar and Pardede
Inheritance
Association
Aggregation
User-Defined Methods
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 15
New Era of
Object-Relational Approaches
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
16 Rahayu, Taniar and Pardede
Despite the differences between the object-oriented and the relational para-
digm, in reality, most of object-based development systems are still using the
RDBMS engine as their persistence mechanism. Therefore, a transformation
from object-oriented models into relational structures and operations is crucial.
Much work has been done in this area, where each structure in the OOCM is
transformed into implementation in pure RDBMS (Rahayu, Chang, Dillon, &
Taniar, 2000, 2001). This method is especially useful when the RDBMS
chosen for the implementation is a pure RDB that does not support object-
oriented extensions (SQL 92 standard).
SQL
User
Applications OQL
RDBMS
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 17
User SQL
Applications Object-
Oriented
Features
RDBMS
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
18 Rahayu, Taniar and Pardede
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 19
OODBMS RDBMS
Translator
User User
Applications Applications
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
20 Rahayu, Taniar and Pardede
the theoretical mapping from the originating schema into the target schema is
essential. Ideally, this mapping methodology should cover both the structural
component as well as the dynamic component of the database systems.
The relational data model has a sound theoretical foundation, is based on the
mathematical theory of relations and first-order logic, and gives the users a
simple view of data in the form of two-dimensional tables. Many DBMSs use
this relational model. Even nonrelational systems are often described as having
supporting relational features for commercial purposes. The model’s objec-
tives were specified as follows.
The first two objectives have been achieved by the relational model, mainly
because of the simplicity of the relational views presenting the data in two-
dimensional tables and the application of the normalization theory to database
design.
The third objective has been achieved by the use of relational algebra, which
manipulates tables in the same way that arithmetical operators manipulate
integers, and by nonprocedural languages based on logical queries specifying
the data to be obtained without having to explain how to obtain them.
The last objective is the essence of current developments concerning extended
relational and object-relational models.
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 21
Case Study
The Australian Education Union (AEU) keeps the records of its properties and
activities in a database using an object-oriented concept. Property can be
divided into two main categories: building and vehicle. Beside these two, there
are also other minor properties that are not categorized into building and
vehicle. Each building has several rooms and each room has computers in it.
Some of the rooms also have overhead projectors (OHPs).
The union employees’ records are kept in a separate class. Employees can be
divided into two types: office staff and organizers. Management is not included
in these two categories, although their data is also kept in the employee class.
While office staff work only internally in the union, the organizers have to
represent teachers in the area to which they have been assigned. One organizer
can represent many teachers, but one teacher can have only one organizer as
her or his representation. For this purpose, each organizer has been given one
vehicle, and that vehicle may be used only by that particular organizer. Each
organizer will be assigned only one area, which can be divided into several
suburbs. The area and suburb data are also kept in separate classes.
The union also keeps records for teachers who are union members. All of these
teachers have to work in government schools. Although it is not common, a
teacher can work in more than one school. The type of school that can liaise
with AEU has to be categorized into one of the three distinct types: primary
school, secondary school, and technical college (TechC).
We will draw an object-oriented model of the AEU database and determine the
type where necessary. We will identify the objects and the relationships as
follows.
• Identify Objects
To start with, we know that there will be a union object to store the data
about the AEU organization. It also has a property object that can be
divided into building and vehicle objects. Furthermore, there is a room
object that is composed of PC and OHP objects.
Next, we will need an employee object for AEU’s employee records.
Their types are also objects: Office Staff and Organizer. For working area
and suburb, we need two new objects as well.
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
22 Rahayu, Taniar and Pardede
1… 1 1 1…
works has
Employee Union Property
1 uses 1
Office Staff Organizer Vehicle Building
1
1 1
represents 1…
assigned in
Rooms
1 1…
1
Area Teacher
1 1…
1… 1…
1…
PC OHP
Suburb
teaches in
1…
School
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 23
After identifying the objects and their relationships, we can draw down the
object-oriented model for the AEU case study as it is shown in Figure 1.21.
Summary
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
24 Rahayu, Taniar and Pardede
References
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 25
Chapter Problems
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
26 Rahayu, Taniar and Pardede
Assuming that there are five classes, that is, References, Book,
Article_Journal, Conference_Paper, and PhD_Thesis, develop the class
hierarchy for the above description, and draw the corresponding class
diagram. You also need to identify the relationship between references
and another class, Postgraduate. Assume some attributes where neces-
sary.
6. AllBooks Library wants to extend its database by using the object-
oriented concept. For this purpose, in the database the authors are
categorized according to their backgrounds: industry based or academic.
If the author is an academic, the database needs to be further categorized
into research or teaching staff. They found that many academics are also
involved in industry and vice versa. However, it is found that an academic
may simultaneously be involved in both research and teaching. To simplify
the database, the developer decides that an academic can only be
recorded as a research staff or a teaching staff depending on his or her
primary role.
In the database, the books that the authors have written or edited are kept
in a different object named Course_Manual. For each datum in
Course_Manual, there are descriptions of each chapter that are kept as
another object. Draw the diagram for the object-oriented model de-
scribed above.
7. A new fast-food company, Hungry Burger, has just opened its first
restaurant in the country. One of its main menu items is called Huge Meal.
The Huge Meal package includes a big special hamburger, a drink, and a
generous-size bag of fries. The construction of the hamburger at Hungry
Burger has a special order that has to be followed. On the lower half of
the bun, kitchen staff will put a slice of meat patty, followed by two pieces
of lettuce, a slice of cheese, and a slice of tomato. The fries are made of
potatoes fried in grease. The hamburger and the fries may be sold
separately or with another package on the menu.
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 27
Draw the aggregation diagram for Hungry Burger’s Huge Meal. Explain
the dependency, order, and also the exclusiveness where necessary.
8. The Fast Run Bicycle Company is a major bicycle retailer. Unlike other
bicycle companies, it assembles its own bicycles to meet the customers’
requirements. The three main components are seats, frames, and wheels.
These three main components are inherited from the part class and these
parts are bought from several manufacturers. There are three categories
of bicycles assembled by Fast Run: racing, mountain, and road bicycles.
From the description given, draw a diagram for Fast Run that shows the
aggregation, inheritance, and association relationships.
Chapter Solutions
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
28 Rahayu, Taniar and Pardede
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Object-Relational Approaches 29
writes
Author Course_Manual
1
homogeneous
Industry_Based Academic
1…
Chapter
Research_Staff Teaching_Staff
1 1 1
Hamburger Drink Fries
1 1
1 1 1… 1 1 1… 1…
Bun Meat Lettuce Cheese Tomato Potato Grease
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
30 Rahayu, Taniar and Pardede
sold to
Bicycle Customers
1… 1
1
1 1 2
Seat Frame Wheel
made by
Parts Manufacturers
1… 1…
Copyright © 2006, Idea Group Inc. Copying or distributing in print or electronic forms without written
permission of Idea Group Inc. is prohibited.
Another Random Scribd Document
with Unrelated Content
*** END OF THE PROJECT GUTENBERG EBOOK IN THE GARDEN
***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
ebookgate.com