W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > December 2011

Re: Clarification of variable scoping

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Tue, 06 Dec 2011 16:59:18 +0000
Message-ID: <4EDE49E6.2040204@epimorphics.com>
To: public-rdf-dawg-comments@w3.org
David,

The working group has decided to add a pair of tests based on your 
example to the SPARQL 1.1 test suite.

test: 
http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bind/manifest#bind10

query: http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bind/bind10.rq

test: 
http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bind/manifest#bind11

query: http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bind/bind11.rq

The tests use a nested group graph pattern so as to remove a dependency 
on GRAPH.

PREFIX : <http://example.org/>

SELECT ?s ?v ?z
{
   BIND(4 AS ?z)
   {
     # ?z is not in-scope at the time of filter execution.
     ?s :p ?v . FILTER(?v = ?z)
   }
}

Result:

-------------
| s | v | z |
=============
-------------

and

PREFIX : <http://example.org/>

SELECT ?s ?v ?z
{
   BIND(4 AS ?z)
   # ?z is in scope at the time of filter execution.
   ?s :p ?v .
   FILTER(?v = ?z)
}

Result:

---------------
| s   | v | z |
===============
| :s4 | 4 | 4 |
---------------

We would be grateful if you would acknowledge that your comment has been 
answered by sending a reply to this mailing list.

     Andy, on behalf of the SPARQL WG
Received on Tuesday, 6 December 2011 16:59:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 6 December 2011 16:59:50 GMT