Noo*_*oor 4 java rdf sparql jena dbpedia
我只是试图在DBpedia上运行一个小查询,查询本身可以工作,在这里看到它,但我不知道为什么它在与Jena这样做时返回,我得到null.
String service = "http://dbpedia.org/sparql";
String queryString = "";
queryString = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?label" +
        "WHERE {" +
        "<http://dbpedia.org/resource/Quatre_Bornes> <http://dbpedia.org/ontology/country> ?y ."+
        "?y rdfs:label ?label ."+ 
        "FILTER (LANG(?label) = 'en')"+
        "}";
Query query = QueryFactory.create(queryString);
QueryEngineHTTP qexec = QueryExecutionFactory.createServiceRequest(service, query);
ResultSet results = qexec.execSelect();
for ( ; results.hasNext() ; ) {
    QuerySolution soln = results.nextSolution() ;
    System.out.println(soln.getLiteral("label"));
}
有什么建议吗?
这是如此令人尴尬,查询中存在空间问题:
String service = "http://dbpedia.org/sparql";
        String queryString = "";
        queryString = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?label " +
            "WHERE {" +
             "<http://dbpedia.org/resource/Quatre_Bornes> <http://dbpedia.org/ontology/country> ?y ."+
             "?y rdfs:label ?label ."+ 
             "FILTER (LANG(?label) = 'en')"+
            "}";
| 归档时间: | 
 | 
| 查看次数: | 795 次 | 
| 最近记录: |