On 10/08/12 02:12, Holger Knublauch wrote:
Andy,
we are evaluating the move to 2.7.3 and have been immediately hit by
what looks like a change of SPARQL semantics in ARQ. See the attached
Java test which returns "Test" in 272 but null in 273. The query is
really simple:
SELECT *
WHERE {
{
BIND ("Test" AS ?label) .
} .
BIND (?label AS ?result) .
}
but ?label is no longer visible in the outer BIND. The same happens if
you replace the inner BIND with a BGP that binds ?label, but I wanted to
make the example model independent.
So my obvious question: is this the intended behavior, why the change etc?
2.7.3 is right - 2.7.2. is wrong (plain old bug, fixed due to having to
clarify scoping in the SPARQL spec so I went back and check ARQ).
> {
> BIND ("Test" AS ?label) .
> } .
> BIND (?label AS ?result) .
That's a join of the inner, first BIND and the outer BIND.
The Outer BIND applies to the immediately preceeding BGP. BIND binds
quite tightly (if you'll forgive the pun).
The preceeding BGP is actually empty - it's between the "}" and
"BIND (?label AS ?result) ."
Think of it as :
{
{ BIND ("Test" AS ?label) . }
{} BIND (?label AS ?result) .
}
technically, that's structurally different but it stresses the empty
part before second BIND.
The important factor is the scope of ?label.
The query joins "BIND ("Test" AS ?label)" and
"BIND (?label AS ?result)". So it evals "BIND (?label AS ?result)" not
in the context of the "BIND ("Test" AS ?label)" i.e. the use of ?label
in "BIND (?label AS ?result)" is unbound.
Andy
Thanks,
Holger