You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/01/22 22:09:07 UTC
svn commit: r1437172 -
/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena383_BadPlanOptionals.java
Author: andy
Date: Tue Jan 22 21:09:06 2013
New Revision: 1437172
URL: http://svn.apache.org/viewvc?rev=1437172&view=rev
Log: (empty)
Added:
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena383_BadPlanOptionals.java
Added: jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena383_BadPlanOptionals.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena383_BadPlanOptionals.java?rev=1437172&view=auto
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena383_BadPlanOptionals.java (added)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena383_BadPlanOptionals.java Tue Jan 22 21:09:06 2013
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dev;
+
+import org.apache.jena.atlas.lib.StrUtils ;
+
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.sparql.algebra.Algebra ;
+import com.hp.hpl.jena.sparql.algebra.Op ;
+
+public class Jena383_BadPlanOptionals
+{
+
+ public static void main(String[] args)
+ {
+ /*
+ * 1 - TransformFilterEquality is before "conditional"
+ * How about after conditional and only on conditionals?
+ * 2 - Fails the safeToTransform test because
+ * vars left of the inner optional does not include the equality var
+ * Safe if not mentioned on right either!
+ * Not used at all test is suspect (again) when recursed into an inner expression.
+ * At least only in outer invokation.
+ */
+
+// // Not covered by left ... but used at all in the right?
+// Op opRight = opleftjoin.getRight() ;
+// Set<Var> varsRight = OpVars.patternVars(opRight) ;
+// //return false ;
+//
+// // ----
+// for ( Var varEq : varsEquality)
+// if ( varsRight.contains(varEq) )
+// return false ;
+// return true ;
+// }
+
+ String qs = StrUtils.strjoinNL(
+ "PREFIX ex: <http://example.org/test#>",
+ "SELECT * WHERE {",
+ " ?var ex:p1 ?x. ",
+ " OPTIONAL {",
+ " ?x ex:p2 ?y.",
+ " OPTIONAL {",
+ " ?y ex:p3 ?z",
+ " }",
+ " }",
+ " FILTER (?var = ex:i)",
+ "}") ;
+
+
+ Query query = QueryFactory.create(qs) ;
+ System.out.println(query) ;
+ Op op0 = Algebra.compile(query) ;
+ System.out.println(op0) ;
+ Op op1 = Algebra.optimize(op0) ;
+ System.out.println(op1) ;
+ }
+
+}
+