jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject jena git commit: JENA-1190: Handle paths in TransfrmFilterEquality
Date Tue, 07 Jun 2016 10:45:11 GMT
Repository: jena
Updated Branches:
  refs/heads/master 1ca43f086 -> accab21cd


JENA-1190: Handle paths in TransfrmFilterEquality


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/accab21c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/accab21c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/accab21c

Branch: refs/heads/master
Commit: accab21cd19824d2d47f9d4bba635a73796632b8
Parents: 1ca43f0
Author: Andy Seaborne <andy@apache.org>
Authored: Tue Jun 7 11:45:03 2016 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Tue Jun 7 11:45:03 2016 +0100

----------------------------------------------------------------------
 .../optimize/TransformFilterEquality.java       |  3 +++
 .../algebra/optimize/TestTransformFilters.java  | 24 ++++++++++++++++++++
 2 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/accab21c/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformFilterEquality.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformFilterEquality.java
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformFilterEquality.java
index 45a9167..86c0336 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformFilterEquality.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformFilterEquality.java
@@ -238,6 +238,9 @@ public class TransformFilterEquality extends TransformCopy {
         if (op instanceof OpBGP || op instanceof OpQuadPattern)
             return true;
 
+        if (op instanceof OpPath )
+            return true;
+        
         if (op instanceof OpFilter) {
             OpFilter opf = (OpFilter) op;
             // Expressions are always safe transform by substitution.

http://git-wip-us.apache.org/repos/asf/jena/blob/accab21c/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformFilters.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformFilters.java
b/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformFilters.java
index 545c63e..00ec664 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformFilters.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/algebra/optimize/TestTransformFilters.java
@@ -194,6 +194,30 @@ public class TestTransformFilters extends AbstractTestTransform
                t_equality,
                (String[])null);
     }
+    
+    @Test public void equality_path_1() {
+        testOp("(filter (= ?x <http://constant1/>) (path ?x (path+ :p) ?y))",
+               t_equality,
+               "(assign ((?x <http://constant1/>)) (path <http://constant1/>
(path+ :p) ?y) )") ;
+    }
+
+    @Test public void equality_path_2() {
+        testOp("(filter (= ?y <http://constant1/>) (path ?x (path+ :p) ?y))",
+               t_equality,
+               "(assign ((?y <http://constant1/>)) (path ?x (path+ :p) <http://constant1/>)
)") ;
+    }
+
+    @Test public void equality_path_3() {
+        testOp("(filter ((= ?x <http://constant1/>) (= ?y <http://constant2/>))
(path ?x (path+ :p) ?y))",
+               t_equality,
+               "(assign ((?x <http://constant1/>) (?y <http://constant2/>)) (path
<http://constant1/> (path+ :p) <http://constant2/>) )") ;
+    }
+
+    @Test public void equality_path_4() {
+        testOp("(filter (= ?x <http://constant1/>) (join (bgp (?x :q ?z)) (path ?x
(path+ :p) ?y) ))",
+               t_equality,
+               "(assign ((?x <http://constant1/>)) (join (bgp (<http://constant1/>
:q ?z)) (path <http://constant1/> (path+ :p) ?y) ))") ;
+    }
 
     @Test public void optionalEqualitySubQuery_01() {
         // Presence of ?test in the projection blocks the rewrite.


Mime
View raw message