Database Reference
In-Depth Information
then in force of (1) (Definition 13) we take
ω 1 ( x ):= ω 2 ( x )
.
Then we say that the missing value of x for the valuation ω 1 is discovered as ω 2 ( x ).
The following algorithm generates an XQuery program for a given schema and a set of TP-XFDs
over this schema. The program discovers all possible missing values, with respect to the given set of
TP-XFDs. We say that in this way the instance is being repaired .
Algorithm 2 . ( generation of XQuery program discovering missing values )
Input : A schema S ( x ) = / top [ E ] and a set F of text-valued TP-XFDs over S ( x ).
Output : Program in XQuery over instances of S ( x ) returning a repaired version
of the given instance of S ( x ).
Method:
xfdToXQuery (/ top [ E ]) - identical to the translation function
mappingToXQuery ( x (/ top [ E ] / top [ E ]) in Algorithm 1, except that the rule
(4) is replaced with the rule:
4'. ρ( l = x ) = < l >{
if ($ x = “ null ”) then F ( x' )[text() != “ null ”] /text ()
else $ x }
</ l >,
where ( F ( x' ), x ) F .
Example 7. Discovering missing values in an instance of S 1 (Figure 3) can be done using the XQuery
program (Query2) generated for the schema S 1 where TP-XFD constraints are:
F 1 ( x 1 ):= / pubs / pub [ title = x 1 ]/ year ,
and
F 2 ( x 3 ):=/ pubs / pub / author [ name = x 3 ]/ university .
The corresponding XQuery program is similar to this for Query 1. However, expressions defining
elements year and university attempt to discover missing values, when the current values of $x2 or $x3
are null:
Query 2:
<pubs>{
for $_v in doc(“I1.xml”)/pubs,
$_v1 in if ($_v[pub]) then $_v/pub else /,
$x1 in if ($_v1[title]) then $_v1/title/text()
else “null”,
$x2 in if ($_v1[year]) then $_v1/year/text()
Search WWH ::




Custom Search