Re: Clarification needed on BIND

Hi David

I'm not a member of the Working Group but the behaviour of BIND in this
case is mentioned in the specification although in the introductory section
on assignment rather than directly with the definition of BIND so perhaps
needs highlighting better?

The first sentence of the section on assignment [1] makes reference to the
variable scoping rules [2] and goes on to say that "The new variable must
not already be in-scope in the query at that point it is used" i.e. you can
only use a BIND on a variable that is not in-scope at the point where the
BIND occurs

So your example would throw an error since ?title is already in-scope when
the 2nd BIND is reached but you could have queries where you bound on the
same variable more than once e.g. a BIND in each part of a UNION

Hope that helps

Rob

[1]: http://www.w3.org/TR/sparql11-query/#assignment
[2]: http://www.w3.org/TR/sparql11-query/#variableScope

On Wed, 07 Sep 2011 11:40:45 -0400, David Booth <david@dbooth.org> wrote:
> Regarding sec 10.1 "BIND: Assigning to Variables":
> http://www.w3.org/TR/sparql11-query/#bind
> 
> What happens if the same variable is bound more than once using BIND?
> For example:
> 
> PREFIX  dc:  <http://purl.org/dc/elements/1.1/>
> PREFIX  ns:  <http://example.org/ns#>
> SELECT  ?title ?price
> {  
>    BIND (?title as "The World")
>    BIND (?title as "The Universe")
>    ?x dc:title ?title ; ns:price ?p .
> }
> 
> Should this be handled as:
> 
>  - an error?
> 
>  - both bindings are used (to produce multiple solutions)?
> 
>  - The first or last BIND statement for ?title takes precedence?
> 
> It would be helpful to clarify this in the spec.
> 
> Thanks

-- 
PhD Student
WAIS Group
Bay 20, Room 4027, Building 32
Electronics & Computer Science
University of Southampton

Received on Thursday, 8 September 2011 09:37:14 UTC