411 REFERENCE · Wikibooks
XQuery/The Emp-Dept case study
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
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:
Emp
Dept
Salgrade
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
This 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
The RDF can be queried with SPARQL. The same queries uses in the SQL /XQuery example are expressed in SPARQL in this tutorial