- From: David Booth <david@dbooth.org>
- Date: Thu, 08 Sep 2011 23:15:20 -0400
- To: Rob Vesse <rav08r@ecs.soton.ac.uk>
- Cc: public-rdf-dawg-comments <public-rdf-dawg-comments@w3.org>
Hi Rob, You are right. Thanks for pointing this out. I must have jumped directly to the BIND subsection without noticing the introductory part. On closer examination, I now see that this is also clarified in sec 18.2.4.4: http://www.w3.org/TR/sparql11-query/#sparqlSelectExpressions "variable must not appear in VS; if it does then generate a syntax error and stop". Sorry for the inconvenience. David On Thu, 2011-09-08 at 10:29 +0100, Rob Vesse wrote: > 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 > -- David Booth, Ph.D. http://dbooth.org/ Opinions expressed herein are those of the author and do not necessarily reflect those of his employer.
Received on Friday, 9 September 2011 03:15:44 UTC