XQuery/The Emp-Dept case study
The Employee-Department case study used in the comparison of XQuery from SQL is used here to explore the XQuery/SPARQL pairing.
Conversion to RDF
Taking as the starting point the XML documents defining the three tables:
These documents are converted to RDF using an XQuery script guided by a mapping file. The generated RDF is cached. and accessed by an XQuery script to de-reference the resource URIs.
Individual resource URIs are re-written in Apache to calls on an XQuery script which retrieves the fragment of RDF from the cached file. Thus;
This should be replaced by a query on the SPARQL endpoint.
Querying with SPARQL
The RDF can be queried with SPARQL. The same queries uses in the SQL /XQuery example are expressed in SPARQL in this tutorial