jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject svn commit: r1544967 - in /jena/trunk/jena-arq/src: main/java/com/hp/hpl/jena/sparql/algebra/optimize/TransformFilterPlacement.java test/java/com/hp/hpl/jena/sparql/algebra/optimize/TestTransformFilterPlacement.java
Date Sun, 24 Nov 2013 13:18:07 GMT
Author: claude
Date: Sun Nov 24 13:18:06 2013
New Revision: 1544967

URL: http://svn.apache.org/r1544967
Log:
Fixes issue with  JENA-595

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/TransformFilterPlacement.java
    jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/algebra/optimize/TestTransformFilterPlacement.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/TransformFilterPlacement.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/TransformFilterPlacement.java?rev=1544967&r1=1544966&r2=1544967&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/TransformFilterPlacement.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/TransformFilterPlacement.java
Sun Nov 24 13:18:06 2013
@@ -432,7 +432,18 @@ public class TransformFilterPlacement ex
             Op op2 = input.copy(op1) ; //, input.getVarExprList()) ; //OpExtend.extend(op1,
input.getVarExprList()) ;
             return result(op2, unpushed) ;
         }
-        Op op1 = OpFilter.filter(p.unplaced, p.op) ;
+        // handle the case where the filter is being to a surrounding sequence or other bgp
container 
+        // and may apply to the assignation variables.
+        // in this case disjoint var sets indicate the expression is unused.
+        pushed = new ExprList() ;
+        for ( Expr expr : p.unplaced ) {
+            Set<Var> exprVars = expr.getVarsMentioned() ;
+            if ( disjoint(vars1, exprVars) )
+                unpushed.add(expr);
+            else
+                pushed.add(expr) ;
+        }
+        Op op1 = OpFilter.filter(pushed, p.op) ;
         Op op2 = input.copy(op1) ;
         return result(op2, unpushed) ;
     }

Modified: jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/algebra/optimize/TestTransformFilterPlacement.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/algebra/optimize/TestTransformFilterPlacement.java?rev=1544967&r1=1544966&r2=1544967&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/algebra/optimize/TestTransformFilterPlacement.java
(original)
+++ jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/algebra/optimize/TestTransformFilterPlacement.java
Sun Nov 24 13:18:06 2013
@@ -123,6 +123,15 @@ public class TestTransformFilterPlacemen
         test("(sequence (bgp (?s ?p ?x)) (filter (= ?z 123) (bgp (?s ?p ?z))) )",
              null) ;
     }
+    
+    @Test public void place_sequence_with_bind() {
+    	test("(filter (= ?foo 1) " +
+    			"(sequence  " +
+    				"(extend " +
+    				"	((?bound (if ?v_binder 'Y' 'N'))) " +
+    				"	(bgp (triple ?foob <http://example.com/binding> ?v_binder)))" +
+    				"(bgp (triple ?foob <http://www.w3.org/2000/01/rdf-schema#label> ?foo))))",
null );
+    }
 
     // Join : one sided push.
     @Test public void place_join_01() {



Mime
View raw message