I'm now to Jena and SPARQL and i'm struggling with the queries
I'm trying to get the type from the following ontology.
uspv:R3 a pv:Report.
uspv:R3 pv:atTime uspv:R3t.
uspv:R3t a owltime:Interval;
owltime:hasDateTimeDescription uspv:R3dtDescription.
uspv:R3dtDescription owltime:unitType owltime:unitYear;
owltime:year "1871"^^xsd:gYear.
uspv:R3 pv:category pv:riot.
uspv:R3 pv:motivation pv:political.
uspv:R3 pv:motivation pv:race.
uspv:R3 pv:fatalities uspv:R3f.
uspv:R3f a pv:FatalitiesValue;
pv:unstructuredFatalities "0"^^xsd:string;
pv:fatalitiesValue "0"^^xsd:integer.
uspv:R3 pv:location uspv:R3l.
uspv:R3l a pv:Location;
pv:unstructuredLocation "Putnam Co"^^xsd:string.
uspv:R3 pv:source uspv:R3s.
uspv:R3s a pv:Source;
pv:unstructuredSource "Gilje"^^xsd:string.
uspv:R3 pv:description "Race riot during an election to replace a murdered black official. Trelease, p.319\n"^^xsd:string.
This is just a little chunk of a TTL file that I managed to read and create a model out of it. Now I'm trying the following code to retrieve the type.
private static void query() {
String queryString = "" +
"PREFIX da: <http://dacura.cs.tcd.ie/data/politicalviolence/uspv/>" +
"PREFIX w3: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" +
"SELECT ?type" +
"WHERE { da:R3t w3:type ?type. }";
com.hp.hpl.jena.query.Query query = QueryFactory.create(queryString);
QueryExecution qExe = QueryExecutionFactory.sparqlService( "http://dbpedia.org/sparql", query );
ResultSet results = qExe.execSelect();
ResultSetFormatter.out(System.out, results, query) ;
}
My output is just:
-------------
| typeWHERE |
=============
-------------
I think I didn't really get the concept of the queries. Please, could someone help me with this example?