Basically, I have the following query, and it works in all SPARQL online tests without problems, but when using Java and Jena 2.6.4 I never get any results. I wrote the values ββin the query for demo purposes.
PREFIX g: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX onto: <http://dbpedia.org/ontology/>
SELECT ?subject ?stadium ?lat ?long
WHERE
{ ?subject g:lat ?lat .
?subject g:long ?long .
?subject <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> onto:Stadium .
?subject rdfs:label ?stadium
FILTER ( ( ( ( ( ?lat >= 52.4814 ) && ( ?lat <= 57.4814 ) ) && ( ?long >= -1.89358 ) ) && ( ?long <= 3.10642 ) ) && ( lang(?stadium) = "en" ) )
}
LIMIT 5
Some Java, mind you, I tried to access this in several different ways, however I use SPARQL in the whole project and have no problems.
Query query = QueryFactory.create(s2);
QueryExecution qExe = QueryExecutionFactory.create(query, model);
ResultSet resultsRes = qExe.execSelect();
try {
while (resultsRes.hasNext()) {
QuerySolution soln = resultsRes.nextSolution();
}
} catch (Exception ex) {
System.out.println(ex);
}
source
share