Re: Blank node and nested queries

+1 to being able to compose queries like that. It matches how I build complex queries.

- Steve

On 2010-04-19, at 09:19, Andy Seaborne wrote:

> In SPARQL 1.0 the following query is illegal because the label "a" is used twice in different BGPs.
> 
> PREFIX : <http://example/>
> 
> SELECT *
> {
> _:a :p ?x .
> OPTIONAL { _:a :w ?y }
> }
> 
> We have a choice in SPARQL 1.1 Query as to whether this scoping rule applies to the query or the SELECT statement.
> 
> In SPARQL 1.1, we now have nested SELECTs.  It is convenient to be able to paste one SELECT, having got it working, into another query.  Having to check labels stops a simple cut&paste of we decide the scope is the query.
> 
> PREFIX : <http://example/>
> 
> SELECT *
> {
>  _:a :p ?x .
>  { SELECT * { _:a :p ?y } }
> }
> 
> I suggest that we clarify blank node scoping rule to apply to one SELECT statement, not the whole query, making the SPARQL 1.1 query above legal.
> 
> Analogous things happen with unprojected variables:
> 
> PREFIX : <http://example/>
> 
> SELECT *
> {
>  :a :p ?x .
>  { SELECT (COUNT(*) AS ?C) { :a :q ?x } }
> }
> 
> The two ?x are unrelated - they never meet at an operation that causes a join over them.
> 
> CONSTRUCTs already allow labels to be used twice.
> 
> CONSTRUCT { _:a :p ?x } WHERE { _:a :q ?x }
> 
> 	Andy
> 

-- 
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 Monday, 19 April 2010 21:43:54 UTC