我使用以下代码从hasLongitude
使用java use virtuoso获取hasLatitude
和yago
,但我没有收到任何内容:((此代码中是否有任何问题) ??
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 + " . }"); }