BIND, FILTERs and BGPs

>        { P1 KW(Expr AS ?Var)  P2}
>      =:=
>        { { SELECT * Expr AS ?Var { P1} } P2 }

Does BIND end a BGP?
What happens to FILTERs?


{ FILTER(expr) ?x ns:p ?v . ?x ns:q ?w }

is the algebra:

(filter expr
   (bgp (triple ?x ns:p ?v)
        (triple ?x ns:q ?w)
))

or written after FILTER motion:

{ ?x ns:p ?v . ?x ns:q ?w FILTER(expr) }


But if we insert BIND(2*?v AS ?two) into that:

{ FILTER(expr) ?x ns:p ?v . BIND(2*?v AS ?two) . ?x ns:q ?w }

There is a similar issue with bNode syntax label scopes.

I propose that:

1/ BIND terminates the current BGP
2/ FILTER goes after BIND in the BGP

so its:

(join
   (filter expr
     (extend (2*?v AS ?two)
       (bgp (triple ?x ns:p ?v))
   ))
   (bgp (triple ?x ns:q ?w))
)

or

{ { ?x ns:p ?v . BIND(2*?v AS ?two) . FILTER(expr)}  ?x ns:q ?w }

Logically it's
    BGP - BIND - FILTER

Doing this keep entailment a matter of BGPs only.  Without motion of 
BIND, it would need more work to come up with a design (if it exists) 
that keeps entailment on a conjuction of triple patterns and have the 
variable scoping + new variable rule.

Lee's example:

{ ?x ns:p ?v . BIND(2*?v AS ?two) ?x ns:q ?two }

will work and naturally falls out if BIND happens where it's mentioned.

(join
   (extend (2*?v AS ?two)
     (bgp (triple ?x ns:p ?v)))
   (bgp (triple ?x ns:q ?two))
)

	Andy

Received on Tuesday, 12 October 2010 19:36:59 UTC