[
https://issues.apache.org/jira/browse/JENA-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andy Seaborne updated JENA-692:
-------------------------------
Description:
(Starts at 2.11.0; 2.10.* is OK)
The filter implicit join optimization misoptimizes the example - it pushes in
the equality but each arm is missing one of the variables.
{noformat}
PREFIX : <http://example.org/>
SELECT *
{
{ ?a :p :o1 }
UNION
{ ?b :p ?a }
FILTER ( ?a = ?b )
}
The first arm of the UNION does include ?b and so {{( ?a = ?b )}} is false by
being an error with unbound {{?b}}
Algebra translation:
{noformat}
(prefix ((: <http://example.org/>))
(filter (= ?a ?b)
(union
(bgp (triple ?a :p :o1))
(bgp (triple ?b :p ?a)))))
{noformat}
the optimization creates:
{noformat}
(prefix ((: <http://example.org/>))
(assign ((?a ?b))
(union
(bgp (triple ?b :p :o1))
(bgp (triple ?b :p ?b)))))
{noformat}
which has replaces the {{?a}} with {{?b}} in the first arm.
{noformat}
sparql --set arq:optImplicitJoin=false --file Q.rq --data D.ttl
{noformat}
yields the correct answers.
was:
(Starts at 2.11.0; 2.10.* is OK)
The filter implicit join optimization misoptimizes the example - it pushes in
the equality but each arm is missing one of the variables.
{noformat}
PREFIX : <http://example.org/>
SELECT *
{
{ ?a :p :o1 }
UNION
{ ?b :p ?a }
FILTER ( ?a = ?b )
}
{noformat}
The first arm of the UNION does include ?b and so {{( ?a = ?b )}} is false by
being an error with unbound {{?b}}
the optimization creates:
{noformat}
(prefix ((: <http://example.org/>))
(assign ((?a ?b))
(union
(bgp (triple ?b :p :o1))
(bgp (triple ?b :p ?b)))))
{noformat}
which has replaces the {{?a}} with {{?b}} in the first arm.
{noformat}
sparql --set arq:optImplicitJoin=false --file Q.rq --data D.ttl
{noformat}
yields the correct answers.
> Filter implicit join optimization incorrect
> -------------------------------------------
>
> Key: JENA-692
> URL: https://issues.apache.org/jira/browse/JENA-692
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ
> Affects Versions: Jena 2.11.0, Jena 2.11.1
> Reporter: Andy Seaborne
> Attachments: D.ttl, Q.rq
>
>
> (Starts at 2.11.0; 2.10.* is OK)
> The filter implicit join optimization misoptimizes the example - it pushes in
> the equality but each arm is missing one of the variables.
> {noformat}
> PREFIX : <http://example.org/>
> SELECT *
> {
> { ?a :p :o1 }
> UNION
> { ?b :p ?a }
> FILTER ( ?a = ?b )
> }
> The first arm of the UNION does include ?b and so {{( ?a = ?b )}} is false by
> being an error with unbound {{?b}}
> Algebra translation:
> {noformat}
> (prefix ((: <http://example.org/>))
> (filter (= ?a ?b)
> (union
> (bgp (triple ?a :p :o1))
> (bgp (triple ?b :p ?a)))))
> {noformat}
> the optimization creates:
> {noformat}
> (prefix ((: <http://example.org/>))
> (assign ((?a ?b))
> (union
> (bgp (triple ?b :p :o1))
> (bgp (triple ?b :p ?b)))))
> {noformat}
> which has replaces the {{?a}} with {{?b}} in the first arm.
> {noformat}
> sparql --set arq:optImplicitJoin=false --file Q.rq --data D.ttl
> {noformat}
> yields the correct answers.
--
This message was sent by Atlassian JIRA
(v6.2#6252)