Judul - Binus Repository

Download Report

Transcript Judul - Binus Repository

Matakuliah
Tahun
Versi
: M0174/OBJECT ORIENTED DATABASE
: 2005
: 1/0
Pertemuan 13
Object Query Language
1
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :
• Mahasiswa dapat Menghasilkan query
language dalam object data model (C3)
2
Outline Materi
•
•
•
•
Overview OQL
Accessing literal and named objects
Accessing object values
Accessing characteristics of object
3
Overview OQL
• OQL is an object database query
language, and is specified as part of the
ODMG.
• OQL can also be classified as an object
database sub-language in that its scope is
limited to performing just one aspect of
object database applications, e.g the sort
of queries and manipulations that can be
expressed in the object algebra
4
Overview OQL
• A particular limitation is that OQL can’t
express arbitrarily complex computations,
so OQL is not computation complete.
• It is therefore necessary to use OQL in
conjunction with other computer
languages:
– OQL is used to describe the retrieval and
manipulation of object.
– The ODL define interface to object type used
by the OQL code.
5
Overview OQL
– Other programming language, such as C++,
Java are used to implement object operations
e.g methods;
– Other programming language (C++,Java) are
used to implement application program, with
embedded OQL statements to manipulate the
object database
6
Overview OQL
• OQL can be used for both collection-oriented
and navigational queries:
 A collection-oriented query retrieves a collection of
objects - The way in which those objects are located
is the responsibility of the ODBMS, rather than the
application program.
 Navigational queries access individual objects and
use object relationships to navigate from one object to
another – it is the responsibility of the applications
program within which the OQL is embedded to specify
the navigation procedure for accessing all object of
interest.
7
Overview OQL
• The designer of OQL have adopted an
evolutionary approach. Rather than
designing a completely new language,
they have based OQL on SQL.
• Many query in SQL are also valid in OQL,
though sometimes with minor change.
However OQL also extends SQL to deal
with object-oriented notation and operation
invocation
8
Accessing literal and named objects
• The simplest form of OQL query is an
object name.
• Object names are used as entry points
into an object database
• Example
9
Accessing object values
• Dereferencing
• Example
10
Accessing characteristics of object
• An object name can be used, in
conjunction with the names of object
characteristics (attributes, relationships,
and operations) to access the individual
characteristics of the named object or of
others related to it
• Path
• Example
11
SUMMARY
• OQL can define objects of interest using
object names and literal values as entry
points into an object database.
• The simplest form of OQL query is a name
or literal value
• Paths are used to access object
characteristics and related object.
• Queries can access objects
• Alternatively, by preceding a query with an
asterisk, it an access object values
12