i'm trying run small query on dbpedia, query works, see here, don't why returning when doing jena, i'm getting 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(); ( ; results.hasnext() ; ) { querysolution soln = results.nextsolution() ; system.out.println(soln.getliteral("label")); }
any suggestion?
that embarassing, there space problem in query:
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')"+ "}";
Comments
Post a Comment