Re: another aggregates test case...

On 2010-06-08, at 14:42, Lee Feigenbaum wrote:

> On 6/8/2010 9:14 AM, Steve Harris wrote:
>> On 2010-06-08, at 14:07, Axel Polleres wrote:
>> 
>>> Student of mine pointed me to a somewhat corner test case:
>>> 
>>> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>>> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
>>> PREFIX dcterms:<http://purl.org/dc/terms/>
>>> PREFIX foaf:<http://xmlns.com/foaf/0.1/>
>>> PREFIX mpp:<http://imp.deri.ie/ontology/moviePostProcessing#>
>>> 
>>> SELECT *
>>> FROM NAMED<http://imp.deri.ie/vff/ppa/projects>
>>> FROM NAMED<http://imp.deri.ie/vff/ppa/people>
>>> WHERE {
>>> 
>>> ?project rdf:type foaf:Project ;
>>>          rdfs:label ?title .
>>> ?person rdf:type mpp:Person ;
>>>          rdfs:label ?personName ;
>>>          foaf:currentProject ?project .
>>> }
>>> GROUP BY ?project
>>> 
>>> Actually, I *think* this should be syntactically invalid, as per:
>>> "In aggregate queries and sub-queries only expressions which have been used as GROUP BY expressions, or aggregated expressions (i.e. expressions where all variables appear inside an aggregate) can be projected."
>>> 
>>> interestingly, the formulation - strictly speaking - doesn't say what an aggregate query is, but GROUP BY without aggregtate doesn't make a lot of sense anyways, except that it should have the same effect as DISTINCT, right(?), but we still don't want to allow in the presence of GROUP BY some non-grouped/aggregated things to be projected, I assume.
>> 
>> It wouldn't have the same affect as DISTINCT as per the current draft. Cardinality is preserved.
> 
> I think that Axel means that:
> 
> SELECT ?v1 ?v2 ?v3
> WHERE
> { ... }
> GROUP BY ?v1 ?v2 ?v3
> 
> is equivalent to:
> 
> SELECT DISTINCT ?v1 ?v2 ?v3
> WHERE
> { ... }
> 
> ...and I think he's right in that observation?

It's somewhat moot, because you can't project ?v1 ?v2 ?v3 in this case, but if you imagine SAMPLE() round the vars then I think it would be the same as DISTINCT, yes.

- Steve

-- 
Steve Harris, 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, 8 June 2010 15:58:58 UTC