我想創建一個與耶拿查詢DBpedia的SPARQL查詢。當我使用Virtuoso時,該查詢正在工作,但是當我將它插入到下面的Java代碼中時,它將返回一個空集。DBpedia查詢返回的結果與Virtuoso但不是與耶拿
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() ;
有人可以幫我解決這個問題,請 – fadox
確實喜歡[查詢DBpedia的一個問題SPARQL和Jena](http://stackoverflow.com/q/1644252/1281433)有幫助嗎? –
「Christpher_Nolan」@ en'應該是「Christopher Nolan」@ en'嗎? (請注意'o'和空格而不是下劃線。) –