Database Reference
In-Depth Information
COL_1_1 (corresponding to N_NAME of the outer query) and finally followed by
COL_2_1 (corresponding to the columen C_NAME of the inner query).
3.3 Computing the Compressed Structure and the Text Data of the Compressed
XML Document
Example. Fig. 3 shows the resulting compressed document for the query of our ex-
ample. The structure starts with a '4' (there are 4 nation tags) followed by a '2' (there
are 2 customers in Germany), a '1' (there is 1 customer in France), a '0' (there are 0
customers in USA) and finally by a '2' (there are 2 customers in Spain). The text data
contains the text nodes (and attribute values) of the result document shown in Table 2
in document order.
Structure: 4 2 1 0 2
Text data: Germany C#007 C#013 France C#042 USA Spain C#023 C#101
Fig. 3. Compressed document of our example
Overview. In order to compute the compressed document, first, the SQL query given
in Fig. 2 is evaluated and returns the results shown in Table 3.
The ORDER BY-clause of SQ is constructed in such a way that the text values of
the result to the SQL/XML query SX occur in the result to SQ in document order (c.f.
tables 3 and 4). Whenever the results of a sub-query SX1 of SX occur before the re-
sults of a sub-query SX2 of SX in the result document, the columns of the sub-query
Q1 of SQ that corresponds to SX1 occur before the columns of the sub-query Q2 of
SQ that corresponds to SX2 in the ORDER BY-clause of SQ, and both sub-queries
have disjoint sets of columns. Therefore, in the result set of SQ, all tuples of Q1 occur
before the tuples of Q2 (as the null value is considered as being the greatest value).
That means, that we can consider the tuples of Q1 independently of the tuples of Q2
and compute the text values and the compressed structure independently of each other
and concatenate them to the compressed result afterwards.
Whenever the result of a sub-query SX2 of SX is contained within the result of a
sub-query SX1 of SX in the result document, the tuples of the sub-query Q2 of SQ
that corresponds to SX2 as well as the tuples of the sub-query Q1 of SQ that corres-
ponds to SX1 contain the columns and values of Q1, but only the tuples of Q2 contain
the columns and values of Q2 and the tuples of Q1 contain null values in these col-
umns. The ORDER BY-clause of the query contains the columns of Q1 before the
columns of Q2. Therefore, for each value returned by sub-query Q1 for an XML ele-
ment, the result set contains each tuple returned by sub-query Q2 for a nested XML
element in the XML file, followed by the tuple of sub-query Q1 (c.f. Table 3).
Retrieving the Text Data. We can split each sub-sequence of tuples within the result
set belonging to two sub-queries Q1 and Q2, where Q1 contains Q2, into several sub-
sequences SSQ, whereas each sub-sequence SSQ ends with a line that has the
Query_ID of Q1 and contains the same values for the columns belonging to Q1.
For each such sub-sequence SSQ containing n tuples, we add the following to the
list of text values: First, the values of the columns of the first tuple belonging to out-
put columns of Q1 (i.e., the values of the outer query), followed by the values of the
Search WWH ::




Custom Search