关于爪哇的Virtuoso Yago

时间:2015-04-18 12:07:47

标签: sparql semantics virtuoso

我使用以下代码从hasLongitude使用java use virtuoso获取hasLatitudeyago,但我没有收到任何内容:((此代码中是否有任何问题) ??

VirtGraph set = new VirtGraph ("jdbc:virtuoso://localhost:1111", "dba", "dba"); 
        Query sparql = QueryFactory.create("PREFIX yago: <http://yago-knowledge.org/resource/> " + 
             "SELECT DISTINCT ?long ?lat " + 
             " FROM <http://yago-knowledge.org/resource> " + 
             " WHERE {" + 
             " yago:London yago:hasLatitude ?long. " + 
             " yago:London yago:hasLongitude ?lat. " + 
             " }"); 
        VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set); 
        ResultSet results = vqe.execSelect();
        while (results.hasNext()) { 
             QuerySolution rs = results.nextSolution(); 
             RDFNode s = rs.get("long"); 
             RDFNode p = rs.get("lat"); 
             System.out.println(" { " + s + " " + p + " . }"); }

0 个答案:

没有答案