Title: ObjectOriented Databases
1Object-Oriented Databases
- Prof. Hyoung-Joo Kim
- OOPSLA Lab
- Computer Engineering
- Seoul National University
2Content
- Introduction
- Object-oriented data model
- Object-oriented query language
- Index organizations for aggregation graphs
- Multi-index, Join index, Nested index, Path index
Access support relation(ASR) - Index organizations for inheritance graphs
- SC-index, CH-index
- Summary
3Introduction
- Object-oriented database (OODB)
- object-oriented data model and concept
- effective support for the management of complex
objects(such as text, graphics, bitmap pictures,
sounds and animation files) - encapsulation property supports the integration
of packages for handling complex objects
4Introduction
- Important issues related to index in OODB
- navigational access
- be based on traversing object references
- set-oriented access
- be based on the use of a high-level, declarative
query language - the two means of access are often complementary
- a query selects a set of objects, and then the
retrieved objects and their components are
accessed by using navigational capabilities - suitable index techniques must be developed to
efficiently support object-oriented query language
5Object-Oriented Data Model
- Concepts of OO data model
- each real-world entity is modeled by an object
- each object has a set of instance attributes and
methods(operations) - the attribute values represent the objects state
- objects sharing the same structure and behavior
are grouped into classes - a class can be defined as a specialization of one
or more classes - the specialization relationship among classes
organizes them in an inheritance graph which is
orthogonal to the aggregation graph
6Object-Oriented Data Model
Journal
Organization
name
String
name
publisher
Publisher
Author
available issues
Staff
name
name
Book
books
String
title
String
year
Inheritance graph
integer
publisher
Aggregation graph
Manual
Handbook
domain
OS
String
String
Figure1.1 An object-oriented database schema
7Object-Oriented Data Model
- Figure 1.1
- simple arc from a class C to a class C
- C is domain of an attribute of C
- bold arc from a class C to a class C
- C is a superclass of C
- queries are made against classes
- indexes are allocated on classes
8Object-Oriented Query Language
- Features that most influence indexing techniques
- nested predicates
- Retrieve the authors of books published by
Kluwer. (Q1) - this query contains the nested predicate
published by Kluwer - nested predicate are expressed using
path-expressions - author.books.publisher.name Kluwer
- inheritance
- Retrieve all instance of class Book and all its
subclasses published in 1991. (Q2) - this query applies to all the classes in the
hierarchy rooted at class Book
9Object-Oriented Query Language
- Method
- derived method has a function comparable to that
of an attribute, so it returns an object(or a
value) - predicate method returns the logical constants
True or False - Query execution strategies
- have two dimension
- traversal strategies(1st dimension)
- forward strategy - the first class visited is the
target class of the query - reverse strategy - the traversal begins at the
leaves and proceeds bottom-up along the query
graph
10Object-Oriented Query Language
- technique used to retrieve instances(2nd
dimension) - nested-loop
- consists of instantiating separately each
qualified instance of a class - sort-domain
- consists of instantiating all qualified instance
of a class at once
11Index Organizations forAggregation Graph
- Notation
- given an aggregation graph H, a path P is defined
as C1.A1.A2.An - C1 is a class of H
- A1 is an attribute of class C1
- Ai is an attribute of a class Ci in H, such that
Ci is the domain of attribute Ai-1 of Class Ci-1 - len(P) n denote the length of the path
- class(P) C1 U CiCi is the domain of attribute
Ai-1 of class Ci-1 denote the set of the
classes along the path - dom(P) denote the class domain of attribute An
of class Cn
12Index Organizations forAggregation Graph
- example
- P1 Author.books.publisher.name
- len(P1)3, class(P1)Author, Book, Publisher,
dom(P1)string - P2 Book.year
- len(P2)1, class(P2)Book, dom(P2)integer
- P3 Organization.staff.books.publisher.name
- len(P3)4, class(P3)Organization, Author,
Publication, Publisher, dom(P3)string
13Index Organizations forAggregation Graph
- Example instantiation of the Path P3
Organization
Author
Book
Publisher
B1
A1
C Programming Lang.
1991
P2
O1
P1
B2
M. Ellis
M1
ATT Lab
A1, A4
Efficient Parsing for NL.
1986
P4
Academic Press.
A2
B3
Generalized LR Parsing
1991
P4
P2
O2
D. Mark
B4
Addison-Wesley
B4
C Programming
1990
P2
Carnegie Mellon U.
A3
A3
P3
Elsevier
Manual
O3
M. Tony
B2,B3
M1
C Ref. Manual
1991
P2
Unix
P4
Utrech U.
A4
A5
Kluwer
M2
GUI Guide
1993
P5
Windows
B. Stro.
B1,M1
O4
P5
Handbook
Microsoft
A5
Wisconsin U.
H1
Handbook of CS
1990
P2
Comp. Sci.
J. Van
H1
Figure 1.2 Instance of classes of the Database
schema in Figure 1.1
14Index Organizations forAggregation Graph
- Path instantiations
- complete instantiation
- they start with an instance belonging to the
first class of the path, contain an instance of
each class, and end with an instance of the class
domain of the path (P3) - partial instantiation
- its first component is not an instance of the
first class of the path (A2.B4.P2.Addison-We
sley) - Index graph(IG)
- abstract representation of a set of indexes
allocated along a path P
15Multi-Index
- Organization
- B-tree index on each class traversed by the path
- given a path PC1.A1.A2..An, a multi-index is
defined as a set of n simple indexes I1, I2,,In,
where Ii is an index defined on Ci.A1. - example path P1 Author.books.publisher.name
- I1 is allocated on Author.books similarly
indexes I2 and I3 are allocated on Book.publisher
and Publisher.name
I1
I2
I3
16Multi-Index
- Look-up of Q1
- a look-up of index I3 with key-value Kluwer
the result is P4. - A look-up of index I2 with key-value P4 the
resultt is B2,B3 - a look-up of index I1 with key-values B2 and
B3 the result is A3 which is the result of
the query - Index graph for multi-index
Organization
Author
Book
Publisher
Publisher.name
17Join Index
- Binary equijoin index
- BJI (ri,sk) ri.A sk.B
- given two relations R and S and attributes A and
B, a binary equijoin index is above - ri(sk) denote the surrogate of a tuple of R(S)
- tuple ri (tuple sk) refers to the tuple having ri
(sk) as surrogate - a BJI is implemented as a binary relation and two
copies may be kept, one clustered on ri and the
other on sk - each copy is implemented as a B-tree
18- Example
- P1 Author.books.publisher.name
- the first join index BJI1 is on Author.books.
- BJI1(a) is clustered on OIDs of instance of
Author - BJI1(b) is clustered on OIDs of instance of
Publisher - the second join index BJI2 is on Book.publisher
- BJI2(a) is clustered on OIDs of instance of Book
- BJI2(b) is clustered on OIDs of instance of
Publisher - the third join index BJI3 is on the attribute
Publisher.name - BJI3(a) is clustered on OIDs of instance of
Publisher - BJI3(b) is clustered on values of attribute name
19BJI1(a)
BJI1(b)
BJI2(a)
BJI2(b)
BJI3(a)
BJI3(b)
Join index organization for path P1
20Join Index
- Join index organization
- supports both forward and reverse traversal
strategies - Index graph for join index
Organization
Author
Book
Publisher
Publisher.name
21Nested Index
- Organization
- solving a nested predicate
- provide a direct association between an object of
a class at the end of a path and the
corresponding instance of the class at the
beginning of the path - P1 Author.books.publisher.name
- nested index associates with each publisher name
the OIDs of authors that have written a book
published by this publisher
22Nested Index
- Retrieval
- a query such as Q1
- be solved with only one index lookup
- Major problem
- update operation
- require access to several objects in order to
determine the index entries to be updated - require both forward and backward traversal of
objects, but nested index as defined above can
only be used for reverse traversal - two copies of a nested index
- can allocate two copies of a nested index as for
the join index organization
23Nested Index
A nested index for path P1 Author.books.publishe
r.name clustered on OIDs of instance of the
class at the beginning of the path
- Index graph for a nested index
Organization
Publisher.name
Author
Book
Publisher
24Path Index
- Organization
- simple index like the nested index
- provide an association between an object O at the
end of a path and all instantiations ending with
O - can be used to solve nested predicates against
all classes along the path
Path index for path P3 Organization.staff.books.
publisher.name
25Path Index
- Projections on path instantiation
- allows retrieving OIDs of several classes along
the path with a single index lookup - example
- determine all authors who have their books
published by Kluwer in 1991 - perform an index lookup with key-value equal
Kluwer - perform a projection on position of classes
Author(pos1) and Book (pos2) the results is
(A3,B2),(A3,B3) - the second element of each pair is extracted the
corresponding object is accessed and the
predicate on attribute year is evaluated. - If this predicate is satisfied, the first element
of the pair is returned
26Path Index
- Problem
- the path index organization can be used even when
no reverse reference among objects on the path
are present - Index graph for path index
Organization
Author
Book
Publisher
Publisher.name
27Access support relation(ASR)
- Organization
- similar to path index
- calculate all instantiations along a path and
store then in a relation - the i-th attribute of that relation corresponds
to the class Ci - Two B-tree are allocated on the first and the
last attributes
28Access Support Relation(ASR)
Organization
Publisher.name
Author
Publisher
Book
29Index Organizations forInheritance Hierarchies
- Object-oriented query
- apply to a class only or to a class and all its
direct and indirect subclasses - single-class query(SC-query)
- the query scope consists of only one class
- class-hierarchy query(CH-query)
- its scope includes a subhierarchy of the
inheritance hierarchy - rooted CH-query the root of the subhierarchy in
the scope coincides with the root class C - partial CH-query otherwise
30Single-Class Index(SC-Index)
- Organization
- be based on maintaining a separate B-tree on the
indexed attribute for each class - if the inheritance hierarchy has m classes, the
SC-index requires m B-tree - example
- consider the inheritance hierarchy rooted at
class Book in Figure 1.1 - if the attribute year is frequently referred,
the SC-index requires building three indexes - problem
- the SC-index is not efficient for CH-query
31Class-Hierarchy Index(CH-Index)
- Organization
- be based on maintaining a unique B-tree for all
classed in the hierarchy - an index entry in a leaf node may contain the
OIDs of instance of any class in the indexed
inheritance hierarchy. - example(same as the SC-index)
Entries of CH-tree for the inheritance hierarchy
rooted at class Book
32Class-Hierarchy Index(CH-Index)
- a leaf node in a CH-index consists if a
key-value, a key-directory, the number of
elements in the list of OIDs for instance of each
class - performance
- it has an inverse trend with respect to the
SC-index - it is more efficient for queries whose access
scope involves all classes in the indexed
inheritance hierarchy, whereas a SC-index is
effective for queries against a single class - problem
- the CH-tree retrieves many unnecessary leaf node
page when the query applies to a singe class only
33Other Structures
- Attempts to overcome the problems of the
SC-index, CH-index - H-tree
- Low, C.C. et al., H-tree A dynamic associative
search index for OODB, ACM SIGMOD 1992. - CG-tree
- Kilger, Moerkotte, Indexing multiple sets, VLDB
1994. - hcC-tree
- Sreenath and Seshadri, hcC-tree An efficient
index structure for OODB, VLDB 1994. - X-tree
- Chan et al., Indexing OODB instances based on
access proximity, ICDE 1997.
34Summary
- Open problem
- determine how all those indexing techniques
perform for different types of queries - optimal index allocation
- techniques for an efficient execution of queries
containing method invocations