CONSTRUCT
is an alternative SPARQL result clause to SELECT
. Instead of returning a table of result values, CONSTRUCT
returns an RDF graph. For instance, running this query in the following Java code produces an HttpException: 406 Unacceptable
. But if instead of the CONSTRUCT
block, I choose SELECT ?x
, it's just fine. Does Jena support CONSTRUCT
, and if so, how? Both queries are acceptable to the DBpedia endpoint.
PREFIX : <http://dbpedia.org/resource/>
PREFIX onto: <http://dbpedia.org/ontology/>
CONSTRUCT {
:France onto:anthem ?x
}
WHERE
{
:France onto:anthem ?x .
}
Query query = QueryFactory.create("the query goes here");
QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query);
ResultSet results = qexec.execSelect();
ResultSetFormatter.out(System.out, results, query);