Just to double-check. I assume this behavior (SPARQL is evaluated inside
out) is also valid for OPTIONAL and UNION patterns, correct?
Thanks,
Gokhan
On 10/13/2011 3:56 AM, Paolo Castagna wrote:
Damian Steer wrote:
On 13 Oct 2011, at 08:24, Paolo Castagna wrote:
Hi Gokhan
Gokhan Soydan wrote:
Hello,
Using a BIND in a nested graph pattern (a basic, OPTIONAL or UNION
pattern) with an input argument that was assigned in the parent graph
pattern doesn't work. The following example query returns no value for
?x, whereas it should return the value of ?s assigned to ?x
SELECT ?x
WHERE {
?s ?p ?o
{
BIND( ?s AS ?x )
}
}
It says:
"Use of BIND is a separate element of a group graph pattern and it ends any basic
graph pattern."
So, I tried this instead:
SELECT ?x { ?s ?p ?o BIND ( ?s AS ?x ) }
Bingo! I got my results:
ARQ is correct. The mantra to repeat is: SPARQL is evaluated inside out.
Thanks Damian, it is always good to have confirmation.
SPARQL is evaluated inside out, SPARQL is evaluate inside out, SPARQL is
evaluated inside out...
So:
?s ?p ?o
{
BIND( ?s AS ?x )
}
Start with the inner bit. ?s is unbound, and ?x isn't bound. The inner bit
isn't doing anything at all, ?x is never bound.
SPARQL is evaluated inside out! ;-)
Paolo
Damian