[
https://issues.apache.org/jira/browse/JENA-1235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15493067#comment-15493067
]
ASF GitHub Bot commented on JENA-1235:
--------------------------------------
GitHub user afs opened a pull request:
https://github.com/apache/jena/pull/169
JENA-1235: Filter placement and OpDisjunction
This provides filter placement for OpDisjunction (a generalization of
OpUnion generated internally e.g. for expanding `||` in filters).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/afs/jena jena-1235-place-disjunction
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jena/pull/169.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #169
----
commit ec02e99e264694817244fa815933f4cc377bb51c
Author: Andy Seaborne <[email protected]>
Date: 2016-09-15T11:34:14Z
JENA-1235: Filter placement and OpDisjunction
----
> Disjunction expansion then blocks filter placement.
> ---------------------------------------------------
>
> Key: JENA-1235
> URL: https://issues.apache.org/jira/browse/JENA-1235
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ
> Affects Versions: Jena 3.0.0
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
>
> Original report: [email on
> users@|https://lists.apache.org/thread.html/e23d8cdc5160548d5de59c739043c5015e790ea2eca73422246dd7a3@%3Cusers.jena.apache.org%3E]
> {noformat}
> public static void main(String ...args) {
> String qs = StrUtils.strjoinNL
> ("PREFIX : <http://example.org>"
> ,""
> ,"SELECT *"
> ,"{"
> ," FILTER ( ( ?var3 = 'ABC' ) || ( ?var3 = 'XYZ' ) )"
> ," FILTER ( regex(?var4, 'pat1') && ?VAR!=123)"
> ," ?var2 :p1 ?var4 ;"
> ," :p2 ?var3 ."
> ,"}"
> ) ;
> Query query = QueryFactory.create(qs);
> Op op = Algebra.compile(query) ;
> Op op1 = Algebra.optimize(op) ;
> System.out.println(op1);
> }
> {noformat}
> gives this where the regex has not been pushed in:
> {noformat}
> (filter (exprlist (regex ?var4 "pat1") (!= ?VAR 123))
> (disjunction
> (assign ((?var3 "ABC"))
> (bgp
> (triple ?var2 <http://example.orgp1> ?var4)
> (triple ?var2 <http://example.orgp2> "ABC")
> ))
> (assign ((?var3 "XYZ"))
> (bgp
> (triple ?var2 <http://example.orgp1> ?var4)
> (triple ?var2 <http://example.orgp2> "XYZ")
> ))))
> {noformat}
> as in: (note the {{(!= ?VAR 123)}} remains outside as it is not used. This is
> more about being tidy).
> {noformat}
> (filter (!= ?VAR 123)
> (disjunction
> (assign ((?var3 "ABC"))
> (sequence
> (filter (regex ?var4 "pat1")
> (bgp (triple ?var2 <http://example.orgp1> ?var4)))
> (bgp (triple ?var2 <http://example.orgp2> "ABC"))))
> (assign ((?var3 "XYZ"))
> (sequence
> (filter (regex ?var4 "pat1")
> (bgp (triple ?var2 <http://example.orgp1> ?var4)))
> (bgp (triple ?var2 <http://example.orgp2> "XYZ"))))))
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)