【发布时间】:2010-06-04 18:37:36
【问题描述】:
CONSTRUCT 是 SELECT 的替代 SPARQL 结果子句。 CONSTRUCT 不返回结果值表,而是返回 RDF 图。例如,在以下 Java 代码中运行此查询会生成 HttpException: 406 Unacceptable。但是如果不是CONSTRUCT 块,我选择SELECT ?x,就好了。 Jena 是否支持CONSTRUCT,如果支持,如何支持? 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);
【问题讨论】: