Re: Feedback on SPARQL 1.1 support for aggregates (was Re: W3C Seeks Feedback on Early Draft of SPARQL 1.1)

Dear Axel,

first of all, thanks a lot for the careful look you gave to our comments 
to SPARQL 1.1 support for aggregates.

Please find hereafter our clarifications in line.

Axel Polleres ha scritto:
> further comments...
>
>   
>> Yes you're right. The correct formulation of the constraint is:
>>
>> In the C-SPARQL language all the variables used in the aggregation
>> function or in the grouping set of AGGREGATE clauses must appear also in
>> the SELECT clause, since aggregation happens after standard SPARQL query
>> evaluation.
>>     
>
> If I am not mistaken, doesn't work either... counterexample in your quoted example:
>
>   
>> AGGREGATE { (?affiliationBooks, SUM(?numberOfBooks), {?organization} )
>>     
>
>
> ?organisation is not in the SELECT clause.
>   

Of course. Yesterday, we fixed it in 
http://wiki.larkc.eu/c-sparql/sparql11-feedback, but I forgot reporting 
it to you.

> [...]
>   
>> Well, we based the SPARQL 1.1 version on our understanding of SPARQL 1.1.
>>
>> In our understanding, the triple pattern < ?auth :hasName ?name . > is
>> needed to join the results of the two sub-queries. If we do not include
>> it the result would be a Cartesian product of the two sub-queries (see
>> APPENDIX for more details).
>>     
>
> your query should answer... 
> "For instance, one can ask for the research topics for which
> the Italian authors are more than the Swiss ones."
>
> but you project the *author* which is neither aggregated nor grouped... 
> that doesn't make sense to me... shouldn't it be simply
>
> 1. SELECT ?topic ?numberOfSwissAuthors ?numberOfItalianAuthors
> 2. WHERE {
> 4.     {
> 5.             SELECT ?topic (COUNT(?book) AS ?numberOfSwissAuthors)
> 6.             WHERE {
> 7.                     ?auth :wrote ?book .
> 8.                     ?book :topic ?topic .
> 9.                     ?auth :hasNationality ?nat .
> 10.                     FILTER(?nat = 'CH') .
> 11.             }
> 12.             GROUP BY ?topic
> 13.     }
> 14.     {
> 15.             SELECT ?topic (COUNT(?book) AS ?numberOfItalianAuthors)
> 16.             WHERE {
> 17.                     ?auth :wrote ?book .
> 18.                     ?book :topic ?topic .
> 19.                     ?auth :hasNationality ?nat .
> 20.                     FILTER(?nat = 'IT') .
> 21.             }
> 22.             GROUP BY ?topic
> 23.     }
> 24.     FILTER(?numberOfItalianAuthors>?numberOfSwissAuthors)    
> 25. }
>
> (didn't try that out just now, just a quick shot, but looks more sensible to me...)
>   

It looks very meaningful to me as well. I've updated 
http://wiki.larkc.eu/c-sparql/sparql11-feedback accordingly. This, 
actually, solve the issue whether it is possible to express in SPARQL 
1.1 some of the more expressive C-SPARQL queries ;-)

Bests,

Emanuele

Received on Thursday, 18 February 2010 12:08:50 UTC