From: <mrp...@us...> - 2011-01-12 18:18:00
|
Revision: 4075 http://bigdata.svn.sourceforge.net/bigdata/?rev=4075&view=rev Author: mrpersonick Date: 2011-01-12 18:17:51 +0000 (Wed, 12 Jan 2011) Log Message: ----------- working on nested optional groups Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/TestDeepCopy.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestOptionalJoinGroup.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/CompareBOp.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/IsInline.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/IsLiteral.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/internal/constraints/TestInlineConstraints.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataEvaluationStrategyImpl.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataEvaluationStrategyImpl3.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java 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/sop/SOp.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/sop/SOp2BOpUtility.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/sop/SOpTree.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/sop/SOpTreeBuilder.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataEvaluationStrategy.java Removed Paths: ------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/OptionalJoinGroup.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/AbstractInlineConstraint.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineEQ.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGE.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGT.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLE.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLT.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineNE.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -139,8 +139,8 @@ this.sink2 = context.getSink2(); - if (sink2 == null) - throw new IllegalArgumentException(); +// if (sink2 == null) +// throw new IllegalArgumentException(); if (sink == sink2) throw new IllegalArgumentException(); @@ -186,7 +186,7 @@ // stats.unitsOut.add(ndef); } - if (nalt > 0) { + if (nalt > 0 && sink2 != null) { if (nalt == alt.length) sink2.add(alt); else @@ -198,14 +198,16 @@ } sink.flush(); - sink2.flush(); + if (sink2 != null) + sink2.flush(); return null; } finally { sink.close(); - sink2.close(); + if (sink2 != null) + sink2.close(); } Deleted: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/OptionalJoinGroup.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/OptionalJoinGroup.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/OptionalJoinGroup.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,437 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -/* - * Created on Aug 18, 2010 - */ - -package com.bigdata.bop.controller; - -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.Executor; -import java.util.concurrent.FutureTask; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.BOpContext; -import com.bigdata.bop.BOpUtility; -import com.bigdata.bop.IBindingSet; -import com.bigdata.bop.NV; -import com.bigdata.bop.PipelineOp; -import com.bigdata.bop.engine.IRunningQuery; -import com.bigdata.bop.engine.LocalChunkMessage; -import com.bigdata.bop.engine.QueryEngine; -import com.bigdata.relation.accesspath.IAsynchronousIterator; -import com.bigdata.relation.accesspath.ThickAsynchronousIterator; -import com.bigdata.util.concurrent.LatchedExecutor; - -/** - * For each binding set presented, this operator executes a subquery. Any - * solutions produced by the subquery are copied to the default sink. If no - * solutions are produced, then the original binding set is copied to the - * default sink (optional join semantics). Each subquery is run as a separate - * query but will be cancelled if the parent query is cancelled. - * - * FIXME Parallel evaluation of subqueries is not implemented. What is the - * appropriate parallelism for this operator? More parallelism should reduce - * latency but could increase the memory burden. Review this decision once we - * have the RWStore operating as a binding set buffer on the Java process heap. - * - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ - */ -public class OptionalJoinGroup extends PipelineOp { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public interface Annotations extends PipelineOp.Annotations { - - /** - * The subquery to be evaluated for each binding sets presented to the - * {@link OptionalJoinGroup} (required). This should be a - * {@link PipelineOp}. - */ - String SUBQUERY = OptionalJoinGroup.class.getName() + ".subquery"; - - /** - * When <code>true</code> the subquery has optional semantics (if the - * subquery fails, the original binding set will be passed along to the - * downstream sink anyway). - */ - String OPTIONAL = OptionalJoinGroup.class.getName() + ".optional"; - - boolean DEFAULT_OPTIONAL = true; - - /** - * The maximum parallelism with which the subqueries will be evaluated - * (default {@value #DEFAULT_MAX_PARALLEL}). - */ - String MAX_PARALLEL = OptionalJoinGroup.class.getName() - + ".maxParallel"; - - int DEFAULT_MAX_PARALLEL = 1; - - } - - /** - * @see Annotations#MAX_PARALLEL - */ - public int getMaxParallel() { - return getProperty(Annotations.MAX_PARALLEL, - Annotations.DEFAULT_MAX_PARALLEL); - } - - /** - * Deep copy constructor. - */ - public OptionalJoinGroup(final OptionalJoinGroup op) { - super(op); - } - - /** - * Shallow copy constructor. - * - * @param args - * @param annotations - */ - public OptionalJoinGroup(final BOp[] args, - final Map<String, Object> annotations) { - - super(args, annotations); - -// if (!getEvaluationContext().equals(BOpEvaluationContext.CONTROLLER)) -// throw new IllegalArgumentException(Annotations.EVALUATION_CONTEXT -// + "=" + getEvaluationContext()); - - getRequiredProperty(Annotations.SUBQUERY); - -// if (!getProperty(Annotations.CONTROLLER, Annotations.DEFAULT_CONTROLLER)) -// throw new IllegalArgumentException(Annotations.CONTROLLER); - -// // The id of this operator (if any). -// final Integer thisId = (Integer)getProperty(Annotations.BOP_ID); -// -// for(BOp op : args) { -// -// final Integer sinkId = (Integer) op -// .getRequiredProperty(Annotations.SINK_REF); -// -// if(sinkId.equals(thisId)) -// throw new RuntimeException("Operand may not target ") -// -// } - - } - - public OptionalJoinGroup(final BOp[] args, NV... annotations) { - - this(args, NV.asMap(annotations)); - - } - - public FutureTask<Void> eval(final BOpContext<IBindingSet> context) { - - return new FutureTask<Void>(new ControllerTask(this, context)); - - } - - /** - * Evaluates the arguments of the operator as subqueries. The arguments are - * evaluated in order. An {@link Executor} with limited parallelism to - * evaluate the arguments. If the controller operator is interrupted, then - * the subqueries are cancelled. If a subquery fails, then all subqueries - * are cancelled. - */ - private static class ControllerTask implements Callable<Void> { - - private final OptionalJoinGroup controllerOp; - private final BOpContext<IBindingSet> context; -// private final List<FutureTask<IRunningQuery>> tasks = new LinkedList<FutureTask<IRunningQuery>>(); -// private final CountDownLatch latch; - private final boolean optional; - private final int nparallel; - private final PipelineOp subquery; - private final Executor executor; - - public ControllerTask(final OptionalJoinGroup controllerOp, final BOpContext<IBindingSet> context) { - - if (controllerOp == null) - throw new IllegalArgumentException(); - - if (context == null) - throw new IllegalArgumentException(); - - this.controllerOp = controllerOp; - - this.context = context; - - this.optional = controllerOp.getProperty(Annotations.OPTIONAL, - Annotations.DEFAULT_OPTIONAL); - - this.nparallel = controllerOp.getProperty(Annotations.MAX_PARALLEL, - Annotations.DEFAULT_MAX_PARALLEL); - - this.subquery = (PipelineOp) controllerOp - .getRequiredProperty(Annotations.SUBQUERY); - - this.executor = new LatchedExecutor(context.getIndexManager() - .getExecutorService(), nparallel); - -// this.latch = new CountDownLatch(controllerOp.arity()); - -// /* -// * Create FutureTasks for each subquery. The futures are submitted -// * to the Executor yet. That happens in call(). By deferring the -// * evaluation until call() we gain the ability to cancel all -// * subqueries if any subquery fails. -// */ -// for (BOp op : controllerOp.args()) { -// -// /* -// * Task runs subquery and cancels all subqueries in [tasks] if -// * it fails. -// */ -// tasks.add(new FutureTask<IRunningQuery>(new SubqueryTask(op, -// context)) { -// /* -// * Hook future to count down the latch when the task is -// * done. -// */ -// public void run() { -// try { -// super.run(); -// } finally { -// latch.countDown(); -// } -// } -// }); -// -// } - - } - - /** - * Evaluate the subquery. - * - * @todo Support limited parallelism for each binding set read from the - * source. We will need to keep track of the running subqueries in - * order to wait on them before returning from this method and in - * order to cancel them if something goes wrong. - */ - public Void call() throws Exception { - - try { - - final IAsynchronousIterator<IBindingSet[]> sitr = context - .getSource(); - - while(sitr.hasNext()) { - - final IBindingSet[] chunk = sitr.next(); - - for(IBindingSet bset : chunk) { - - FutureTask<IRunningQuery> ft = new FutureTask<IRunningQuery>( - new SubqueryTask(bset, subquery, context)); - - // run the subquery. - executor.execute(ft); - - try { - - // wait for the outcome. - ft.get(); - - } finally { - - /* - * Ensure that the inner task is cancelled if the - * outer task is interrupted. - */ - ft.cancel(true/* mayInterruptIfRunning */); - - } - - } - - } - -// /* -// * Run subqueries with limited parallelism. -// */ -// for (FutureTask<IRunningQuery> ft : tasks) { -// executor.execute(ft); -// } -// -// /* -// * Wait for all subqueries to complete. -// */ -// latch.await(); -// -// /* -// * Get the futures, throwing out any errors. -// */ -// for (FutureTask<IRunningQuery> ft : tasks) -// ft.get(); - - // Now that we know the subqueries ran Ok, flush the sink. - context.getSink().flush(); - - // Done. - return null; - - } finally { - -// // Cancel any tasks which are still running. -// for (FutureTask<IRunningQuery> ft : tasks) -// ft.cancel(true/* mayInterruptIfRunning */); - - context.getSource().close(); - - context.getSink().close(); - - if (context.getSink2() != null) - context.getSink2().close(); - - } - - } - - /** - * Run a subquery. - * - * @author <a href="mailto:tho...@us...">Bryan - * Thompson</a> - */ - private class SubqueryTask implements Callable<IRunningQuery> { - - /** - * The evaluation context for the parent query. - */ - private final BOpContext<IBindingSet> parentContext; - - /** - * The source binding set. This will be copied to the output if - * there are no solutions for the subquery (optional join - * semantics). - */ - private final IBindingSet bset; - - /** - * The root operator for the subquery. - */ - private final BOp subQueryOp; - - public SubqueryTask(final IBindingSet bset, final BOp subQuery, - final BOpContext<IBindingSet> parentContext) { - - this.bset = bset; - - this.subQueryOp = subQuery; - - this.parentContext = parentContext; - - } - - public IRunningQuery call() throws Exception { - - IAsynchronousIterator<IBindingSet[]> subquerySolutionItr = null; - try { - - final QueryEngine queryEngine = parentContext.getRunningQuery() - .getQueryEngine(); - -// final IRunningQuery runningQuery = queryEngine -// .eval(subQueryOp); - - final BOp startOp = BOpUtility.getPipelineStart(subQueryOp); - - final int startId = startOp.getId(); - - final UUID queryId = UUID.randomUUID(); - - // execute the subquery, passing in the source binding set. - final IRunningQuery runningQuery = queryEngine - .eval( - queryId, - (PipelineOp) subQueryOp, - new LocalChunkMessage<IBindingSet>( - queryEngine, - queryId, - startId, - -1 /* partitionId */, - new ThickAsynchronousIterator<IBindingSet[]>( - new IBindingSet[][] { new IBindingSet[] { bset } }))); - - // Iterator visiting the subquery solutions. - subquerySolutionItr = runningQuery.iterator(); - - // Copy solutions from the subquery to the query. - final long ncopied = BOpUtility.copy(subquerySolutionItr, - parentContext.getSink(), null/* sink2 */, - null/* constraints */, null/* stats */); - - // wait for the subquery. - runningQuery.get(); - - if (ncopied == 0L && optional) { - - /* - * Since there were no solutions for the subquery, copy - * the original binding set to the default sink. - */ - parentContext.getSink().add(new IBindingSet[]{bset}); - - } - - // done. - return runningQuery; - - } catch (Throwable t) { - - /* - * If a subquery fails, then propagate the error to the - * parent and rethrow the first cause error out of the - * subquery. - */ - throw new RuntimeException(ControllerTask.this.context - .getRunningQuery().halt(t)); - - } finally { - - if (subquerySolutionItr != null) - subquerySolutionItr.close(); - - } - - } - - } // SubqueryTask - - } // ControllerTask - -} Copied: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java (from rev 4072, branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/OptionalJoinGroup.java) =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -0,0 +1,437 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +/* + * Created on Aug 18, 2010 + */ + +package com.bigdata.bop.controller; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.Executor; +import java.util.concurrent.FutureTask; + +import com.bigdata.bop.BOp; +import com.bigdata.bop.BOpContext; +import com.bigdata.bop.BOpUtility; +import com.bigdata.bop.IBindingSet; +import com.bigdata.bop.NV; +import com.bigdata.bop.PipelineOp; +import com.bigdata.bop.engine.IRunningQuery; +import com.bigdata.bop.engine.LocalChunkMessage; +import com.bigdata.bop.engine.QueryEngine; +import com.bigdata.relation.accesspath.IAsynchronousIterator; +import com.bigdata.relation.accesspath.ThickAsynchronousIterator; +import com.bigdata.util.concurrent.LatchedExecutor; + +/** + * For each binding set presented, this operator executes a subquery. Any + * solutions produced by the subquery are copied to the default sink. If no + * solutions are produced, then the original binding set is copied to the + * default sink (optional join semantics). Each subquery is run as a separate + * query but will be cancelled if the parent query is cancelled. + * + * FIXME Parallel evaluation of subqueries is not implemented. What is the + * appropriate parallelism for this operator? More parallelism should reduce + * latency but could increase the memory burden. Review this decision once we + * have the RWStore operating as a binding set buffer on the Java process heap. + * + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ + */ +public class SubqueryOp extends PipelineOp { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public interface Annotations extends PipelineOp.Annotations { + + /** + * The subquery to be evaluated for each binding sets presented to the + * {@link SubqueryOp} (required). This should be a + * {@link PipelineOp}. + */ + String SUBQUERY = SubqueryOp.class.getName() + ".subquery"; + + /** + * When <code>true</code> the subquery has optional semantics (if the + * subquery fails, the original binding set will be passed along to the + * downstream sink anyway). + */ + String OPTIONAL = SubqueryOp.class.getName() + ".optional"; + + boolean DEFAULT_OPTIONAL = false; + + /** + * The maximum parallelism with which the subqueries will be evaluated + * (default {@value #DEFAULT_MAX_PARALLEL}). + */ + String MAX_PARALLEL = SubqueryOp.class.getName() + + ".maxParallel"; + + int DEFAULT_MAX_PARALLEL = 1; + + } + + /** + * @see Annotations#MAX_PARALLEL + */ + public int getMaxParallel() { + return getProperty(Annotations.MAX_PARALLEL, + Annotations.DEFAULT_MAX_PARALLEL); + } + + /** + * Deep copy constructor. + */ + public SubqueryOp(final SubqueryOp op) { + super(op); + } + + /** + * Shallow copy constructor. + * + * @param args + * @param annotations + */ + public SubqueryOp(final BOp[] args, + final Map<String, Object> annotations) { + + super(args, annotations); + +// if (!getEvaluationContext().equals(BOpEvaluationContext.CONTROLLER)) +// throw new IllegalArgumentException(Annotations.EVALUATION_CONTEXT +// + "=" + getEvaluationContext()); + + getRequiredProperty(Annotations.SUBQUERY); + +// if (!getProperty(Annotations.CONTROLLER, Annotations.DEFAULT_CONTROLLER)) +// throw new IllegalArgumentException(Annotations.CONTROLLER); + +// // The id of this operator (if any). +// final Integer thisId = (Integer)getProperty(Annotations.BOP_ID); +// +// for(BOp op : args) { +// +// final Integer sinkId = (Integer) op +// .getRequiredProperty(Annotations.SINK_REF); +// +// if(sinkId.equals(thisId)) +// throw new RuntimeException("Operand may not target ") +// +// } + + } + + public SubqueryOp(final BOp[] args, NV... annotations) { + + this(args, NV.asMap(annotations)); + + } + + public FutureTask<Void> eval(final BOpContext<IBindingSet> context) { + + return new FutureTask<Void>(new ControllerTask(this, context)); + + } + + /** + * Evaluates the arguments of the operator as subqueries. The arguments are + * evaluated in order. An {@link Executor} with limited parallelism to + * evaluate the arguments. If the controller operator is interrupted, then + * the subqueries are cancelled. If a subquery fails, then all subqueries + * are cancelled. + */ + private static class ControllerTask implements Callable<Void> { + + private final SubqueryOp controllerOp; + private final BOpContext<IBindingSet> context; +// private final List<FutureTask<IRunningQuery>> tasks = new LinkedList<FutureTask<IRunningQuery>>(); +// private final CountDownLatch latch; + private final boolean optional; + private final int nparallel; + private final PipelineOp subquery; + private final Executor executor; + + public ControllerTask(final SubqueryOp controllerOp, final BOpContext<IBindingSet> context) { + + if (controllerOp == null) + throw new IllegalArgumentException(); + + if (context == null) + throw new IllegalArgumentException(); + + this.controllerOp = controllerOp; + + this.context = context; + + this.optional = controllerOp.getProperty(Annotations.OPTIONAL, + Annotations.DEFAULT_OPTIONAL); + + this.nparallel = controllerOp.getProperty(Annotations.MAX_PARALLEL, + Annotations.DEFAULT_MAX_PARALLEL); + + this.subquery = (PipelineOp) controllerOp + .getRequiredProperty(Annotations.SUBQUERY); + + this.executor = new LatchedExecutor(context.getIndexManager() + .getExecutorService(), nparallel); + +// this.latch = new CountDownLatch(controllerOp.arity()); + +// /* +// * Create FutureTasks for each subquery. The futures are submitted +// * to the Executor yet. That happens in call(). By deferring the +// * evaluation until call() we gain the ability to cancel all +// * subqueries if any subquery fails. +// */ +// for (BOp op : controllerOp.args()) { +// +// /* +// * Task runs subquery and cancels all subqueries in [tasks] if +// * it fails. +// */ +// tasks.add(new FutureTask<IRunningQuery>(new SubqueryTask(op, +// context)) { +// /* +// * Hook future to count down the latch when the task is +// * done. +// */ +// public void run() { +// try { +// super.run(); +// } finally { +// latch.countDown(); +// } +// } +// }); +// +// } + + } + + /** + * Evaluate the subquery. + * + * @todo Support limited parallelism for each binding set read from the + * source. We will need to keep track of the running subqueries in + * order to wait on them before returning from this method and in + * order to cancel them if something goes wrong. + */ + public Void call() throws Exception { + + try { + + final IAsynchronousIterator<IBindingSet[]> sitr = context + .getSource(); + + while(sitr.hasNext()) { + + final IBindingSet[] chunk = sitr.next(); + + for(IBindingSet bset : chunk) { + + FutureTask<IRunningQuery> ft = new FutureTask<IRunningQuery>( + new SubqueryTask(bset, subquery, context)); + + // run the subquery. + executor.execute(ft); + + try { + + // wait for the outcome. + ft.get(); + + } finally { + + /* + * Ensure that the inner task is cancelled if the + * outer task is interrupted. + */ + ft.cancel(true/* mayInterruptIfRunning */); + + } + + } + + } + +// /* +// * Run subqueries with limited parallelism. +// */ +// for (FutureTask<IRunningQuery> ft : tasks) { +// executor.execute(ft); +// } +// +// /* +// * Wait for all subqueries to complete. +// */ +// latch.await(); +// +// /* +// * Get the futures, throwing out any errors. +// */ +// for (FutureTask<IRunningQuery> ft : tasks) +// ft.get(); + + // Now that we know the subqueries ran Ok, flush the sink. + context.getSink().flush(); + + // Done. + return null; + + } finally { + +// // Cancel any tasks which are still running. +// for (FutureTask<IRunningQuery> ft : tasks) +// ft.cancel(true/* mayInterruptIfRunning */); + + context.getSource().close(); + + context.getSink().close(); + + if (context.getSink2() != null) + context.getSink2().close(); + + } + + } + + /** + * Run a subquery. + * + * @author <a href="mailto:tho...@us...">Bryan + * Thompson</a> + */ + private class SubqueryTask implements Callable<IRunningQuery> { + + /** + * The evaluation context for the parent query. + */ + private final BOpContext<IBindingSet> parentContext; + + /** + * The source binding set. This will be copied to the output if + * there are no solutions for the subquery (optional join + * semantics). + */ + private final IBindingSet bset; + + /** + * The root operator for the subquery. + */ + private final BOp subQueryOp; + + public SubqueryTask(final IBindingSet bset, final BOp subQuery, + final BOpContext<IBindingSet> parentContext) { + + this.bset = bset; + + this.subQueryOp = subQuery; + + this.parentContext = parentContext; + + } + + public IRunningQuery call() throws Exception { + + IAsynchronousIterator<IBindingSet[]> subquerySolutionItr = null; + try { + + final QueryEngine queryEngine = parentContext.getRunningQuery() + .getQueryEngine(); + +// final IRunningQuery runningQuery = queryEngine +// .eval(subQueryOp); + + final BOp startOp = BOpUtility.getPipelineStart(subQueryOp); + + final int startId = startOp.getId(); + + final UUID queryId = UUID.randomUUID(); + + // execute the subquery, passing in the source binding set. + final IRunningQuery runningQuery = queryEngine + .eval( + queryId, + (PipelineOp) subQueryOp, + new LocalChunkMessage<IBindingSet>( + queryEngine, + queryId, + startId, + -1 /* partitionId */, + new ThickAsynchronousIterator<IBindingSet[]>( + new IBindingSet[][] { new IBindingSet[] { bset } }))); + + // Iterator visiting the subquery solutions. + subquerySolutionItr = runningQuery.iterator(); + + // Copy solutions from the subquery to the query. + final long ncopied = BOpUtility.copy(subquerySolutionItr, + parentContext.getSink(), null/* sink2 */, + null/* constraints */, null/* stats */); + + // wait for the subquery. + runningQuery.get(); + + if (ncopied == 0L && optional) { + + /* + * Since there were no solutions for the subquery, copy + * the original binding set to the default sink. + */ + parentContext.getSink().add(new IBindingSet[]{bset}); + + } + + // done. + return runningQuery; + + } catch (Throwable t) { + + /* + * If a subquery fails, then propagate the error to the + * parent and rethrow the first cause error out of the + * subquery. + */ + throw new RuntimeException(ControllerTask.this.context + .getRunningQuery().halt(t)); + + } finally { + + if (subquerySolutionItr != null) + subquerySolutionItr.close(); + + } + + } + + } // SubqueryTask + + } // ControllerTask + +} Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/TestDeepCopy.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/TestDeepCopy.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/TestDeepCopy.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -45,12 +45,10 @@ import com.bigdata.bop.constraint.NE; import com.bigdata.bop.constraint.NEConstant; import com.bigdata.bop.constraint.OR; -import com.bigdata.rdf.internal.constraints.InlineEQ; -import com.bigdata.rdf.internal.constraints.InlineGE; -import com.bigdata.rdf.internal.constraints.InlineGT; -import com.bigdata.rdf.internal.constraints.InlineLE; -import com.bigdata.rdf.internal.constraints.InlineLT; -import com.bigdata.rdf.internal.constraints.InlineNE; +import com.bigdata.rdf.internal.constraints.CompareBOp; +import com.bigdata.rdf.internal.constraints.IsInline; +import com.bigdata.rdf.internal.constraints.IsLiteral; +import com.bigdata.rdf.internal.constraints.MathBOp; import com.bigdata.rdf.rules.RejectAnythingSameAsItself; import com.bigdata.rdf.spo.SPOPredicate; import com.bigdata.rdf.spo.SPOStarJoin; @@ -99,12 +97,10 @@ SPOStarJoin.class,// com.bigdata.rdf.magic.MagicPredicate.class,// // com.bigdata.rdf.internal.constraint - InlineEQ.class,// - InlineGE.class,// - InlineLT.class,// - InlineLE.class,// - InlineGT.class,// - InlineNE.class,// + CompareBOp.class,// + IsInline.class,// + IsLiteral.class,// + MathBOp.class,// // com.bigdata.rdf.inf RejectAnythingSameAsItself.class, Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestOptionalJoinGroup.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestOptionalJoinGroup.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/controller/TestOptionalJoinGroup.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -219,7 +219,7 @@ /** * Unit test for optional join group. Three joins are used and target a * {@link SliceOp}. The 2nd and 3rd joins are embedded in an - * {@link OptionalJoinGroup}. + * {@link SubqueryOp}. * <P> * The optional join group takes the form: * @@ -342,10 +342,10 @@ subQuery = join3Op; } - final PipelineOp joinGroup1Op = new OptionalJoinGroup(new BOp[]{join1Op}, + final PipelineOp joinGroup1Op = new SubqueryOp(new BOp[]{join1Op}, new NV(Predicate.Annotations.BOP_ID, joinGroup1),// // new NV(PipelineOp.Annotations.CONDITIONAL_GROUP, joinGroup1),// - new NV(OptionalJoinGroup.Annotations.SUBQUERY, subQuery)// + new NV(SubqueryOp.Annotations.SUBQUERY, subQuery)// // , new NV(BOp.Annotations.CONTROLLER,true)// // new NV(BOp.Annotations.EVALUATION_CONTEXT, // BOpEvaluationContext.CONTROLLER)// @@ -607,10 +607,10 @@ subQuery = join3Op; } - final PipelineOp joinGroup1Op = new OptionalJoinGroup(new BOp[]{join1Op}, + final PipelineOp joinGroup1Op = new SubqueryOp(new BOp[]{join1Op}, new NV(Predicate.Annotations.BOP_ID, joinGroup1),// // new NV(PipelineOp.Annotations.CONDITIONAL_GROUP, joinGroup1),// - new NV(OptionalJoinGroup.Annotations.SUBQUERY, subQuery)// + new NV(SubqueryOp.Annotations.SUBQUERY, subQuery)// // new NV(BOp.Annotations.CONTROLLER,true)// // new NV(BOp.Annotations.EVALUATION_CONTEXT, // BOpEvaluationContext.CONTROLLER)// @@ -717,7 +717,7 @@ /** * Unit test for optional join group with a filter on a variable outside the * optional join group. Three joins are used and target a {@link SliceOp}. - * The 2nd and 3rd joins are in embedded an {@link OptionalJoinGroup}. The + * The 2nd and 3rd joins are in embedded an {@link SubqueryOp}. The * optional join group contains a filter that uses a variable outside the * optional join group. * <P> @@ -868,10 +868,10 @@ subQuery = join3Op; } - final PipelineOp joinGroup1Op = new OptionalJoinGroup(new BOp[]{condOp}, + final PipelineOp joinGroup1Op = new SubqueryOp(new BOp[]{condOp}, new NV(Predicate.Annotations.BOP_ID, joinGroup1),// // new NV(PipelineOp.Annotations.CONDITIONAL_GROUP, joinGroup1),// - new NV(OptionalJoinGroup.Annotations.SUBQUERY, subQuery)// + new NV(SubqueryOp.Annotations.SUBQUERY, subQuery)// // new NV(BOp.Annotations.CONTROLLER,true)// // new NV(BOp.Annotations.EVALUATION_CONTEXT, // BOpEvaluationContext.CONTROLLER)// Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -37,8 +37,6 @@ import com.bigdata.btree.keys.IKeyBuilder; import com.bigdata.btree.keys.KeyBuilder; import com.bigdata.rawstore.Bytes; -import com.bigdata.rdf.internal.constraints.AbstractInlineConstraint; -import com.bigdata.rdf.internal.constraints.InlineGT; import com.bigdata.rdf.model.BigdataBNode; import com.bigdata.rdf.model.BigdataLiteral; Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/AbstractInlineConstraint.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/AbstractInlineConstraint.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/AbstractInlineConstraint.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,97 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -package com.bigdata.rdf.internal.constraints; - -import java.util.Map; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.Constant; -import com.bigdata.bop.IBindingSet; -import com.bigdata.bop.IConstant; -import com.bigdata.bop.IVariable; -import com.bigdata.bop.constraint.BOpConstraint; -import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.internal.IVUtility; - -/** - * Use inline terms to perform numerical comparison operations. - * - * @see IVUtility#numericalCompare(IV, IV) - */ -public abstract class AbstractInlineConstraint extends BOpConstraint { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Required shallow copy constructor. - */ - public AbstractInlineConstraint(final BOp[] values, - final Map<String, Object> annotations) { - super(values, annotations); - } - - /** - * Required deep copy constructor. - */ - public AbstractInlineConstraint(final AbstractInlineConstraint op) { - super(op); - } - - protected AbstractInlineConstraint(final IVariable<IV> v, final IV iv) { - - super(new BOp[] { v, new Constant<IV>(iv) }, null/*annotations*/); - - if (v == null) - throw new IllegalArgumentException(); - - if (!IVUtility.canNumericalCompare(iv)) - throw new IllegalArgumentException(); - - } - - public boolean accept(final IBindingSet s) { - - // get binding for "x". - final IConstant<IV> c = s.get((IVariable<IV>) get(0)/* v */); - - if (c == null) - return true; // not yet bound. - - final IV term = c.get(); - - final IV iv = ((IConstant<IV>) get(1)/* iv */).get(); - - final int compare = IVUtility.numericalCompare(term, iv); - - return _accept(compare); - - } - - protected abstract boolean _accept(final int compare); - -} Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/CompareBOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/CompareBOp.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/CompareBOp.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -92,17 +92,14 @@ if (left == null || right == null) return true; // not yet bound. - if (IVUtility.canNumericalCompare(left) && - IVUtility.canNumericalCompare(right)) { - - return _accept(IVUtility.numericalCompare(left, right)); - - } else { - - return _accept(left.compareTo(right)); - - } + if (!IVUtility.canNumericalCompare(left)) + throw new NotNumericalException("cannot numerical compare: " + left); + if (!IVUtility.canNumericalCompare(right)) + throw new NotNumericalException("cannot numerical compare: " + right); + + return _accept(IVUtility.numericalCompare(left, right)); + } protected boolean _accept(final int compare) { @@ -128,4 +125,29 @@ } + public static class NotNumericalException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = -8853739187628588335L; + + public NotNumericalException() { + super(); + } + + public NotNumericalException(String s, Throwable t) { + super(s, t); + } + + public NotNumericalException(String s) { + super(s); + } + + public NotNumericalException(Throwable t) { + super(t); + } + + } + } Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineEQ.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineEQ.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineEQ.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,66 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -package com.bigdata.rdf.internal.constraints; - -import java.util.Map; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.IVariable; -import com.bigdata.rdf.internal.IV; - -/** - * Use inline numerical comparison techniques to implement the == operator. - */ -public class InlineEQ extends AbstractInlineConstraint { - - private static final long serialVersionUID = -859713006378534024L; - - /** - * Required shallow copy constructor. - */ - public InlineEQ(final BOp[] values, final Map<String, Object> annotations) { - super(values, annotations); - } - - /** - * Required deep copy constructor. - */ - public InlineEQ(final InlineEQ op) { - super(op); - } - - public InlineEQ(final IVariable<IV> v, final IV iv) { - - super(v, iv); - - } - - protected boolean _accept(final int compare) { - - return compare == 0; - - } - -} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGE.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGE.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGE.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,66 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -package com.bigdata.rdf.internal.constraints; - -import java.util.Map; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.IVariable; -import com.bigdata.rdf.internal.IV; - -/** - * Use inline numerical comparison techniques to implement the >= operator. - */ -public class InlineGE extends AbstractInlineConstraint { - - private static final long serialVersionUID = 5796593193255235408L; - - /** - * Required shallow copy constructor. - */ - public InlineGE(final BOp[] values, final Map<String, Object> annotations) { - super(values, annotations); - } - - /** - * Required deep copy constructor. - */ - public InlineGE(final InlineGE op) { - super(op); - } - - public InlineGE(final IVariable<IV> v, final IV iv) { - - super(v, iv); - - } - - protected boolean _accept(final int compare) { - - return compare >= 0; - - } - -} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGT.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGT.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineGT.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,66 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -package com.bigdata.rdf.internal.constraints; - -import java.util.Map; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.IVariable; -import com.bigdata.rdf.internal.IV; - -/** - * Use inline numerical comparison techniques to implement the > operator. - */ -public class InlineGT extends AbstractInlineConstraint { - - private static final long serialVersionUID = 8104692462788944394L; - - /** - * Required shallow copy constructor. - */ - public InlineGT(final BOp[] values, final Map<String, Object> annotations) { - super(values, annotations); - } - - /** - * Required deep copy constructor. - */ - public InlineGT(final InlineGT op) { - super(op); - } - - public InlineGT(final IVariable<IV> v, final IV iv) { - - super(v, iv); - - } - - protected boolean _accept(final int compare) { - - return compare > 0; - - } - -} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLE.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLE.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLE.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,66 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -package com.bigdata.rdf.internal.constraints; - -import java.util.Map; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.IVariable; -import com.bigdata.rdf.internal.IV; - -/** - * Use inline numerical comparison techniques to implement the <= operator. - */ -public class InlineLE extends AbstractInlineConstraint { - - private static final long serialVersionUID = 7632756199316546837L; - - /** - * Required shallow copy constructor. - */ - public InlineLE(final BOp[] values, final Map<String, Object> annotations) { - super(values, annotations); - } - - /** - * Required deep copy constructor. - */ - public InlineLE(final InlineLE op) { - super(op); - } - - public InlineLE(final IVariable<IV> v, final IV iv) { - - super(v, iv); - - } - - protected boolean _accept(final int compare) { - - return compare <= 0; - - } - -} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLT.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLT.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineLT.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,66 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -package com.bigdata.rdf.internal.constraints; - -import java.util.Map; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.IVariable; -import com.bigdata.rdf.internal.IV; - -/** - * Use inline numerical comparison techniques to implement the < operator. - */ -public class InlineLT extends AbstractInlineConstraint { - - private static final long serialVersionUID = 1012994769934551872L; - - /** - * Required shallow copy constructor. - */ - public InlineLT(final BOp[] values, final Map<String, Object> annotations) { - super(values, annotations); - } - - /** - * Required deep copy constructor. - */ - public InlineLT(final InlineLT op) { - super(op); - } - - public InlineLT(final IVariable<IV> v, final IV iv) { - - super(v, iv); - - } - - protected boolean _accept(final int compare) { - - return compare < 0; - - } - -} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineNE.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineNE.java 2011-01-12 04:44:24 UTC (rev 4074) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/InlineNE.java 2011-01-12 18:17:51 UTC (rev 4075) @@ -1,66 +0,0 @@ -/** - -Copyright (C) SYSTAP, LLC 2006-2010. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -package com.bigdata.rdf.internal.constraints; - -import java.util.Map; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.IVariable; -import com.bigdata.rdf.internal.IV; - -/** - * Use inline numerical comparison techniques to implement the != operator. - */ -public class InlineNE extends AbstractInlineConstraint { - - pr... [truncated message content] |