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
editTaking 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;
- an employee
- a department
- The full RDF (need to change the rewrite rule to fix this strange uri)
This should be replaced by a query on the SPARQL endpoint.
RDF browsing
editThis RDF can be browsed with and RDF browser such as Disco , OpenLink RDF browser OpenLink Data Explorer or Tabulator as an add-in to Opera or Firefox
Querying with SPARQL
editThe RDF can be queried with SPARQL. The same queries uses in the SQL /XQuery example are expressed in SPARQL in this tutorial