Database Reference
In-Depth Information
The translation S r = I NL D OC ( S , D s ) was shown in Figures 15.3 (a) and 15.3 (b). To
translate the mapping, we need to translate
π ( x , y , z ) into conjunctive queries
π
( x , y ) and
Q π ( x , y ) and Q π ( x , y , z ); the st-tgd in I NL M AP (
M
) will then be
Q π ( x , y )
→∃
zQ π ( x , y , z ) .
π is
We have already shown the translation Q π ( x , y ) in Example 15.7 . The translation of
id w R r ( id r )
.
R writer ( id wr , id r , y )
Q π ( x , y , z )=
id r
id wr
R work ( id w , id wr , x , z )
When we apply the resulting mapping I NL M AP (
) to the instance S r in Figures 15.3 (a)
and 15.3 (b), we get the following canonical universal solution:
M
rId
writerID
rID
@name
2
6
10
1
2
Kleinberg
R r :
R writer :
5
6
Tardos
9
10
Hungerford
workID
writerID
@title
@year
3
1
'Algorithm Design'
4
R work :
7
5
8
'Algorithm Design'
11
9
'Algebra'
12
Note that this canonical universal solution does not coincide with an inlining of the
canonical XML solution but rather contains one, as explained in Proposition 15.10 : notice,
for instance, that there are three distinct nulls in the relation for the root.
Now, if we have an XML query, for instance Q ( x )= r / writer ( x ) asking for writer
names, it will be translated into a relational query Q r = I NL Q UERY ( Q , D t ) as follows:
R writer ( id wr , id r , x ) .
When this query is evaluated over the canonical universal solution above (as Algorithm
15.6 prescribes), it produces the set
id wr R r ( id r )
Q r ( x )=
id r
{
Kleinberg , Tardos , Hungerford
}
, which of course is
certain M ( Q , S ).
Search WWH ::




Custom Search