[ 
https://issues.apache.org/jira/browse/JENA-595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13826970#comment-13826970
 ] 

Andy Seaborne commented on JENA-595:
------------------------------------

The JENA-383 query:

{noformat}
PREFIX ex: <http://example/>
SELECT * WHERE {
    ?var ex:p1 ?x.
    OPTIONAL { ?x ex:p2 ?y. }
    FILTER (?var != ex:i)
}
{noformat}

Up to Jena 2.11.0:
{noformat}
(prefix ((ex: <http://example/>))
  (filter (= ?var ex:i)
    (conditional
      (bgp (triple ?var ex:p1 ?x))
      (conditional
        (bgp (triple ?x ex:p2 ?y))
        (bgp (triple ?y ex:p3 ?z))))))
{noformat}
and with patch:
{noformat}
(prefix ((ex: <http://example/>))
  (conditional
    (filter (= ?var ex:i)
      (bgp (triple ?var ex:p1 ?x)))
    (conditional
      (bgp (triple ?x ex:p2 ?y))
      (bgp (triple ?y ex:p3 ?z)))))
{noformat}
The filter is done on the LHS of the outer OPTIONAL.

> Improve filter placement optimization
> -------------------------------------
>
>                 Key: JENA-595
>                 URL: https://issues.apache.org/jira/browse/JENA-595
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>         Attachments: JENA-595-FilterPlacement.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to