Aggregates and Project Expressions in SPARQL 1.1 require that you use
brackets around them and that they be aliased using the AS keyword e.g.

SELECT (COUNT(?inst) AS ?instances) FROM <http://dbpedia.org> WHERE { ?inst
a <http://dbpedia.org/ontology/Activity> }

If you change your query to the above it should work fine unless you are
using a really outdated version of ARQ.

Regards,

Rob

> -----Original Message-----
> From: 朱曼 [mailto:[email protected]]
> Sent: 08 August 2011 15:15
> To: [email protected]
> Subject: is count function supported?
> 
> Dear list,
> 
> The following code causes "com.hp.hpl.jena.query.QueryParseException".
> Is
> count function supported?
> 
> import com.hp.hpl.jena.query.*;
> String queDBPedia = "select count(?inst)\n"
>                         + "from <http://dbpedia.org>\n"
>                         + "where {?inst a <
> http://dbpedia.org/ontology/Activity>}";
> Query query = QueryFactory.create(queDBPedia);
> 
> Or do I need to count the total number after I get all the instances?
> Thanks for your time!
> 
> Best regards
> 
> June

Reply via email to