Database Reference
In-Depth Information
ε : r
1: book
'Algorithm Design'
2: book
'Algebra'
13: subject
CS
22: subject
Math
11: author
12: author
21: author
111: name
Kleinberg
112: aff
CU
121: name
Tardos
122: aff
CU
211: name
Hungerford
212: aff
SLU
Figure 15.2 The XML tree T conforms to D
Satisfaction of these five requirements would guarantee that we have a correct relational
translation of an XML data-exchange problem, which would guarantee correct evaluation
of queries. The relational approach to XML data exchange, which we shall describe here,
satisfies all these five requirements.
15.2 Translations of schemas and documents
We start by reviewing the inlining technique, which provides the translation satisfying
Requirements 1 and 2. The main idea of inlining is that separate relations are created
for the root and for each element type that appears under a Kleene star in the DTD, and
other element types are inlined in the relations corresponding to their “nearest appropriate
ancestor”. Each relation for an element type has an ID attribute that is a key, as well as a
“parent-ID” attribute that is a foreign key pointing to the “nearest appropriate ancestor” of
that element in the document (for the root this attribute is skipped). All the attributes of
a given element type in the DTD become attributes in the relation corresponding to that
element type when such a relation exists, or otherwise become attributes in the relation for
the “nearest appropriate ancestor” of the given element type.
Example 15.1 Consider a DTD D given by the productions
book
book :@ title
r
book author subject
subject :@ sub
author name aff
name :@ nam
aff :@ aff ,
where aff stands for “affiliation”.
Atree T that conforms to this DTD is shown in Figure 15.2 . For convenience, we also
write node ids (which are strings of natural numbers, providing the path from the root to
each node).
The relational schema I NL S CHEMA ( D ) for storing XML documents that conform to D
is as follows:
Search WWH ::




Custom Search