W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2010

Re: Duplicate columns and group keys

From: Steve Harris <steve.harris@garlik.com>
Date: Thu, 30 Sep 2010 23:49:34 +0100
Message-Id: <DB4C2056-C153-42CB-87CF-CC045EAED926@garlik.com>
Cc: Lee Feigenbaum <lee@thefigtrees.net>, SPARQL Working Group <public-rdf-dawg@w3.org>
To: Andy Seaborne <andy.seaborne@epimorphics.com>
On 30 Sep 2010, at 19:19, Andy Seaborne <andy.seaborne@epimorphics.com> wrote:

> On 30/09/10 13:51, Lee Feigenbaum wrote:
>> On 9/30/2010 6:57 AM, Andy Seaborne wrote:
>>> Following a jena-dev question, I wondered what do implementations do
>>> with the following?
>>> 
>>> # Duplicate select variable - SPARQL 1.0
>>> SELECT ?s ?s ?p ?o
>>> {
>>> ?s ?p ?o
>>> }
>> 
>> Glitter returns the ?s "column" twice, including listing it twice in the
>> <head> of the SRX.
> 
> ARQ suppresses the duplicate although that's (now) controlled by a flag and the ARQ test suite passes with either setting.  I did have to fix the result set XML readers to cope; the JSON parser handles this at the JSON level.
> 
> The tricky case is
> 
> SELECT (?x+?y AS ?z) (?2*?x AS ?z)
> 
> which is a static error in ARQ
> but this is easier:
> 
> SELECT (?x+?y AS ?z) ?z
> 
> so of the 4 cases, ARQ only allows only allows
> 
> SELECT ?z ?z
> 
> and normally it means one variable but switching to two (should!) work.
> 
> The SPARQL 1.1 text needs clarification.
> 
>> 
>>> # Duplicate group by variable
>>> SELECT ?s
>>> {
>>> ?s ?p ?o
>>> } GROUP BY ?s ?s
>> 
>> I haven't tried this, but I'd expect this just works the same as GROUP
>> BY ?s - is there a subtlety here that I'm missing?
> 
> My reading of the defn of aggregation is that there is a key for the group which is the pair (?s, ?s) not simple ?s (the group key is ExprList - an expression list).  That means you'll get exactly the same answers although the route to getting them is slightly different but it's not observable.

Agreed. 

- Steve
Received on Thursday, 30 September 2010 22:50:55 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:43 GMT