jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gokhan Soydan <gsoy...@topquadrant.com>
Subject Re: BIND bug in nested graph pattern
Date Thu, 13 Oct 2011 20:42:49 GMT
Thanks a lot Paolo and Damian. That is actually change of behavior, 
because similar queries with BIND were working in a bit earlier versions 
of ARQ.

I will keep in mind that SPARQL is evaluated inside out :-) Although, 
that will change my thinking in how I write some of my queries :-/

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


Mime
View raw message