我正在尝试使用 Jena 创建一个 SPARQL 查询来查询 DBpedia。该查询在我使用 Virtuoso 时有效,但当我将其插入以下 Java 代码时,它返回一个空集。
String sr="Christopher_Nolan";
String sparqlQueryString1 = "PREFIX dbont: <http://dbpedia.org/ontology/> "+
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+
"PREFIX foaf: <http://xmlns.com/foaf/0.1/> "+
" SELECT distinct ?s"+
" WHERE { "+
"?s foaf:name ?label ." +
"filter(?label=\"Christpher_Nolan\"@en)." +
" }";
Query query = QueryFactory.create(sparqlQueryString1);
QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query);
ResultSet results = qexec.execSelect();
ResultSetFormatter.out(System.out,results, query);
qexec.close() ;