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

Re: SPARQL Query: subqueries

From: Axel Polleres <axel.polleres@deri.org>
Date: Tue, 11 May 2010 14:59:43 +0100
Cc: Olivier Corby <Olivier.Corby@sophia.inria.fr>, SPARQL Working Group <public-rdf-dawg@w3.org>
Message-Id: <A0EA6DD8-8E30-4792-87BF-44D7BE8A8507@deri.org>
To: Andy Seaborne <andy.seaborne@talis.com>
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 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 14:00:17 GMT

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