W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2009

Re: example query on aggregates in SPARQL/Query Section 2

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Thu, 5 Nov 2009 18:28:29 +0000
Message-ID: <58495e3d0911051028n752a578dybd13a59529289bd6@mail.gmail.com>
To: Axel Polleres <axel.polleres@deri.org>
Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
My undersatnding is that this query projects only ?totalPrice as an
aggregation, not as a function.  An aggregate is not a function in
this sense.

The prohibition covers

    SELECT ?totalPrice
or
    SELECT (?totalPrice/1.6 AS ?priceUKP)
or
    SELECT datatype(?totalPrice)
not
  SELECT (datatype(sum(?lPrice)) AS ?example), ?org

    Andy

2009/11/5 Axel Polleres <axel.polleres@deri.org>:
> Just browsing over the example again and rethinking our discussion regarding
> implicit grouping...
>
> PREFIX  <http://books.example/>
> SELECT SUM(?lprice) AS ?totalPrice
> WHERE {
>  ?org :affiliates ?auth .
>  ?auth :writesBook ?book .
>  ?book :price ?lprice
> }
> GROUP BY ?org
> HAVING (SUM(?lprice) > 10)
>
>
> has ungrouped variables book, auth...Looking at our resolution, I honestly
> don't get my head around the semantics here:
>
> "Consensus on prohibiting projecting variables/functions on variables that
> are not included in the group by clause. Details are pending discussion of
> ISSUE-41."
>
> That doesn't seem to cover this case, where there are ungrouped variables
> that *don't* appear in projections or scalar functions.
> Obviously, that query doesn't becomes weird if there are more than one
> authors from the same org, or if there are several prices for the same book.
>
> Opinions to resolve?
>
> best,
> Axel
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit
> http://www.messagelabs.com/email______________________________________________________________________
>
Received on Thursday, 5 November 2009 18:29:10 GMT

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