1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
String queryString ="SELECT ?nom ?prenom WHERE { ?Homme <http://lacot.org/public/owl/famille#prenom> ?Paul." +
"?Homme <http://lacot.org/public/owl/famille#nom> ?nom ." +
"}";
Query query = QueryFactory.create(queryString);
// Execute the query and obtain results
QueryExecution qe = QueryExecutionFactory.create(query, model);
com.hp.hpl.jena.query.ResultSet rs = qe.execSelect();
for ( ; rs.hasNext() ; ){
QuerySolution soln = ((com.hp.hpl.jena.query.ResultSet) rs).nextSolution() ;
RDFNode c = soln.get("nom") ;
String n=c.asNode().getLocalName();
System.out.println(n);
RDFNode b = soln.get("prenom") ;
String p=b.asNode().getLocalName();
System.out.println(p); |
Partager