sparql クエリ結果の合計数を取得したい。私はJavaでこれにjena APIを使用しています。count クエリは virtuoso では機能しますが、jena api を使用する Java では機能しません。
Sparql クエリ:
select ( count ( ?name ) AS ?total ) from < mygraph >
where { ?name rdf:type foaf:Name}
jena API では動作しません。http://www.w3.org/2001/sw/DataAccess/issues#countAggregateを読んだ ので、rdfでは機能せず、Virtuoso sparqlエディターで機能していると思います。解決策がある場合はお知らせください。また、別の解決策があるかどうかも教えてください。
ありがとうございました
ここに私のJavaコードがあります、
String countQueryString="select ( count ( ?name ) AS ?total ) from < mygraph >
where { ?name rdf:type foaf:Name}";
Query selectQuery = QueryFactory.create(countQueryString);
QueryExecution qe = QueryExecutionFactory.sparqlService(Constant.SPARQL_ENDPOINT, selectQuery);
Resultset results=qe.execSelect();
if(results.hasNext())
{
totalCount=countResult.next().get("total").toString();
}
以下は例外です: HttpException: HttpException: 400 Bad Request: HttpException: 400 Bad Request.....