(3) Result grouping with nested query
The above XML-QL inquiry will not group the result, the author of the same book will appear in different
WHERE
$ P
book> in "lib.xml"
Construct
Where
Construct
result>
In the above XML-QL statement, first specify the contents of the P variable of
If the content of the P variable has been specified, it can be used by XML-QL behind. You can also specify the P variable as the content of the
WHERE
book> Content_as $ P in "lib.xml"
Construct
Where
Construct
result>
Execute the above two queries, the result is the same:
result>
(4) Connecting elements according to value
XML-QL can connect two or more elements including the same value. For example, query all
Where
author> article> content_as $ a in "lib.xml"
author>
book> in "lib.xml"
Y> 2000
Construct
In the above query, we used variables f and l to connect. We first specify f and l to
In the above XML-QL, the contents of the construct statement have appeared in the WHERE statement. So, you can use the Element_as statement to avoid such repetitions.
Where
author>
article> content_as $ a in "lib.xml"
author>
book> Element_as $ E in "lib.xml"
Y> 2000
Construct $ E
(5) Extract data in different XML documents
XML-QL can query multiple XML documents and combine queries. The following example is obtained from Data.xml and TaxPayers.xml two documents to obtain names (
WHERE
> In data.xml,
> In turnpayers.xml
Construct
In addition to the above method, you can also use the skolem function to implement the above query (see) in the W3C documentation). The specific method is as follows:
{WHERE
> In data.xml
Construct
}
{Where
> In turnpayers.xml
Construct
}