Re: SPARQL Query: subqueries

On 11/05/2010 2:59 PM, Axel Polleres wrote:
> I am actually unsure about the proposal from
>     http://lists.w3.org/Archives/Public/public-rdf-dawg/2010AprJun/0063.html
>
>
> a)
>    SELECT *
>    {
>    _:a :p ?x .
>    OPTIONAL { _:a :w ?y }
>    }
>
>
> b)
>   SELECT *
>   {
>    _:a :p ?x .
>    { SELECT * { _:a :w ?y } }
>   }
>
> Does the proposal mean that a) wouldn't be allowed but b) would or do you want to lift the
> bnode across group patterns restriction from SPARQL 1.0 alltogether and also allow a) which was forbidden in SPARQL1.0?

I wasn't suggesting changing the prohibition of the non-reuse of bNode 
labels across BGPs in the same level of the query (we need a name for 
the block that is one graph pattern without subquery).

	Andy

> I agree we should be consistent, but before we just drop it, I'd like to ask what were the reasons for
> the restriction in SPARQL 1.0 in first place? I always suspected that the restriction was there in
> order to avoid confusions, e.g. the fact that
>
> c) SELECT *
>    {
>    {_:a :p ?x .}
>    { _:a :w ?y }
>    }
> is different from
>
> d) SELECT *
>    {
>     _:a :p ?x .
>     _:a :w ?y
>    }
> isn't really intuitive, is it? For avoiding confusion, the restriction makes sense to me.
>
> Thanks for clarification,
> Axel
>
>
> On 10 May 2010, at 16:45, Andy Seaborne wrote:
>
>>
>>
>> On 10/05/2010 12:53 PM, Olivier Corby wrote:
>>> I also wonder why "It is an error to reuse variable names both inside
>>> and outside a subquery when the variable is not projected from the
>>> subquery."
>>> Such variables may be local variables with no incidence with the outside
>>> of the query. In particular, if we build a complex query with copy-paste
>>> of existing queries, there may be duplicate variable names.
>>
>> In
>> http://lists.w3.org/Archives/Public/public-rdf-dawg/2010AprJun/0063.html
>> we decided to allow reuse of bNode labels to make copy-paste query building work.  Here, it also complicates the fact that "SELECT ?x" would fail where "SELECT ?x ?y" is legal for use of inner ?y so a change in one part of the query causes an error at a different point.
>>
>> We should be consistent in style - I'd prefer removing that text and allowing variable names to be used inside and outside a subquery.
>>
>> 	Andy
>>
>

Received on Tuesday, 11 May 2010 17:12:45 UTC