Hi all,
I want to write a SPARQL query using ARQ that construct a RDF graph in
which I insert the result of an aggregation function. It appears simple
to me, but I cannot get it done.
For instance, consider the books dataset on
http://sparql.org/query.html. I want to count the books written by the
same authors. Using the SELECT form I write:
PREFIX books: <http://example.org/book/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?o (count(?o) as ?n)
WHERE
{ ?s dc:creator ?o }
GROUP BY ?o
Simple enough, but what if I want to put ?n in a RDF graph? I've tried
several variants of the following query but none appears to be
grammatically valid
PREFIX books: <http://example.org/book/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
CONSTRUCT { ?o <http://ex.org/n> (count(?o) as ?n) }
WHERE
{ ?s dc:creator ?o }
GROUP BY ?o
Can you help me?
Is this something that SPARQL 1.1 will enable?
Thanks a lot in advance,
Emanuele
--
Emanuele Della Valle
Politecnico di Milano
http://emanueledellavalle.org