I want to get total count of sparql query results. I am using jena API for this in java. count query is working in virtuoso but its not working in java using jena api.
Sparql Query:
select ( count ( ?name ) AS ?total ) from < mygraph >
where { ?name rdf:type foaf:Name}
Its not working in jena API. I have read http://www.w3.org/2001/sw/DataAccess/issues#countAggregate So I think its not working in rdf but its working in Virtuoso sparql editor. So if u have a solution then plz let me know.And also tell me if there is alternative solution.
Thank you
Here is my java code,
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();
}
Below is the exception: HttpException: HttpException: 400 Bad Request: HttpException: 400 Bad Request.....