Bug fixes to SPARQL algebra translation.

There are two bugs in the translation of SPARQL syntax to SPARQL algebra.  One 
is an out-and-out bug, the other is due to multiple interpretations of the text.

Two longer messages follow this with with full details of each.

http://lists.w3.org/Archives/Public/public-rdf-dawg/2007JulSep/0177.html
http://lists.w3.org/Archives/Public/public-rdf-dawg/2007JulSep/0178.html

 Andy

==== Bug 1

There are two ways to get filters into the filter part of a LeftJoin.

[[
If SA is of the form OPTIONAL(Filter(F, A))
            G := LeftJoin(G, A, F)
]]

but also

[[
If F is not empty:
   If G = empty pattern then G := Filter(F, Z)
   If G = LeftJoin(A1, A2, true) then G := LeftJoin(A1, A2, F)
   If G = Join(A1, A2) then G := Filter(F, Join(A1, A2))
   If G = Union(A1, A2) then G := Filter(F, Union(A1, A2))
   If G = Graph(x, A) then G := Filter(F, Graph(x, A))
          where x is a variable or IRI.
]]

This last part is wrong.  It should just say:

[[
If F is not empty:
   G := Filter(F, G)
]]

which is the bit that makes filters scoped to the group they are in.

There are 7 tests to back up the correct form.  More details in the long message.

==== Bug 2

The text:

[[
A group pattern is mapped into the SPARQL algebra as follows: first, convert 
all elements making up the group into algebra expressions using *this* 
transformation process recursively, then apply the following transformation:
]]
(my emphasis above)
is unclear as to what "this" is referring to.

It affects when the simplification rule is applied.  It does not affect the 
algreba translation of most queries.

The one case that is affected is where there is a double (or more) nesting in 
the OPTIONAL with a filter.  It must be a nesting of at least 2.

An example is:

SELECT *
{ ?x :r ?y OPTIONAL { { ?x :p ?q FILTER (expr) } }

The filter gets into the LeftJoin by one reading, and not by the other. 
Details in the long message.



-- 
Hewlett-Packard Limited
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England

Received on Wednesday, 26 September 2007 17:02:36 UTC