W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > May 2011

Re: Comments on aggregation in SPARQL 1.1

From: Steve Harris <steve.harris@garlik.com>
Date: Tue, 17 May 2011 16:22:21 +0100
Message-Id: <A86C7E25-5CC1-4160-BC5E-A9621CCCCA13@garlik.com>
Cc: graham.klyne@zoo.ox.ac.uk
To: public-rdf-dawg-comments@w3.org
In response to http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2010Sep/0000.html

 > 1. Editorial
 >
 > I'm finding the section on aggregates is quite hard to follow.
 >
 > More examples, especially for GROUP_CONCAT, might make it easier
 > to understand the link between the algebra and its practical consequences
 > in SPARQL queries.

There is a balance between providing examples, and making the document too long.

The explanatory section on aggregates has been expanded, and there are now some testcases for aggregates http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/ - which hopefully illustrate the behaviour.

 > Also, I can't find any indication of the interaction between GROUP BY and ORDER
 > BY, where the ORDER BY specifies a variable not named in the GROUP BY: is this
 > allowed? If so, what effect does it have (e.g. on GROUP_CONCAT)?

Aggregate operations are performed on a multiset, so order is not preserved.

The group discussed the possibility of adding this feature but decided to postpone it to a future working group.

Please note: “ORDER BY after a GROUP BY must only use variables exposed by the GROUP.  Use of non-grouping variable outside the GROUP BY is not legal and a required syntax error.”

For example:

   SELECT ?book ?title
   WHERE {
     ?book dc:title ?title }
   GROUP BY ?book
   ORDER BY ?title
   ==> error.

 > 2. A Nice-to-have feature

We understand that you have now seen another solution to this issue, see http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2010Oct/0001.html.

Could you please respond to this message saying whether this comment has been answered to your satisfaction.

Regards,
   Steve, on behalf of the SPARQL Working Group

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD
Received on Tuesday, 17 May 2011 15:22:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 17 May 2011 15:22:50 GMT