I'm trying to calculate the distance (number of the edges in the DBpedia'graph) between two resources that I receive after querying DBpedia. For example:
Query query = QueryFactory.create(sparqlQueryString);
QueryExecution qexec =QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql",query);
try{
ResultSet results = qexec.execSelect();
for(; results.hasNext();) {
QuerySolution soln = results.nextSolution();
for(int i=0;i<solutionConcept.length;i++){
System.out.print(solutionConcept[i]+":"+soln.get(solutionConcept[i]).toString() +"; ");
}
System.out.println("\n");
}
} finally{
qexec.close();
and this is the string query:
String s6= "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "+
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "+
"PREFIX dbpedia: <http://dbpedia.org/resource/> "+
"PREFIX o: <http://dbpedia.org/ontology/> "+
"PREFIX dbprop: <http://dbpedia.org/property/>"+
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" +
"select ?Player ?nation ?club "+
"where {?Player rdf:type o:SoccerPlayer; dbprop:birthPlace ?nation; dbprop:currentclub ?club.} LIMIT 10";
well, is there a way to calculate the number of the edges ( the path??) between two players, or two nation , or two club???? Thank you very much...