Im trying to create a SPARQL query using Jena to query DBpedia.
The query is working when I use it with standalone tools (Twinkle) but when I plug it in this Java code it returns an empty set.
String sparqlQueryString1 = "PREFIX dbont: <http://dbpedia.org/ontology/> " +
"PREFIX dbp: <http://dbpedia.org/property/>" +
"PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>" +
" SELECT ?musician ?place" +
" FROM<http://dbpedia.org/resource/Daphne_Oram>" +
" WHERE { " +
" ?musician dbont:birthPlace ?place ." +
" }";
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() ;
Any ideas what I'm doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…