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

Re: Duplicate columns and group keys

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Thu, 30 Sep 2010 19:19:41 +0100
Message-ID: <4CA4D4BD.6010202@epimorphics.com>
To: Lee Feigenbaum <lee@thefigtrees.net>
CC: SPARQL Working Group <public-rdf-dawg@w3.org>

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.

Received on Thursday, 30 September 2010 18:20:55 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:01:01 UTC