Re: Fix to the rq25 spec for BIND

I remember some discussion about an unfortunate side effect of the definition, but it could be a false memory!

It might have related to FILTER.

- Steve

On 2012-08-24, at 14:58, Lee Feigenbaum wrote:

> I believe Andy has said that it was changed only because it was unclear what LC2 actually meant (the descriptive text and the formal definition did not clearly lineup).
> 
> Lee
> 
> On 8/24/2012 9:00 AM, Steve Harris wrote:
>> OK, but what was the strange behaviour of the LC1-2 design which caused us to change it in the first place?
>> 
>> Sorry if I missed some discussion, but I imagine it wasn't done on a whim…
>> 
>> - Steve
>> 
>> On 24 Aug 2012, at 11:47, Andy Seaborne wrote:
>> 
>>> This completes ACTION-673.
>>> 
>>> The design has been reverted to that of 1LC and 2LC
>>> 
>>> 1/ Informative text changed.
>>> 2/ Variable Scope section has a paragraph specifically on BIND
>>> 3/ Algebra translation translation reverts to previous text (and special on BIND removed)
>>> 
>>> No execution tests are invalidated.
>>> 
>>> Reverting the scope rules affects syntax tests:
>>>    syntax-BINDscope7.rq
>>>    syntax-BINDscope8.rq
>>> which are now bad syntax.
>>> 
>>> 
>>> A few notes about the BIND fix:
>>> 
>>> This is illegal under both designs:
>>> 
>>> SELECT *
>>> {
>>>   ?s ?p ?o
>>>   BIND("foo" AS ?o)
>>> }
>>> 
>>> This is illegal on the reverted design:
>>> 
>>> SELECT * {
>>>    ?s ?p ?o
>>>    OPTIONAL{?s ?p2 ?o2}
>>>    BIND(5 AS ?o2)
>>> }
>>> 
>>> 
>>> And note adding {} (which are not a subquery with project) does not make any difference:
>>> 
>>> SELECT *
>>> {
>>>   { ?s ?p ?o }
>>>   BIND("foo" AS ?o)	# Bad
>>> }
>>> 
>>> because it is still a previous element of a group so the accumulated scope of that element shows up in the group BIND is in - i.e. it includes all of { ?s ?p ?o }
>>> 
>>> which makes sense because we want BIND to apply a previous element like:
>>> 
>>> SELECT * {
>>>   { ?s ?p ?o } UNION {?s ?p2 ?o2}
>>>   BIND(5 AS ?o)       # Bad
>>>  }
>>> 
>>> 
>>> Legal: masked
>>> 
>>> SELECT *
>>> {
>>>   { SELECT ?s { ?s ?p ?o } }
>>>   BIND("foo" AS ?o)	# GOOD
>>> }
>>> 
>>> Legal: scope rules do not extend outwards of {} in which BIND is used.
>>> 
>>> SELECT *
>>> {
>>>   { ?s ?p ?o }
>>>   UNION
>>>   { BIND("foo" AS ?o) }	# GOOD
>>> }
>>> 
> 
> 

-- 
Steve Harris, CTO
Garlik, a part of Experian
+44 7854 417 874  http://www.garlik.com/
Registered in England and Wales 653331 VAT # 887 1335 93
Registered office: Landmark House, Experian Way, Nottingham, Notts, NG80 1ZZ

Received on Tuesday, 4 September 2012 16:20:27 UTC