From: <tho...@us...> - 2014-01-13 15:54:22
|
Revision: 7782 http://bigdata.svn.sourceforge.net/bigdata/?rev=7782&view=rev Author: thompsonbry Date: 2014-01-13 15:54:15 +0000 (Mon, 13 Jan 2014) Log Message: ----------- EBVBOp - cleanup imports, @Overrides. SPARQLConstraint - @Overrides. TryBeforeMaterializationConstraint - @Override Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/EBVBOp.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/TryBeforeMaterializationConstraint.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/EBVBOp.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/EBVBOp.java 2014-01-13 15:36:38 UTC (rev 7781) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/EBVBOp.java 2014-01-13 15:54:15 UTC (rev 7782) @@ -33,13 +33,10 @@ import com.bigdata.bop.BOp; import com.bigdata.bop.IBindingSet; import com.bigdata.bop.IValueExpression; -import com.bigdata.bop.NV; import com.bigdata.rdf.error.SparqlTypeErrorException; import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.internal.NotMaterializedException; import com.bigdata.rdf.internal.impl.literal.XSDBooleanIV; -import com.bigdata.rdf.model.BigdataValue; -import com.bigdata.rdf.sparql.ast.GlobalAnnotations; +import com.bigdata.rdf.sparql.ast.FilterNode; /** * Calculates the "effective boolean value" of an IValueExpression. See the @@ -53,6 +50,7 @@ */ private static final long serialVersionUID = -5701967329003122236L; + @SuppressWarnings("rawtypes") public EBVBOp(final IValueExpression<? extends IV> x) { this(new BOp[] { x }, BOp.NOANNS); @@ -75,7 +73,9 @@ * Constructor required for {@link com.bigdata.bop.BOpUtility#deepCopy(FilterNode)}. */ public EBVBOp(final EBVBOp op) { + super(op); + } /** @@ -111,39 +111,41 @@ * as a typed literal with a datatype of xsd:boolean and a lexical value of * "false". */ + @Override + @SuppressWarnings("rawtypes") public boolean accept(final IBindingSet bs) { - final IV iv = getAndCheckBound(0, bs); - - if (iv instanceof XSDBooleanIV) { - - return ((XSDBooleanIV) iv).booleanValue(); - - } - - final Value val = super.asValue(iv); - - try { - - return QueryEvaluationUtil.getEffectiveBooleanValue(val); - - } catch (ValueExprEvaluationException ex) { - - throw new SparqlTypeErrorException(); - - } - + final IV iv = getAndCheckBound(0, bs); + + if (iv instanceof XSDBooleanIV) { + + return ((XSDBooleanIV) iv).booleanValue(); + + } + + final Value val = super.asValue(iv); + + try { + + return QueryEvaluationUtil.getEffectiveBooleanValue(val); + + } catch (ValueExprEvaluationException ex) { + + throw new SparqlTypeErrorException(); + + } + } - + /** - * The EBVBOp only needs materialization if its internal value expression - * does not evaluate to an XSDBooleanIV. + * The {@link EBVBOp} only needs materialization if its internal value + * expression does not evaluate to an {@link XSDBooleanIV}. */ + @Override public Requirement getRequirement() { - - return INeedsMaterialization.Requirement.SOMETIMES; - + + return INeedsMaterialization.Requirement.SOMETIMES; + } - } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java 2014-01-13 15:36:38 UTC (rev 7781) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/SPARQLConstraint.java 2014-01-13 15:54:15 UTC (rev 7782) @@ -34,12 +34,14 @@ import com.bigdata.rdf.error.SparqlTypeErrorException; import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.internal.impl.literal.XSDBooleanIV; +import com.bigdata.rdf.sparql.ast.FilterNode; import com.bigdata.util.InnerCause; /** * BOpConstraint that wraps a {@link EBVBOp}, which itself computes the - * effective boolean value of an IValueExpression. + * effective boolean value of an {@link IValueExpression}. */ +@SuppressWarnings("rawtypes") public class SPARQLConstraint<X extends XSDBooleanIV> extends com.bigdata.bop.constraint.Constraint<X> { @@ -68,7 +70,6 @@ * The value expression will be automatically wrapped inside an * {@link EBVBOp} if it does not itself evaluate to a boolean. */ - @SuppressWarnings("rawtypes") public SPARQLConstraint(final IValueExpression<? extends IV> x) { this(new BOp[] { wrap(x) }, null/*annocations*/); @@ -96,7 +97,7 @@ } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings("unchecked") @Override public IValueExpression<? extends XSDBooleanIV> get(final int i) { @@ -114,7 +115,6 @@ try { // evaluate the EBV operator - @SuppressWarnings("rawtypes") final XSDBooleanIV iv = get(0).get(bs); return iv.booleanValue(); @@ -138,4 +138,16 @@ } + /** + * Overridden to provide a little bit of information about the attached + * constraint. + */ + @Override + public String toShortString() { + + return super.toShortString() + "{condition=" + + getValueExpression().toShortString() + "}"; + + } + } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/TryBeforeMaterializationConstraint.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/TryBeforeMaterializationConstraint.java 2014-01-13 15:36:38 UTC (rev 7781) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/TryBeforeMaterializationConstraint.java 2014-01-13 15:54:15 UTC (rev 7782) @@ -89,40 +89,42 @@ * step in the pipeline to ensure that the solution gets routed around * the materialization steps. See {@link IsMaterializedBOp}. */ + @Override public boolean accept(final IBindingSet bs) { - final IConstraint c = (IConstraint) get(0); - - try { - - if (log.isDebugEnabled()) { - log.debug("about to attempt evaluation prior to materialization"); - } - - final boolean accept = c.accept(bs); - - if (log.isDebugEnabled()) { - log.debug("successfully evaluated constraint without materialization"); - } - - return accept; - - } catch (Throwable t) { + final IConstraint c = (IConstraint) get(0); - if (InnerCause.isInnerCause(t, NotMaterializedException.class)) { - - if (log.isDebugEnabled()) { - log.debug("could not evaluate constraint without materialization"); - } - - // let the solution through for now, it will get tested again - // on the other side of the materialization pipeline - return true; - - } else throw new RuntimeException(t); - - } - + try { + + if (log.isDebugEnabled()) { + log.debug("about to attempt evaluation prior to materialization"); + } + + final boolean accept = c.accept(bs); + + if (log.isDebugEnabled()) { + log.debug("successfully evaluated constraint without materialization"); + } + + return accept; + + } catch (Throwable t) { + + if (InnerCause.isInnerCause(t, NotMaterializedException.class)) { + + if (log.isDebugEnabled()) { + log.debug("could not evaluate constraint without materialization"); + } + + // let the solution through for now, it will get tested again + // on the other side of the materialization pipeline + return true; + + } else + throw new RuntimeException(t); + + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |