Information Technology Reference
In-Depth Information
major
student-no
Course
Student
Cours-no Cours-name
CS101
CS201
IS301
course-taken
(Stored OID)
Studen-no
Major
Student
Intro to CS
Database
Intro to MIS
123
124
Computer Science
Information Sys
course-
name
.
OID
Cours-register
Cours-no
Studen-no
course-
register
Course
CS101
CS201
IS101
123
123
124
course-no
mapping
OID
SQL Query Graph
OSQL Query Graph
Fig. 5.12
A SQL query graph (QG) is mapped to an OSQL QG
Refer to the case study for an example.
Relational Operation Insertion
Attribute values are specified for a tuple to be inserted in a relation R
k
. We denote
by v
1
, v
2
, … v
n
the values corresponding to attributes in R
k
and, if any, with V
f1
,
V
f2
, … V
fm
corresponding to the foreign keys in R
k
. The transformation technique
is to preserve the referential integrity between parent relations and child relations
through foreign keys V
f1
, V
f2
, … V
fm
in RDB to the association between class C
k
and its associated class through aggregate attributes
P
c1
,
P
c2
, …
P
cm
in OODB as fol-
lows (Zang and Fong
2000
):
Step 1. Locate the to-be-inserted object
According to the pre-process, we can map the to-be-inserted tuple in RDB to a
corresponding to-be-inserted object in OODB as follows:
SQL: INSERT into R (v
1
, v
2
…v
n
, V
f1
, V
f2
…V
fm
) value (V(v
1
), ..V(v
n
),
V(V
f1
)…V(V
fm
)
Pre-process(schema translation): Relation R
k
(v
1
,v
2
…v
n
,V
f1
,V
f2
…V
fm
)
→
Class C
k
(A
1
, A
2
…A
n
, P
c1
, P
c2
…P
cm
)
Step 2. (optional). Locate composite objects that contain the to-be-inserted object.
The aggregate attributes of a composite object contains the stored OID of an-
other object. We can locate, if any, the parent relations R
p1
, R
p2
, … R
pm
of the rela-
tion R
k
with the to-be-inserted tuple by matching its foreign keys V
f1
, V
f2
, … V
fm
against their parent relations' primary keys. We can map these parent relations to the
associated class C
a1
, C
a2
, … C
am
class of the to-be-inserted class C
k
by matching the
values of foreign keys as follows:
Search WWH ::
Custom Search