From: <tho...@us...> - 2011-03-07 21:13:16
|
Revision: 4278 http://bigdata.svn.sourceforge.net/bigdata/?rev=4278&view=rev Author: thompsonbry Date: 2011-03-07 21:13:10 +0000 (Mon, 07 Mar 2011) Log Message: ----------- Reconciled some things about RangeBOp evaluation with MikeP. RangeBOp#asBound(...) now traps type errors and SPOPredicate#asBound(...) does not. Modified Paths: -------------- 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/SPOKeyOrder.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java 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-07 19:58:52 UTC (rev 4277) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/RangeBOp.java 2011-03-07 21:13:10 UTC (rev 4278) @@ -57,9 +57,11 @@ public interface Annotations extends ImmutableBOp.Annotations { String VAR = (RangeBOp.class.getName() + ".var").intern(); - + + /** The inclusive lower bound. */ String FROM = (RangeBOp.class.getName() + ".from").intern(); + /** The exclusive upper bound. */ String TO = (RangeBOp.class.getName() + ".to").intern(); } @@ -160,35 +162,49 @@ final public RangeBOp asBound(final IBindingSet bs) { -// log.debug("getting the asBound value"); - - final IV from = from().get(bs); - -// log.debug("from: " + from); + IV from, to; + try { + // log.debug("getting the asBound value"); - // sort of like Var.get(), which returns null when the variable - // is not yet bound - if (from == null) + 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; + + to = to().get(bs); + + // log.debug("to: " + to); + + // sort of like Var.get(), which returns null when the variable + // is not yet bound + if (to == null) + return this; + + } catch (SparqlTypeErrorException ex) { + + /* + * Ignore. If the variables in the RangeBOp value expressions are + * not fully bound or has the wrong dynamic type then the range bop + * can not be evaluated yet. + */ + return this; + + } - final IV to = to().get(bs); - -// log.debug("to: " + to); - - // sort of like Var.get(), which returns null when the variable - // is not yet bound - 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)); - - return asBound; - - } + // 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)); + + return asBound; + + } final public boolean isFullyBound() { Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOKeyOrder.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOKeyOrder.java 2011-03-07 19:58:52 UTC (rev 4277) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOKeyOrder.java 2011-03-07 21:13:10 UTC (rev 4278) @@ -512,6 +512,7 @@ } + @Override public byte[] getToKey(final IKeyBuilder keyBuilder, final IPredicate<ISPO> predicate) { 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-07 19:58:52 UTC (rev 4277) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java 2011-03-07 21:13:10 UTC (rev 4278) @@ -322,37 +322,13 @@ if (rangeBOp == null) return tmp; - try { + /* + * Attempt to evaluate the RangeBOp. + */ + final RangeBOp asBound = rangeBOp.asBound(bindingSet); - /* - * Attempt to evaluate the RangeBOp. - */ - final RangeBOp asBound = rangeBOp.asBound(bindingSet); + tmp._setProperty(Annotations.RANGE, asBound); - 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; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |