1

DBpedia を照会した後に受け取る 2 つのリソース間の距離 (DBpedia'graph のエッジの数) を計算しようとしています。例えば:

     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();

これは文字列クエリです。

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";

さて、2 人のプレーヤー、または 2 つの国、または 2 つのクラブ間のエッジ (パス??) の数を計算する方法はありますか???? どうもありがとうございました...

4

1 に答える 1