DBpedia Jena Query returns null

I'm just trying to run a small query in DBpedia, the query itself works, see here , but I don’t know why its returning, when I do this with Jaina, I get 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")); } 

Any suggestion?

+4
source share
1 answer

which is so embarrassing, there is a space problem in the request:

 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')"+ "}"; 
+5
source

All Articles