From: <tho...@us...> - 2011-01-16 19:30:59
|
Revision: 4112 http://bigdata.svn.sourceforge.net/bigdata/?rev=4112&view=rev Author: thompsonbry Date: 2011-01-16 19:30:52 +0000 (Sun, 16 Jan 2011) Log Message: ----------- Moved the CONSTRAINTS annotation from the PipelineJoin operator to the IPredicate in order to support join graphs. Now that the CONSTRAINTS decorate the IPredicate, they will automatically be evaluated when that predicate is joined and we do not have to worry about raising the CONSTRAINTS onto the join operator (the join operator is still responsible for evaluating the constraints, but it picks them off of the IPredicate now). Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/JoinGraph.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestJoinGraph.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestSubqueryOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/MockRunningQuery.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/join/TestPipelineJoin.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnBSBMData.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/Rule2BOpUtility.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -42,7 +42,6 @@ import com.bigdata.btree.filter.Advancer; import com.bigdata.btree.filter.TupleFilter; import com.bigdata.mdi.PartitionLocator; -import com.bigdata.rawstore.Bytes; import com.bigdata.relation.IRelation; import com.bigdata.relation.accesspath.AccessPath; import com.bigdata.relation.accesspath.ElementFilter; @@ -102,7 +101,10 @@ * <code>true</code> iff the predicate is optional (the right operand of * a left join). * - * @deprecated This flag is being moved to the join operator. + * @deprecated This flag is being moved to the join operator (or should + * it stay with the predicate so we can work with join + * graphs more easily, but note that join graphs never + * contain optional joins). */ String OPTIONAL = "optional"; @@ -321,6 +323,12 @@ */ String TIMESTAMP = BOp.class.getName() + ".timestamp"; + /** + * An optional {@link IConstraint}[] which places restrictions on the + * legal patterns in the variable bindings. + */ + String CONSTRAINTS = PipelineJoin.class.getName() + ".constraints"; + } /** @@ -434,6 +442,22 @@ // public IElementFilter<E> getConstraint(); /** + * Return the optional {@link IConstraint}[] to be applied by a join which + * evaluates this {@link IPredicate}. + * <p> + * Note: The {@link Annotations#CONSTRAINTS} are annotated on the + * {@link IPredicate} rather than the join operators so they may be used + * with join graphs, which are expressed solely as an unordered set of + * {@link IPredicate}s. Using join graphs, we are able to do nifty things + * such as runtime query optimization which would not be possible if the + * annotations were decorating the joins since we would be unable to + * dynamically generate the join operators with the necessary annotations. + * + * @see Annotations#CONSTRAINTS + */ + public IConstraint[] constraints(); + + /** * Return the optional filter to be evaluated local to the index. * * @see Annotations#INDEX_LOCAL_FILTER Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -35,6 +35,7 @@ import com.bigdata.bop.Constant; import com.bigdata.bop.IBindingSet; import com.bigdata.bop.IConstant; +import com.bigdata.bop.IConstraint; import com.bigdata.bop.IElement; import com.bigdata.bop.IPredicate; import com.bigdata.bop.IVariable; @@ -244,6 +245,12 @@ // // } + public IConstraint[] constraints() { + + return getProperty(IPredicate.Annotations.CONSTRAINTS, null/* defaultValue */); + + } + final public IFilter getIndexLocalFilter() { return (IFilter) getProperty(Annotations.INDEX_LOCAL_FILTER); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/JoinGraph.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/JoinGraph.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/JoinGraph.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -73,7 +73,6 @@ import com.bigdata.relation.accesspath.IAccessPath; import com.bigdata.relation.accesspath.IAsynchronousIterator; import com.bigdata.relation.accesspath.ThickAsynchronousIterator; -import com.bigdata.relation.rule.Rule; import com.bigdata.striterator.Dechunkerator; import com.bigdata.striterator.IChunkedIterator; @@ -945,6 +944,13 @@ throw new IllegalStateException(); if (v2.sample == null) // vertex not sampled. throw new IllegalStateException(); + /* + * FIXME CONSTRAINT ORDERING : If a variable only appears in a + * CONSTRAINT for one of the two vertices then that vertex must be + * evaluated second. (If the vertices both have this problem then + * the edge can not be evaluated until some other vertex causes the + * variables of either one [v1] or [v2] to become bound.) + */ if (v1.sample.rangeCount < v2.sample.rangeCount) { v = v1; vp = v2; @@ -1061,11 +1067,7 @@ new NV(PipelineJoin.Annotations.SHARED_STATE,true), new NV(PipelineJoin.Annotations.EVALUATION_CONTEXT,BOpEvaluationContext.CONTROLLER) ); - if (vTarget.pred.getProperty(PipelineJoin.Annotations.CONSTRAINTS) != null) { - // Copy constraints from the predicate onto the join, which will apply them. - anns.put(PipelineJoin.Annotations.CONSTRAINTS, vTarget.pred - .getProperty(PipelineJoin.Annotations.CONSTRAINTS)); - } + final PipelineJoin joinOp = new PipelineJoin(new BOp[] {}, anns); final PipelineOp queryOp = joinOp; @@ -1335,7 +1337,7 @@ /* * Scan the vertices of the caller's path. If any of those vertices * are NOT found in this path the paths are not unordered variations - * of one aother. + * of one another. */ for (int i = 0; i < v2.length; i++) { @@ -1381,10 +1383,15 @@ for (Edge e : edges) { if (tmp.isEmpty()) { - /* - * The first edge is handled specially in order to report - * the minimum cardinality vertex first. - */ + /* + * The first edge is handled specially in order to report + * the minimum cardinality vertex first. + * + * FIXME CONSTRAINT ORDERING : A vertex can not run until + * all variables appearing in its CONSTRAINTS would be + * bound. This can cause us to use and report an ordering + * which does not place the minimum cardinality vertex 1st. + */ tmp.add(e.getMinimumCardinalityVertex()); tmp.add(e.getMaximumCardinalityVertex()); @@ -1530,26 +1537,30 @@ // The new vertex, which is not part of this path. final Vertex targetVertex = v1Found ? e.v2 : e.v1; - /* - * Chain sample the edge. - * - * Note: ROX uses the intermediate result I(p) for the existing path - * as the input when sampling the edge. The corresponding concept - * for us is the sample for this Path, which will have all variable - * bindings produced so far. In order to estimate the cardinality of - * the new join path we have to do a one step cutoff evaluation of - * the new Edge, given the sample available on the current Path. - * - * FIXME It is possible for the path sample to be empty. Unless the - * sample also happens to be exact, this is an indication that the - * estimated cardinality has underflowed. We track the estimated - * cumulative cardinality, so this does not make the join path an - * immediate winner, but it does mean that we can not probe further - * on that join path as we lack any intermediate solutions to feed - * into the downstream joins. [If we re-sampled the edges in the - * join path in each round then this would help to establish a - * better estimate in successive rounds.] - */ + /* + * Chain sample the edge. + * + * Note: ROX uses the intermediate result I(p) for the existing path + * as the input when sampling the edge. The corresponding concept + * for us is the sample for this Path, which will have all variable + * bindings produced so far. In order to estimate the cardinality of + * the new join path we have to do a one step cutoff evaluation of + * the new Edge, given the sample available on the current Path. + * + * FIXME It is possible for the path sample to be empty. Unless the + * sample also happens to be exact, this is an indication that the + * estimated cardinality has underflowed. We track the estimated + * cumulative cardinality, so this does not make the join path an + * immediate winner, but it does mean that we can not probe further + * on that join path as we lack any intermediate solutions to feed + * into the downstream joins. [If we re-sampled the edges in the + * join path in each round then this would help to establish a + * better estimate in successive rounds.] + * + * FIXME CONSTRAINT ORDERING : It is illegal to add a vertex to the + * path if any variable appearing in its CONSTRAINTS would not be + * bound. + */ final EdgeSample edgeSample = e.estimateCardinality(queryEngine, limit, sourceVertex, targetVertex, @@ -1741,6 +1752,14 @@ */ private final Edge[] E; + /** + * An unordered collection of vertices which do not share any variables + * with the other vertices in the join graph. These vertices are run + * last. Once the {@link #E edges} have been exhausted, these vertices + * are simply appended to the join path in an arbitrary order. + */ + private final Vertex[] unshared; + public List<Vertex> getVertices() { return Collections.unmodifiableList(Arrays.asList(V)); } @@ -1756,6 +1775,10 @@ for (Vertex v : V) { sb.append("\nV[" + v.pred.getId() + "]=" + v); } + sb.append("\n],unshared=["); + for (Vertex v : unshared) { + sb.append("\n" + v); + } sb.append("],E=["); for (Edge e : E) { sb.append("\n" + e); @@ -1780,18 +1803,39 @@ } - /* - * Identify the edges by looking for shared variables among the - * predicates. - * - * Note: If a vertex does not share ANY variables then it is paired - * with every other vertex. Such joins will always produce a full - * cross product and they can be taken paired with any of the other - * vertices. - */ + /* + * Identify the edges by looking for shared variables among the + * predicates. + * + * Note: Variables may appear in the arguments of the predicate, + * e.g., spo(?s,rdf:type,?o). + * + * Note: Variables may ALSO appear in the CONSTRAINTS (imposed on + * the binding sets) or FILTERS (imposed either on the local or + * remote access path). For example, that a variable bound by + * another predicate must take on a value having some mathematical + * relationship to a variable bound by the predicate, e.g., BSBM Q5. + * When a variable appears in a constraint but does not appear as an + * argument to the predicate, then there is an additional + * requirement that the variable MUST become bound before the + * predicate may be evaluated (again, BSBM Q5 has this form). + * + * Note: If a vertex does not share ANY variables (neither in the + * arguments of the predicate nor in its constraints or filters) + * then it can be paired with any of the other vertices. However, in + * such cases we always run such vertices last as they can not + * restrict the cardinality of the rest of the join graph. Such + * vertices are therefore inserted into a separate set and appended + * to the join path once all edges having shared variables have been + * exhausted. + */ { - final List<Edge> tmp = new LinkedList<Edge>(); + // The set of identified edges for vertices which share vars. + final List<Edge> tmp = new LinkedList<Edge>(); + + // The set of vertices which do not share variables. + final List<Vertex> unshared = new LinkedList<Vertex>(); for (int i = 0; i < v.length; i++) { @@ -1806,12 +1850,21 @@ // consider a possible target vertex. final IPredicate<?> p2 = v[j]; - final Set<IVariable<?>> shared = Rule.getSharedVars(p1, - p2); + final Set<IVariable<?>> shared = getSharedVars(p1, p2); if (shared != null && !shared.isEmpty()) { - // the source and target vertices share var(s). + /* + * The source and target vertices share var(s). + * + * Note: A predicate having a variable which appears + * in a CONSTRAINT MUST NOT be added to the join + * path until that variable would be bound. + * Therefore, when selecting the vertices to be used + * to extend a join path, we must consider whether + * or not the join path would bind the variable(s) + * appearing in the CONSTRAINT. + */ tmp.add(new Edge(V[i], V[j], shared)); nmatched++; @@ -1823,26 +1876,37 @@ if (nmatched == 0) { /* - * The source vertex does not share any variables. In - * order to explore join paths which include that vertex - * we therefore pair it with each of the other vertices. + * The source vertex does not share any variables. */ - for (int j = 0; j < v.length; j++) { + + unshared.add(V[i]); - if (j == i) - continue; - - tmp.add(new Edge(V[i], V[j], - Collections.EMPTY_SET)); - - } - } } E = tmp.toArray(new Edge[0]); + + this.unshared = unshared.toArray(new Vertex[0]); + if(!unshared.isEmpty()) { + + /* + * FIXME This needs to be supported. We should explore and + * generate the join paths based on only those vertices + * which do share variables (and hence for which we have + * defined edges). Once the vertices which share variables + * have been exhausted, we should simply append edges for + * the vertices which do not share variables in an arbitrary + * order (they will be run last since they can not constrain + * the evaluation). + */ + + throw new UnsupportedOperationException( + "Some predicates do not share any variables with other predicates."); + + } + } } @@ -1889,13 +1953,21 @@ // Setup the join graph. Path[] paths = round0(queryEngine, limit, nedges); - /* - * The initial paths all have one edge, and hence two vertices. Each - * round adds one more vertex to each path. We are done once we have - * generated paths which include all vertices. - * - * This occurs at round := nvertices - 1 - */ + /* + * The initial paths all have one edge, and hence two vertices. Each + * round adds one more vertex to each path. We are done once we have + * generated paths which include all vertices. + * + * This occurs at round := nvertices - 1 + * + * FIXME UNSHARED VERTICES : Add [unshared] vertices after all + * vertices with shared variables have been incorporated into the + * join paths. This should happen outside of the loop since the + * joins with unshared variables can not constraint the solutions. + * Therefore choose the best join path based on the vertices with + * the shared variables and then simply append the [unshared] + * vertices. + */ final int nvertices = V.length; @@ -2000,25 +2072,29 @@ } - /** - * Choose up to <i>nedges</i> edges to be the starting point. - * - * @param queryEngine - * The query engine. - * @param limit - * The cutoff used when sampling the vertices and when - * sampling the edges. - * @param nedges - * The maximum #of edges to choose. Those having the smallest - * expected cardinality will be chosen. - * - * @return An initial set of paths starting from any most <i>nedges</i>. - * For each of the <i>nedges</i> lowest cardinality edges, the - * starting vertex will be the vertex with the lowest - * cardinality for that edge. - * - * @throws Exception - */ + /** + * Choose up to <i>nedges</i> edges to be the starting point. For each + * of the <i>nedges</i> lowest cardinality edges, the starting vertex + * will be the vertex with the lowest cardinality for that edge. + * <p> + * Note: An edge can not serve as a starting point for exploration if it + * uses variables (for example, in a CONSTRAINT) which are not bound by + * either vertex (since the variable(s) are not bound, the constraint + * would always fail). + * + * @param queryEngine + * The query engine. + * @param limit + * The cutoff used when sampling the vertices and when + * sampling the edges. + * @param nedges + * The maximum #of edges to choose. Those having the smallest + * expected cardinality will be chosen. + * + * @return An initial set of paths starting from at most <i>nedges</i>. + * + * @throws Exception + */ public Path[] round0(final QueryEngine queryEngine, final int limit, final int nedges) throws Exception { @@ -2889,13 +2965,6 @@ // // anns.add(new NV(PipelineJoin.Annotations.SELECT, vars.toArray(new IVariable[vars.size()]))); - if (p.getProperty(PipelineJoin.Annotations.CONSTRAINTS) != null) { - // Copy constraints from the predicate onto the join, which will - // apply them. - anns.add(new NV(PipelineJoin.Annotations.CONSTRAINTS, p - .getProperty(PipelineJoin.Annotations.CONSTRAINTS))); - } - final PipelineJoin joinOp = new PipelineJoin( lastOp == null ? new BOp[0] : new BOp[] { lastOp }, anns.toArray(new NV[anns.size()])); @@ -3025,7 +3094,105 @@ } - /** + /** + * Return the variables in common for two {@link IPredicate}s. All variables + * spanned by either {@link IPredicate} are considered. + * <p> + * Note: Variables may appear in the predicates operands, in the + * {@link Annotations#CONSTRAINTS} associated with the + * predicate, and in the {@link IPredicate.Annotations#ACCESS_PATH_FILTER} + * or {@link IPredicate.Annotations#INDEX_LOCAL_FILTER}. + * <p> + * Note: A variable must become bound before it may be evaluated in + * {@link Annotations#CONSTRAINTS}, an + * {@link IPredicate.Annotations#ACCESS_PATH_FILTER} or an + * {@link IPredicate.Annotations#INDEX_LOCAL_FILTER}. This means that the + * {@link IPredicate}s which can bind the variable must be ordered before + * those which merely test the variable. + * + * + * @param p1 + * A predicate. + * + * @param p2 + * A different predicate. + * + * @return The variables in common -or- <code>null</code> iff there are no + * variables in common. + * + * @throws IllegalArgumentException + * if the two predicates are the same reference. + * + * @todo It should be an error if a variable appear in a test is not bound + * by any possible join path. However, note that it may not be + * possible to determine this by local examination of a join graph + * since we do not know which variables may be presented as already + * bound when the join graph is evaluated (but we can only run the + * join graph currently against static source binding sets and for + * that case this is knowable). + * + * @todo When a variable is only optionally bound and it is discovered at + * runtime that the variable is not bound when it is considered by a + * CONSTRAINT, FILTER, etc., then the SPARQL semantics are that + * evaluation should produce a 'type' error which would cause the + * solution should fail (at least within its current join group). See + * https://sourceforge.net/apps/trac/bigdata/ticket/179. + * + * @todo Unit tests, including those which verify that variables appearing + * in the constraints are reported as shared with those appearing in + * the predicates operands. + */ + static Set<IVariable<?>> getSharedVars(final IPredicate p1, final IPredicate p2) { + + // The set of variables which are shared by those predicates. + final Set<IVariable<?>> sharedVars = new LinkedHashSet<IVariable<?>>(); + + /* + * Collect the variables appearing anyway in [p1], including the + * predicate's operands and its constraints, filters, etc. + */ + final Set<IVariable<?>> p1vars = new LinkedHashSet<IVariable<?>>(); + { + + final Iterator<IVariable<?>> itr = BOpUtility + .getSpannedVariables(p1); + + while (itr.hasNext()) { + + p1vars.add(itr.next()); + + } + + } + + /* + * Consider the variables appearing anyway in [p2], including the + * predicate's operands and its constraints, filters, etc. + */ + { + + final Iterator<IVariable<?>> itr = BOpUtility + .getSpannedVariables(p2); + + while (itr.hasNext()) { + + final IVariable<?> avar = itr.next(); + + if(p1vars.contains(avar)) { + + sharedVars.add(avar); + + } + + } + + } + + return sharedVars; + + } + + /** * Exception thrown when the join graph does not have any solutions in the * data (running the query does not produce any results). */ Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -27,7 +27,6 @@ package com.bigdata.bop.join; -import java.nio.channels.ClosedByInterruptException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -78,7 +77,6 @@ import com.bigdata.service.DataService; import com.bigdata.striterator.IChunkedOrderedIterator; import com.bigdata.striterator.IKeyOrder; -import com.bigdata.util.InnerCause; import com.bigdata.util.concurrent.Haltable; import com.bigdata.util.concurrent.LatchedExecutor; @@ -132,12 +130,6 @@ String SELECT = PipelineJoin.class.getName() + ".select"; /** - * An optional {@link IConstraint}[] which places restrictions on the - * legal patterns in the variable bindings. - */ - String CONSTRAINTS = PipelineJoin.class.getName() + ".constraints"; - - /** * Marks the join as "optional" in the SPARQL sense. Binding sets which * fail the join will be routed to the alternative sink as specified by * either {@link PipelineOp.Annotations#ALT_SINK_REF} or @@ -444,15 +436,6 @@ } /** - * @see Annotations#CONSTRAINTS - */ - public IConstraint[] constraints() { - - return getProperty(Annotations.CONSTRAINTS, null/* defaultValue */); - - } - - /** * @see Annotations#OPTIONAL */ public boolean isOptional() { @@ -659,7 +642,7 @@ this.joinOp = joinOp; this.predicate = joinOp.getPredicate(); - this.constraints = joinOp.constraints(); + this.constraints = predicate.constraints(); this.maxParallel = joinOp.getMaxParallel(); if (maxParallel < 0) throw new IllegalArgumentException(Annotations.MAX_PARALLEL Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestJoinGraph.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestJoinGraph.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestJoinGraph.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -90,6 +90,14 @@ public void test_Path_addEdge() { fail("write test"); } + + /** + * Test ability to identify shared variables appearing either as predicate + * operands or as part of CONSTRAINTS or FILTERS. + */ + public void test_getSharedVariables() { + fail("write test"); + } // @Override // public Properties getProperties() { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestSubqueryOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestSubqueryOp.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestSubqueryOp.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -596,7 +596,7 @@ // new NV(PipelineOp.Annotations.CONDITIONAL_GROUP, joinGroup1),// new NV(PipelineJoin.Annotations.PREDICATE, pred3Op),// // constraint d != Leon - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] { new NEConstant(d, new Constant<String>("Leon")) }) // // join is optional. // new NV(PipelineJoin.Annotations.OPTIONAL, true),// Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/MockRunningQuery.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/MockRunningQuery.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/MockRunningQuery.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -80,12 +80,10 @@ return indexManager; } - @Override public void halt(Void v) { log.warn("Mock object does not implement halt(Void)"); } - @Override public <T extends Throwable> T halt(T cause) { log.warn("Mock object does not implement halt(Throwable)"); return cause; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/TestQueryEngine.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -1128,7 +1128,7 @@ new NV(Predicate.Annotations.BOP_ID, joinId),// new NV(PipelineJoin.Annotations.PREDICATE, predOp),// // impose constraint on the join. - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] { new EQConstant(y, new Constant<String>("Paul")) })// ); @@ -1592,7 +1592,7 @@ new NV(Predicate.Annotations.BOP_ID, joinId2),// new NV(PipelineJoin.Annotations.PREDICATE, pred2Op),// // constraint x == z - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] { new EQ(x, z) }), // join is optional. new NV(PipelineJoin.Annotations.OPTIONAL, true),// Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/fed/TestFederatedQueryEngine.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -717,7 +717,7 @@ new NV(Predicate.Annotations.EVALUATION_CONTEXT, BOpEvaluationContext.SHARDED),// // impose constraint on the join. - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] { new EQConstant(y, new Constant<String>("Paul")) })); @@ -1233,7 +1233,7 @@ new NV(Predicate.Annotations.EVALUATION_CONTEXT, BOpEvaluationContext.SHARDED),// // constraint x == z - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] { new EQ(x, z) }), // join is optional. new NV(PipelineJoin.Annotations.OPTIONAL, true),// Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/join/TestPipelineJoin.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/join/TestPipelineJoin.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/join/TestPipelineJoin.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -379,7 +379,7 @@ new BOp[] { startOp },// new NV(BOpBase.Annotations.BOP_ID, joinId),// new NV(PipelineJoin.Annotations.PREDICATE, predOp),// - new NV( PipelineJoin.Annotations.CONSTRAINTS, + new NV( Annotations.CONSTRAINTS, new IConstraint[] { new INBinarySearch<String>(y, set) })); // the expected solution (just one). Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnBSBMData.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnBSBMData.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnBSBMData.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -32,7 +32,6 @@ import com.bigdata.bop.engine.QueryEngine; import com.bigdata.bop.engine.QueryLog; import com.bigdata.bop.fed.QueryEngineFactory; -import com.bigdata.bop.join.PipelineJoin; import com.bigdata.journal.Journal; import com.bigdata.rdf.internal.XSDIntIV; import com.bigdata.rdf.internal.constraints.CompareBOp; @@ -341,7 +340,7 @@ * the IPredicate and apply them to the constructed join * operator. */ - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] {// new NEConstant(product, new Constant(product53999 .getIV())) // @@ -391,7 +390,7 @@ new NV(BOp.Annotations.BOP_ID, nextId++),// new NV(Annotations.TIMESTAMP, timestamp),// new NV(IPredicate.Annotations.RELATION_NAME, spoRelation), - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] {// new CompareBOp(new BOp[] { simProperty1, @@ -435,7 +434,7 @@ new NV(BOp.Annotations.BOP_ID, nextId++),// new NV(Annotations.TIMESTAMP, timestamp),// new NV(IPredicate.Annotations.RELATION_NAME, spoRelation), - new NV(PipelineJoin.Annotations.CONSTRAINTS, + new NV(Annotations.CONSTRAINTS, new IConstraint[] {// new CompareBOp(new BOp[] { simProperty2, Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/Rule2BOpUtility.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/Rule2BOpUtility.java 2011-01-16 19:26:10 UTC (rev 4111) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/Rule2BOpUtility.java 2011-01-16 19:30:52 UTC (rev 4112) @@ -631,11 +631,6 @@ anns.add(new NV(PipelineJoin.Annotations.OPTIONAL, pred .isOptional())); - if (!constraints.isEmpty()) - anns.add(new NV(PipelineJoin.Annotations.CONSTRAINTS, - constraints - .toArray(new IConstraint[constraints.size()]))); - /* * Pull off annotations before we clear them from the predicate. */ @@ -653,6 +648,13 @@ pred = pred.clearAnnotations(new String[] { Annotations.SCOPE, Annotations.QUADS, Annotations.DATASET }); + if (!constraints.isEmpty()) { + // decorate the predicate with any constraints. + pred = (Predicate<?>) pred.setProperty( + IPredicate.Annotations.CONSTRAINTS, constraints + .toArray(new IConstraint[constraints.size()])); + } + if (quads) { /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |