Friday 23 August 2013

Querying CTS edition of Osmanides through Fuseki

Once we have a CTS instance containing an XML edition, e. g. of Vlaho Getaldić's Osmanides, up and running, we query it through the Fuseki server, by SPARQL queries such as this one:

select ?x where {?x ?v """Fortis commisit, victorque evasit ab hoste. 165"""}

This means: find a (URN) citation for the line containing this text.

The result is:

<urn:cts:croALa:croalaget003.croalaget001.izdleipzig:165>

This was a working query. Now, here is a meaningful query:

select ?s ?p ?o where { <urn:cts:croALa:croalaget003.croalaget001.izdleipzig:10.249> ?p ?o .}

Meaning, more or less: return RDF predicate and object where the RDF subject contains value as named. This would be book 10, line 249 of the Osmanides.

A useful introduction to SPARQL can also be found under Beginner's guide to RDF: 6. Querying with SPARQL. For example, on using queries (here, with CTS namespace):

PREFIX cts: <http://www.homermultitext.org/cts/rdf/> select ?s ?p ?o where { <urn:cts:croALa:croalaget003.croalaget001.izdleipzig:10.250> cts:hasTextContent ?o .}