jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1597334 - in /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena: query/ARQ.java sparql/algebra/optimize/Optimize.java
Date Sat, 24 May 2014 18:37:56 GMT
Author: andy
Date: Sat May 24 18:37:55 2014
New Revision: 1597334

URL: http://svn.apache.org/r1597334
Log:
Move expansion of simply property paths to be very early in the transformation order.
Add context synbol to control the path expansion step.

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/Optimize.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java?rev=1597334&r1=1597333&r2=1597334&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java Sat May 24 18:37:55 2014
@@ -274,11 +274,18 @@ public class ARQ
     public static final Symbol optimization = ARQConstants.allocSymbol("optimization") ;
     
     /** 
+     *  Context key controlling whether the main query engine flattens simple paths
+     *  (e.g. <tt>?x :p/:q ?z => ?x :p ?.0 . ?.0 ?q ?z</tt>)   
+     *  <p>Default is "true"
+     */  
+    public static final Symbol optPathFlatten = ARQConstants.allocSymbol("optPathFlatten")
;
+    
+    /** 
      *  Context key controlling whether the main query engine moves filters to the "best"
place.
      *  Default is "true" - filter placement is done.
      */  
     public static final Symbol optFilterPlacement = ARQConstants.allocSymbol("optFilterPlacement")
;
-    
+
     /** 
      *  Context key controlling whether to do filter placement within BGP and quad blocks.
      *  Modies the effect of optFilterPlacement. 

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/Optimize.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/Optimize.java?rev=1597334&r1=1597333&r2=1597334&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/Optimize.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/optimize/Optimize.java
Sat May 24 18:37:55 2014
@@ -163,6 +163,10 @@ public class Optimize implements Rewrite
         // Prepare expressions.
         OpWalker.walk(op, new OpVisitorExprPrepare(context)) ;
         
+        // Convert paths to triple patterns if possible.
+        if ( context.isTrueOrUndef(ARQ.optPathFlatten) )
+            op = apply("Path flattening", new TransformPathFlattern(), op) ;
+
         // Expression constant folding
         if ( context.isTrueOrUndef(ARQ.optExprConstantFolding) )
             op = Transformer.transform(new TransformCopy(), new ExprTransformConstantFold(),
op);
@@ -206,10 +210,6 @@ public class Optimize implements Rewrite
         if ( context.isTrueOrUndef(ARQ.optDistinctToReduced) )
             op = apply("Distinct replaced with reduced", new TransformDistinctToReduced(),
op) ;
         
-        // Convert paths to triple patterns. 
-        // Also done in the AlgebraGenerator so this transform step catches programmatically
built op expressions 
-        op = apply("Path flattening", new TransformPathFlattern(), op) ;
-
         // Find joins/leftJoin that can be done by index joins (generally preferred as fixed
memory overhead).
         if ( context.isTrueOrUndef(ARQ.optIndexJoinStrategy) )
             op = apply("Index Join strategy", new TransformJoinStrategy(), op) ;



Mime
View raw message