SPARQL query and distinct count

If you’re using Java and Jena’s ARQ, you can use ARQ’s extensions for aggregates. Your query would look something like:

SELECT ?tag (count(distinct ?tag) as ?count)
WHERE {
    ?r ns9:taggedWithTag ?tagresource.
    ?tagresource ns9:name ?tag
}
LIMIT 5000

The original SPARQL specification from 2008 didn’t include aggregates, but the current version, 1.1, from 2013 does.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)