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

Re: Clarification needed on BIND

From: Rob Vesse <rav08r@ecs.soton.ac.uk>
Date: Thu, 08 Sep 2011 10:29:59 +0100
To: David Booth <david@dbooth.org>
Cc: public-rdf-dawg-comments <public-rdf-dawg-comments@w3.org>
Message-ID: <EMEW3|90e77ec9d506a81d5db435115c598079n87Aag06rav08r|ecs.soton.ac.uk|e9f18caf826e571f7a42e1082c004cf6@ecs.soton.ac.uk>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 8 September 2011 09:37:15 GMT