From: <tho...@us...> - 2011-03-05 20:38:44
|
Revision: 4275 http://bigdata.svn.sourceforge.net/bigdata/?rev=4275&view=rev Author: thompsonbry Date: 2011-03-05 20:38:35 +0000 (Sat, 05 Mar 2011) Log Message: ----------- I have renamed the RDF aware Constraint class to SPARQLConstraint to avoid confusion with the version which is NOT aware of SPARQL evaluation semantics (esp, type errors). I have added some optimizations to MathBOp and RangeBOp designed to provide a fast path if the left argument evaluations to null and to defer heap allocations until we know that the RangeBOp can be fully evaluated. I have modified SPOPredicate#asBound(...) to trap type errors arising from attempts to evaluate a RangeBOp when some variable(s) are not bound. I am not sure that this is the right thing to do, but it allows the RTO to run. It may be that the underlying problem is making the PartitionedJoinGroup aware of the RangeBOp. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JGraph.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/error/SparqlTypeErrorException.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/MathBOp.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/RangeBOp.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java 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/rdf/internal/constraints/TestInlineConstraints.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataEvaluationStrategyImpl3.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java Removed Paths: ------------- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/Constraint.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JGraph.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JGraph.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JGraph.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -1270,41 +1270,44 @@ if (!PartitionedJoinGroup.canJoinUsingConstraints( new IPredicate[] { v.pred }, vp.pred, C)) { - /* - * If there are no shared variables, either directly or - * indirectly via the constraints, then we can not use this - * as an initial edge. - * - * @todo UNIT TEST : correct rejection of initial paths for - * vertices which are unconstrained joins. - * - * @todo UNIT TEST : correct acceptance of initial paths for - * vertices which are unconstrained joins IFF there are no - * constrained joins in the join graph. - */ + /* + * If there are no shared variables, either directly or + * indirectly via the constraints, then we can not use this + * as an initial edge. + * + * TODO It may be possible to execute the join in one + * direction or the other but not both. This seems to be + * true for RangeBOp. + * + * @todo UNIT TEST : correct rejection of initial paths for + * vertices which are unconstrained joins. + * + * @todo UNIT TEST : correct acceptance of initial paths for + * vertices which are unconstrained joins IFF there are no + * constrained joins in the join graph. + */ continue; - } - - // The path segment - final IPredicate<?>[] preds = new IPredicate[] { v.pred, vp.pred }; + } - // cutoff join of the edge (v,vp) - final EdgeSample edgeSample = Path.cutoffJoin( - queryEngine,// - limit, // sample limit - preds, // ordered path segment. - C, // constraints - pathIsComplete,// - v.sample // sourceSample - ); + // The path segment + final IPredicate<?>[] preds = new IPredicate[] { v.pred, vp.pred }; - final Path p = new Path(v, vp, edgeSample); + // cutoff join of the edge (v,vp) + final EdgeSample edgeSample = Path.cutoffJoin(queryEngine,// + limit, // sample limit + preds, // ordered path segment. + C, // constraints + pathIsComplete,// + v.sample // sourceSample + ); - paths.add(p); + final Path p = new Path(v, vp, edgeSample); - } + paths.add(p); + + } } Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/error/SparqlTypeErrorException.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/error/SparqlTypeErrorException.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/error/SparqlTypeErrorException.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -46,28 +46,49 @@ static public String SPARQL_TYPE_ERROR_0000 = toURI(0); /** + * Type error used to indicate an unbound variable. + */ + static public String SPARQL_TYPE_ERROR_0001 = toURI(1); + + /** * Generic SPARQL type error. * * @see #SPARQL_TYPE_ERROR_0000 */ public SparqlTypeErrorException() { - super(LanguageFamily.SP, ErrorCategory.TY, 0/* errorCode */, - SPARQL_TYPE_ERROR_0000); + this(0/* errorCode */, SPARQL_TYPE_ERROR_0000); } - /** - * @param errorCode - * The four digit error code. - */ - public SparqlTypeErrorException(int errorCode) { + /** + * Type error thrown when there is an unbound variable. + */ + static public class UnboundVarException extends SparqlTypeErrorException { + private static final long serialVersionUID = 1L; + + public UnboundVarException() { + + super(0001/* errorCode */, SPARQL_TYPE_ERROR_0001); + + } + + } + + /** + * @param errorCode + * The four digit error code. + * @param uri + * The uri of the error. + */ + protected SparqlTypeErrorException(final int errorCode, final String uri) { + super(LanguageFamily.SP, ErrorCategory.TY, errorCode, null/* msg */); } - static protected String toURI(int errorCode) { + static protected String toURI(final int errorCode) { return W3CQueryLanguageException.toURI(LanguageFamily.SP, ErrorCategory.TY, errorCode); Deleted: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/Constraint.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/Constraint.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/Constraint.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -1,119 +0,0 @@ -/* - -Copyright (C) SYSTAP, LLC 2006-2011. 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 org.apache.log4j.Logger; - -import com.bigdata.bop.BOp; -import com.bigdata.bop.IBindingSet; -import com.bigdata.bop.IConstraint; -import com.bigdata.bop.IValueExpression; -import com.bigdata.rdf.error.SparqlTypeErrorException; -import com.bigdata.rdf.internal.IV; -import com.bigdata.util.InnerCause; - -/** - * BOpConstraint that wraps a {@link EBVBOp}, which itself computes the - * effective boolean value of an IValueExpression. - */ -public class Constraint extends com.bigdata.bop.constraint.Constraint { - - /** - * - */ - private static final long serialVersionUID = -5796492538735372727L; - - protected static final Logger log = Logger.getLogger(Constraint.class); - - /** - * Convenience method to generate a constraint from a value expression. - */ - public static IConstraint wrap(final IValueExpression<IV> ve) { - if (ve instanceof EBVBOp) - return new Constraint((EBVBOp) ve); - else - return new Constraint(new EBVBOp(ve)); - } - - - public Constraint(final EBVBOp x) { - - this(new BOp[] { x }, null/*annocations*/); - - } - - /** - * Required shallow copy constructor. - */ - public Constraint(final BOp[] args, - final Map<String, Object> anns) { - super(args, anns); - } - - /** - * Required deep copy constructor. - */ - public Constraint(final Constraint op) { - super(op); - } - - @Override - public EBVBOp get(final int i) { - return (EBVBOp) super.get(i); - } - - public IValueExpression<IV> getValueExpression() { - return get(0).get(0); - } - - public boolean accept(final IBindingSet bs) { - - try { - - // evaluate the EBV operator - return get(0).get(bs).booleanValue(); - - } catch (Throwable t) { - - if (InnerCause.isInnerCause(t, SparqlTypeErrorException.class)) { - - // trap the type error and filter out the solution - if (log.isInfoEnabled()) - log.info("discarding solution due to type error: " + bs - + " : " + t); - - return false; - - } - - throw new RuntimeException(t); - - } - - } - -} Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/MathBOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/MathBOp.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/MathBOp.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -131,11 +131,16 @@ final public IV get(final IBindingSet bs) { final IV left = left().get(bs); + + // not yet bound? + if (left == null) + throw new SparqlTypeErrorException.UnboundVarException(); + final IV right = right().get(bs); - // not yet bound - if (left == null || right == null) - throw new SparqlTypeErrorException(); + // not yet bound? + if (right == null) + throw new SparqlTypeErrorException.UnboundVarException(); return IVUtility.numericalMath(left, right, op()); Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/RangeBOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/RangeBOp.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/RangeBOp.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -39,6 +39,11 @@ import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.internal.Range; +/** + * Operator used to impose a key-range constraint on an access path. + * + * @author mrpersonick + */ final public class RangeBOp extends BOpBase implements IVariable<Range> { @@ -49,7 +54,6 @@ // private static final Logger log = Logger.getLogger(RangeBOp.class); - public interface Annotations extends ImmutableBOp.Annotations { String VAR = (RangeBOp.class.getName() + ".var").intern(); @@ -75,7 +79,7 @@ /** * Required shallow copy constructor. */ - public RangeBOp(final BOp[] args, Map<String,Object> anns) { + public RangeBOp(final BOp[] args, final Map<String,Object> anns) { super(args,anns); @@ -124,15 +128,22 @@ // log.debug("getting the asBound value"); final IV from = from().get(bs); + +// log.debug("from: " + from); + + // sort of like Var.get(), which returns null when the variable + // is not yet bound + if (from == null) + return null; + final IV to = to().get(bs); -// log.debug("from: " + from); // log.debug("to: " + to); // sort of like Var.get(), which returns null when the variable // is not yet bound - if (from == null || to == null) - return null; + if (to == null) + return null; try { // let Range ctor() do the type checks and valid range checks @@ -149,21 +160,29 @@ final public RangeBOp asBound(final IBindingSet bs) { - final RangeBOp asBound = (RangeBOp) this.clone(); - // log.debug("getting the asBound value"); final IV from = from().get(bs); + +// log.debug("from: " + from); + + // sort of like Var.get(), which returns null when the variable + // is not yet bound + if (from == null) + return this; + final IV to = to().get(bs); -// log.debug("from: " + from); // log.debug("to: " + to); // sort of like Var.get(), which returns null when the variable // is not yet bound - if (from == null || to == null) - return asBound; + if (to == null) + return this; + // Note: defer clone() until everything is bound. + final RangeBOp asBound = (RangeBOp) this.clone(); + asBound._setProperty(Annotations.FROM, new Constant(from)); asBound._setProperty(Annotations.TO, new Constant(to)); Copied: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java (from rev 4261, branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/Constraint.java) =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -0,0 +1,119 @@ +/* + +Copyright (C) SYSTAP, LLC 2006-2011. 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 org.apache.log4j.Logger; + +import com.bigdata.bop.BOp; +import com.bigdata.bop.IBindingSet; +import com.bigdata.bop.IConstraint; +import com.bigdata.bop.IValueExpression; +import com.bigdata.rdf.error.SparqlTypeErrorException; +import com.bigdata.rdf.internal.IV; +import com.bigdata.util.InnerCause; + +/** + * BOpConstraint that wraps a {@link EBVBOp}, which itself computes the + * effective boolean value of an IValueExpression. + */ +public class SPARQLConstraint extends com.bigdata.bop.constraint.Constraint { + + /** + * + */ + private static final long serialVersionUID = -5796492538735372727L; + + protected static final Logger log = Logger.getLogger(SPARQLConstraint.class); + + /** + * Convenience method to generate a constraint from a value expression. + */ + public static IConstraint wrap(final IValueExpression<IV> ve) { + if (ve instanceof EBVBOp) + return new SPARQLConstraint((EBVBOp) ve); + else + return new SPARQLConstraint(new EBVBOp(ve)); + } + + + public SPARQLConstraint(final EBVBOp x) { + + this(new BOp[] { x }, null/*annocations*/); + + } + + /** + * Required shallow copy constructor. + */ + public SPARQLConstraint(final BOp[] args, + final Map<String, Object> anns) { + super(args, anns); + } + + /** + * Required deep copy constructor. + */ + public SPARQLConstraint(final SPARQLConstraint op) { + super(op); + } + + @Override + public EBVBOp get(final int i) { + return (EBVBOp) super.get(i); + } + + public IValueExpression<IV> getValueExpression() { + return get(0).get(0); + } + + public boolean accept(final IBindingSet bs) { + + try { + + // evaluate the EBV operator + return get(0).get(bs).booleanValue(); + + } catch (Throwable t) { + + if (InnerCause.isInnerCause(t, SparqlTypeErrorException.class)) { + + // trap the type error and filter out the solution + if (log.isInfoEnabled()) + log.info("discarding solution due to type error: " + bs + + " : " + t); + + return false; + + } + + throw new RuntimeException(t); + + } + + } + +} Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -31,6 +31,7 @@ import com.bigdata.bop.IVariableOrConstant; import com.bigdata.bop.NV; import com.bigdata.bop.ap.Predicate; +import com.bigdata.rdf.error.SparqlTypeErrorException; import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.internal.constraints.RangeBOp; import com.bigdata.relation.rule.IAccessPathExpander; @@ -320,13 +321,40 @@ // we don't have a range bop for ?o if (rangeBOp == null) return tmp; - - final RangeBOp asBound = rangeBOp.asBound(bindingSet); - - tmp._setProperty(Annotations.RANGE, asBound); - - return tmp; - - } + try { + + /* + * Attempt to evaluate the RangeBOp. + */ + final RangeBOp asBound = rangeBOp.asBound(bindingSet); + + tmp._setProperty(Annotations.RANGE, asBound); + + } catch (SparqlTypeErrorException.UnboundVarException ex) { + + /* + * If there was an unbound variable in the RangeBOp annotation then + * we will drop the RangeBOp. + * + * FIXME I have modified SPOPredicate#asBound(...) to trap type + * errors arising from attempts to evaluate a RangeBOp when some + * variable(s) are not bound. This presumes that the RangeBOp is in + * addition to (not instead of) the value expression from which the + * RangeBOp constraint was derived. Verify with MikeP. + * + * I am not sure that this is the right thing to do, but it allows + * the RTO to run. It may be that the underlying problem is making + * the PartitionedJoinGroup aware of the RangeBOp such that we do + * not attempt evaluation orders which would cause the RangeBOP to + * throw a type error. This gets into the area of alternative query + * plans rather than just alternative join orderings. + */ + + } + + return tmp; + + } + } 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-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnBSBMData.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -1,6 +1,7 @@ package com.bigdata.bop.rdf.joinGraph; import java.io.File; +import java.math.BigInteger; import java.util.Properties; import java.util.UUID; @@ -22,11 +23,13 @@ import com.bigdata.journal.ITx; import com.bigdata.journal.Journal; import com.bigdata.rdf.internal.XSDIntIV; +import com.bigdata.rdf.internal.XSDIntegerIV; import com.bigdata.rdf.internal.constraints.CompareBOp; -import com.bigdata.rdf.internal.constraints.Constraint; import com.bigdata.rdf.internal.constraints.IsBoundBOp; import com.bigdata.rdf.internal.constraints.MathBOp; import com.bigdata.rdf.internal.constraints.NotBOp; +import com.bigdata.rdf.internal.constraints.RangeBOp; +import com.bigdata.rdf.internal.constraints.SPARQLConstraint; import com.bigdata.rdf.internal.constraints.SameTermBOp; import com.bigdata.rdf.internal.constraints.MathBOp.MathOp; import com.bigdata.rdf.model.BigdataLiteral; @@ -273,6 +276,40 @@ } } + /* + * This demonstrates the translation of one of the constraints into a + * key-range constraint on the access path. + * + * FIXME What is the purpose of RangeBOp#var? Why is it simProperty and + * not origProperty + * + * FIXME Is the RangeBOp in addition to, or instead of, the original + * constraint? + * + * [java] PipelineJoin[14](PipelineJoin[13])[ BOp.bopId=14, + * PipelineJoin. + * + * constraints=[Constraint(EBVBOp(CompareBOp(simProperty1,MINUS + * (origProperty1, XSDInteger(120)))[ CompareBOp.op=GT])), + * Constraint(EBVBOp(CompareBOp(simProperty1,PLUS(origProperty1, + * XSDInteger(120)))[ CompareBOp.op=LT]))], + * + * BOp.evaluationContext=ANY, + * + * PipelineJoin.predicate=SPOPredicate[7](product=null, TermId(279564U), simProperty1=null)[ + * + * IPredicate.relationName=[BSBM_284826.spo], + * + * IPredicate.timestamp=1299271044298, + * + * IPredicate.flags=[KEYS,VALS,READONLY,PARALLEL], + * + * SPOPredicate.range=RangeBOp()[ RangeBOp.var=simProperty1, + * RangeBOp.from=MINUS(origProperty1, XSDInteger(120)), + * RangeBOp.to=PLUS(origProperty1, XSDInteger(120)) + * + * ], BOp.bopId=7], QueryHints.optimizer=None] + */ final boolean distinct = true; final IVariable<?>[] selected; final IConstraint[] constraints; @@ -351,6 +388,15 @@ },// new NV(BOp.Annotations.BOP_ID, nextId++),// new NV(Annotations.TIMESTAMP, timestamp),// + new NV(SPOPredicate.Annotations.RANGE, new RangeBOp(// + origProperty1,// FIXME verify correct var w/ MikeP + new MathBOp(origProperty1, new Constant( + new XSDIntegerIV(BigInteger.valueOf(120))), + MathOp.MINUS),// + new MathBOp(origProperty1, new Constant( + new XSDIntegerIV(BigInteger.valueOf(120))), + MathOp.PLUS)// + )),// new NV(IPredicate.Annotations.RELATION_NAME, spoRelation)// ); @@ -373,6 +419,15 @@ },// new NV(BOp.Annotations.BOP_ID, nextId++),// new NV(Annotations.TIMESTAMP, timestamp),// + new NV(SPOPredicate.Annotations.RANGE, new RangeBOp(// + origProperty2,// FIXME verify correct var with MikeP + new MathBOp(origProperty2, new Constant( + new XSDIntegerIV(BigInteger.valueOf(170))), + MathOp.MINUS),// + new MathBOp(origProperty2, new Constant( + new XSDIntegerIV(BigInteger.valueOf(170))), + MathOp.PLUS)// + )),// new NV(IPredicate.Annotations.RELATION_NAME, spoRelation)// ); @@ -433,7 +488,7 @@ // the constraints on the join graph. constraints = new IConstraint[ves.length]; for (int i = 0; i < ves.length; i++) { - constraints[i] = Constraint.wrap(ves[i]); + constraints[i] = SPARQLConstraint.wrap(ves[i]); } } @@ -737,17 +792,17 @@ preds = new IPredicate[] { p0, p1, p2, p3, p4, p5, p6 }; // FILTER ( ?p1 > %x% ) - c0 = Constraint.wrap(new CompareBOp(new BOp[] { p1Var, + c0 = SPARQLConstraint.wrap(new CompareBOp(new BOp[] { p1Var, new Constant(x.getIV()) }, NV.asMap(new NV[] { new NV( CompareBOp.Annotations.OP, CompareOp.GT) }))); // FILTER (?p3 < %y% ) - c1 = Constraint.wrap(new CompareBOp(new BOp[] { p3Var, + c1 = SPARQLConstraint.wrap(new CompareBOp(new BOp[] { p3Var, new Constant(y.getIV()) }, NV.asMap(new NV[] { new NV( CompareBOp.Annotations.OP, CompareOp.LT) }))); // FILTER (!bound(?testVar)) - c2 = Constraint.wrap(new NotBOp(new IsBoundBOp(testVar))); + c2 = SPARQLConstraint.wrap(new NotBOp(new IsBoundBOp(testVar))); // the constraints on the join graph. constraints = new IConstraint[] { c0, c1, c2 }; Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/internal/constraints/TestInlineConstraints.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/internal/constraints/TestInlineConstraints.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/internal/constraints/TestInlineConstraints.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -173,7 +173,7 @@ }, // constraints on the rule. new IConstraint[] { - Constraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.GT)) + SPARQLConstraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.GT)) } ); @@ -279,7 +279,7 @@ }, // constraints on the rule. new IConstraint[] { - Constraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.GE)) + SPARQLConstraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.GE)) }); try { @@ -386,7 +386,7 @@ }, // constraints on the rule. new IConstraint[] { - Constraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.LT)) + SPARQLConstraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.LT)) }); if (log.isInfoEnabled()) @@ -494,7 +494,7 @@ }, // constraints on the rule. new IConstraint[] { - Constraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.LE)) + SPARQLConstraint.wrap(new CompareBOp(a, new Constant<IV>(_35.getIV()), CompareOp.LE)) }); if (log.isInfoEnabled()) @@ -611,7 +611,7 @@ }, // constraints on the rule. new IConstraint[] { - Constraint.wrap(new CompareBOp(a, new MathBOp(dAge, new Constant<IV>(_5.getIV()), MathOp.PLUS), CompareOp.GT)) + SPARQLConstraint.wrap(new CompareBOp(a, new MathBOp(dAge, new Constant<IV>(_5.getIV()), MathOp.PLUS), CompareOp.GT)) }); try { @@ -724,7 +724,7 @@ }, // constraints on the rule. new IConstraint[] { - Constraint.wrap(new CompareBOp(a, new Constant<IV>(l2.getIV()), CompareOp.GT)) + SPARQLConstraint.wrap(new CompareBOp(a, new Constant<IV>(l2.getIV()), CompareOp.GT)) }); try { Modified: 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/BigdataEvaluationStrategyImpl3.java 2011-03-04 18:54:31 UTC (rev 4274) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataEvaluationStrategyImpl3.java 2011-03-05 20:38:35 UTC (rev 4275) @@ -90,7 +90,7 @@ import com.bigdata.rdf.internal.XSDIntegerIV; import com.bigdata.rdf.internal.constraints.AndBOp; import com.bigdata.rdf.internal.constraints.CompareBOp; -import com.bigdata.rdf.internal.constraints.Constraint; +import com.bigdata.rdf.internal.constraints.SPARQLConstraint; import com.bigdata.rdf.internal.constraints.EBVBOp; import com.bigdata.rdf.internal.constraints.IsBNodeBOp; import com.bigdata.rdf.internal.constraints.IsBoundBOp; @@ -1087,10 +1087,10 @@ for (SOp sop : g) { final BOp bop = sop.getBOp(); - if (!(bop instanceof Constraint)) { + if (!(bop instanceof SPARQLConstraint)) { continue; } - final Constraint c = (Constraint) bop; + final SPARQLConstraint c = (SPARQLConstraint) bop; if (!(c.getValueExpression() instanceof CompareBOp)) { continue; } @@ -1679,7 +1679,7 @@ private IConstraint toConstraint(final ValueExpr ve) { final IValueExpression<IV> veBOp = toVE(ve); - return Constraint.wrap(veBOp); + return SPARQLConstraint.wrap(veBOp); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |