Re: Fix to the rq25 spec for BIND

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 
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 653331 VAT # 887 1335 93
Registered office: Landmark House, Experian Way, NG2 Business Park, Nottingham, Nottinghamshire, England NG80 1ZZ

Received on Friday, 24 August 2012 13:01:13 UTC