Re: bindings07

On May 22, 2011, at 2:59 PM, Lee Feigenbaum wrote:

> On 5/22/2011 2:52 PM, Gregory Williams wrote:
>> On May 22, 2011, at 6:14 AM, Andy Seaborne wrote:
>> 
>>> Rob Vesse has found a problem with the bindings test suite.  The results for bindings07 are wrong.  There was an optimizer bug in ARQ: and the tests didn't get run with the simple engine [*].
>>> 
>>> 	Andy
>>> 
>>> [*] Run arq.qtest with  "--engine=ref" to run the simple, not optimization, no smarts query execution engine.  Does not scale - very simply executes each algebra operation and materialises all intermediate results.
>> 
>> Good catch! It seems my implementation has a bug too (in the join ordering of the BINDINGS clause with the rest of the query).
> 
> Could one of you please post or commit the proper results and we can re-approve it on Tuesday?

I'd be more comfortable with Andy doing it (being closer to the Query document), but here's my understanding:

The query has a graph pattern with an optional at the 'top level':

SELECT ?s ?o1 ?o2 {
  ?s ?p1 ?o1 
  OPTIONAL { ?s foaf:knows ?o2 }
} BINDINGS ?o2 {
 (:b)
}

The default graph contains:

:a foaf:name "Alan" .
:a foaf:mbox "alan@example.org" .
:b foaf:name "Bob" .
:b foaf:mbox "bob@example.org" .
:c foaf:name "Alice" .
:c foaf:mbox "alice@example.org" .
:a foaf:knows :b .
:b foaf:knows :c .

The results for just the graph pattern are:

?s, ?o1, ?o2
------------
:a, "Alan", :b
:a "alan@example.org", :b
:a :b, :b
:b "Bob", :c
:b "bob@example.org", :c
:b :c, :c
:c "Alice"
:c "alice@example.org"

Briefly:

* Three results have ?o2=:b
* Three have ?o2=:c
* Two have ?o2 unbound.

Now, applying the join for the BINDINGS where ?o2 is bound to :b, the first three results successfully join (:b = :b), the second three don't join (:c != :b), and the last two join because ?o2 isn't bound yet.

I believe the results for this query *should* be:

?s, ?o1, ?o2
------------
:a, :b, :b
:a, "alan@example.org", :b
:a, "Alan", :b
:c, "alice@example.org", :b
:c, "Alice", :b

The current results file checked in to CVS additionally has:

?s, ?o1, ?o2
------------
:b, :c, :b
:b, "bob@example.org", :b

So, to summarize, I think these two results should be removed and the remaining results represent the expected correct results.

Andy, did I get that right?

.greg

Received on Sunday, 22 May 2011 19:16:30 UTC