BIND - a question of detail

A question: for this query:

PREFIX : <http://example.org/>

SELECT ?s ?p ?o ?z
{
   ?s ?p ?o .
   FILTER(?z = 3 )
   BIND(?o+1 AS ?z)
}

We decided on fixed location BIND, which ends the basic graph pattern 
(that makes working with entailment work out).

Do we want BIND to end a BGP, or the BIND to be part of the BGP at the end?

The difference is whether the FILTER floats to include the assignment by 
BIND.

One approach is to define BIND as being "just after" the BGP, so the 
argument would be that the FILTER does not float past the BIND and in 
the first query ?z is unbound in the FILTER.  The execution is in the 
order written syntactically in the first query.

The other approach is that BIND is, in some sense, part of the BGP as 
"post processing", and FILTER floats over it to be effective the second 
query in execution order.

SELECT ?s ?p ?o ?z
{
   ?s ?p ?o .
   BIND(?o+1 AS ?z)
   FILTER(?z = 3 )
}

I have no strong feeling either way.  To me, the first approach is 
simpler and sufficient.

If BIND is "post-processing" on a BGP, then it would follow that two 
BINDS are both in the same BGP and FILTER can float across mnultiple 
adjacent BINDs.

Another example:

SELECT ?s ?p ?o ?z
{
   ?s ?p ?o .
   BIND(?o+1 AS ?z1)
   FILTER(?z2 = 3 )  ## use z2
   BIND(?o+2 AS ?z2)
}

The first way, FILTER is unbound.
The second, the FILTER test the second BINDs outcome.

 Andy

Received on Thursday, 21 October 2010 20:50:10 UTC