From: <tho...@us...> - 2010-09-29 19:14:40
|
Revision: 3683 http://bigdata.svn.sourceforge.net/bigdata/?rev=3683&view=rev Author: thompsonbry Date: 2010-09-29 19:14:33 +0000 (Wed, 29 Sep 2010) Log Message: ----------- The SameVariableConstraint was not being applied successfully because we were failing to create an SPOAccessPath in BOpContextBase. I've added a newAccessPath(...) method on AbstractRelation. All access path creates now delegate through that method to a sole constructor on AccessPath or SPOAccessPath. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpContextBase.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/BOpTupleFilter.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraint.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/AbstractRelation.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/rules/AbstractRuleDistinctTermScan.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/DistinctTermAdvancer.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOAccessPath.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.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/BigdataSail.java branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/Striterator.java Removed Paths: ------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraintFilter.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpContextBase.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpContextBase.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpContextBase.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -353,11 +353,10 @@ } // Obtain the access path for that relation and index. - final IAccessPath<E> accessPath = new AccessPath<E>( - relation, indexManager, timestamp, - predicate, keyOrder, ndx, flags, - chunkOfChunksCapacity, chunkCapacity, - fullyBufferedReadThreshold).init(); + final IAccessPath<E> accessPath = ((AbstractRelation<E>) relation) + .newAccessPath(relation, indexManager, timestamp, predicate, + keyOrder, ndx, flags, chunkOfChunksCapacity, + chunkCapacity, fullyBufferedReadThreshold); // optionally wrap with an expander pattern. return expander(predicate, accessPath); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/BOpTupleFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/BOpTupleFilter.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/BOpTupleFilter.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -40,8 +40,6 @@ import com.bigdata.btree.filter.TupleFilter; import com.bigdata.btree.filter.TupleFilter.TupleFilterator; -import cutthecrap.utils.striterators.IFilterTest; - /** * <p> * Filter supporting {@link ITupleIterator}s. @@ -101,34 +99,6 @@ super(args, annotations); } -// /** -// * Convenience method wraps the {@link IFilterTest} as a -// * {@link BOpTupleFilter}. -// * -// * @param test -// * The test (optional). -// * -// * @return The filter wrapping the test -or- <code>null</code> if the -// * argument is <code>null</code>. -// */ -// @SuppressWarnings("unchecked") -// public static BOpFilterBase newInstance(final IFilterTest test) { -// -// if (test == null) { -// // No test. No filter. -// return null; -// } -// -// return new BOpTupleFilter(new BOp[0]/*filters*/,null/*annotations*/) { -// private static final long serialVersionUID = 1L; -// @Override -// protected boolean isValid(ITuple obj) { -// return test.isValid(obj); -// } -// }; -// -// } - @Override final protected Iterator filterOnce(Iterator src, final Object context) { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraint.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraint.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraint.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -19,6 +19,8 @@ import com.bigdata.bop.IVariableOrConstant; import com.bigdata.relation.accesspath.IAccessPath; +import cutthecrap.utils.striterators.IFilterTest; + /** * Filter imposes the "same variable" constraint on the elements visited by an * {@link IAccessPath}. The filter is required IFF a {@link IVariable} appears @@ -39,7 +41,7 @@ * The generic type of the elements that will be tested by the * filter. */ -public class SameVariableConstraint<E> implements Externalizable { +public class SameVariableConstraint<E> implements IFilterTest, Externalizable { /** * The predicate template. @@ -110,8 +112,15 @@ // return true; // } - public boolean accept(final E e) { + @SuppressWarnings("unchecked") + public boolean isValid(final Object obj) { + return accept((E) obj); + + } + + private boolean accept(final E e) { + int i = 0; while (i < indices.length) { Deleted: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraintFilter.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraintFilter.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/filter/SameVariableConstraintFilter.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -1,105 +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 Sep 28, 2010 - */ - -package com.bigdata.bop.ap.filter; - -import java.util.Iterator; -import java.util.Map; - -import com.bigdata.bop.BOp; - -import cutthecrap.utils.striterators.Filter; -import cutthecrap.utils.striterators.Filterator; - -/** - * Operator imposing a {@link SameVariableConstraint} filter. - * - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ - */ -public class SameVariableConstraintFilter extends BOpFilterBase { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public interface Annotations extends BOpFilterBase.Annotations { - - /** - * The constraint to be imposed (required). - */ - String FILTER = SameVariableConstraintFilter.class.getName() - + ".filter"; - - } - - /** - * @param op - */ - public SameVariableConstraintFilter(SameVariableConstraintFilter op) { - super(op); - } - - /** - * @param args - * @param annotations - */ - public SameVariableConstraintFilter(BOp[] args, - Map<String, Object> annotations) { - super(args, annotations); - } - - @Override - final protected Iterator filterOnce(Iterator src, final Object context) { - - final SameVariableConstraint filter = (SameVariableConstraint) getRequiredProperty(Annotations.FILTER); - - return new Filterator(src, context, new FilterImpl(filter)); - - } - - static private class FilterImpl extends Filter { - - private static final long serialVersionUID = 1L; - - private final SameVariableConstraint filter; - - public FilterImpl(final SameVariableConstraint filter) { - this.filter = filter; - } - - @Override - public boolean isValid(Object obj) { - - return filter.accept(obj); - - } - - } - -} Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/AbstractRelation.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/AbstractRelation.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/AbstractRelation.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -44,6 +44,8 @@ import com.bigdata.journal.Journal; import com.bigdata.journal.TemporaryRawStore; import com.bigdata.journal.TemporaryStore; +import com.bigdata.rdf.spo.ISPO; +import com.bigdata.rdf.spo.SPORelation; import com.bigdata.relation.accesspath.AccessPath; import com.bigdata.relation.accesspath.IAccessPath; import com.bigdata.service.DataService; @@ -232,6 +234,35 @@ } + /** + * Core impl. + * + * @param relation + * @param indexManager + * @param timestamp + * @param predicate + * @param keyOrder + * @param ndx + * @param flags + * @param chunkOfChunksCapacity + * @param chunkCapacity + * @param fullyBufferedReadThreshold + * @return + * + * @todo Raise into interface? + */ + public IAccessPath<E> newAccessPath(final IRelation<E> relation, + final IIndexManager indexManager, final long timestamp, + final IPredicate<E> predicate, final IKeyOrder<E> keyOrder, + final IIndex ndx, final int flags, final int chunkOfChunksCapacity, + final int chunkCapacity, final int fullyBufferedReadThreshold) { + + return new AccessPath<E>(this/* relation */, indexManager, timestamp, + predicate, keyOrder, ndx, flags, chunkOfChunksCapacity, + chunkCapacity, fullyBufferedReadThreshold).init(); + + } + public IAccessPath<E> getAccessPath(final IPredicate<E> predicate) { // find the best key order. @@ -243,10 +274,10 @@ // default flags. final int flags = IRangeQuery.DEFAULT; - return new AccessPath<E>(this/* relation */, getIndexManager(), + return newAccessPath(this/*relation*/, getIndexManager(), getTimestamp(), predicate, keyOrder, ndx, flags, getChunkOfChunksCapacity(), getChunkCapacity(), - getFullyBufferedReadThreshold()).init(); + getFullyBufferedReadThreshold()); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -37,18 +37,18 @@ import org.apache.log4j.Logger; -import com.bigdata.bop.BOp; import com.bigdata.bop.IPredicate; -import com.bigdata.bop.NV; +import com.bigdata.bop.IVariableOrConstant; import com.bigdata.bop.ap.filter.SameVariableConstraint; -import com.bigdata.bop.ap.filter.SameVariableConstraintFilter; import com.bigdata.btree.BytesUtil; import com.bigdata.btree.IBloomFilter; import com.bigdata.btree.IIndex; import com.bigdata.btree.ILocalBTreeView; import com.bigdata.btree.IRangeQuery; +import com.bigdata.btree.ITuple; import com.bigdata.btree.ITupleIterator; import com.bigdata.btree.Tuple; +import com.bigdata.btree.filter.TupleFilter; import com.bigdata.btree.keys.IKeyBuilder; import com.bigdata.journal.IIndexManager; import com.bigdata.journal.TimestampUtility; @@ -393,13 +393,14 @@ if (indexLocalFilter != null) tmp.addFilter(indexLocalFilter); - tmp.addFilter(new SameVariableConstraintFilter( - new BOp[] {}, - NV.asMap(new NV[] { new NV( - SameVariableConstraintFilter.Annotations.FILTER, - sameVarConstraint) }))); + tmp.addFilter(new TupleFilter(){ + private static final long serialVersionUID = 1L; + @Override + protected boolean isValid(ITuple tuple) { + return sameVarConstraint.isValid(tuple.getObject()); + }}); - this.indexLocalFilter = indexLocalFilter; + this.indexLocalFilter = tmp; } else { @@ -410,7 +411,7 @@ } // optional filter to be evaluated by the AccessPath. - this.accessPathFilter = predicate.getAccessPathFilter();; + this.accessPathFilter = predicate.getAccessPathFilter(); // true iff there is a filter (either local or remote). this.hasFilter = (indexLocalFilter != null || accessPathFilter != null); @@ -436,12 +437,12 @@ + ", fromKey=" + (fromKey == null ? "n/a" : BytesUtil.toString(fromKey)) + ", toKey=" - + (toKey == null ? "n/a" : BytesUtil.toString(toKey) - + ", indexLocalFilter=" - + (indexLocalFilter == null ? "n/a" : indexLocalFilter) - + ", accessPathFilter=" - + (accessPathFilter == null ? "n/a" : accessPathFilter) - + "}"); + + (toKey == null ? "n/a" : BytesUtil.toString(toKey)) + + ", indexLocalFilter=" + + (indexLocalFilter == null ? "n/a" : indexLocalFilter) + + ", accessPathFilter=" + + (accessPathFilter == null ? "n/a" : accessPathFilter) + + "}"; } @@ -1284,4 +1285,23 @@ } + /** + * Return the constant bound on the {@link #getPredicate() predicate} for + * this access path at the specified index -or- {@link #NULL} iff the + * predicate is not bound at that position. + * + * @param index + * The index. + * + * @return Either the bound value -or- {@link #NULL} iff the index is + * unbound for the predicate for this access path. + */ + public Object get(final int index) { + + final IVariableOrConstant<?> t = predicate.get(index); + + return t == null || t.isVar() ? null : t.get(); + + } + } Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/rules/AbstractRuleDistinctTermScan.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/rules/AbstractRuleDistinctTermScan.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/rules/AbstractRuleDistinctTermScan.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -35,7 +35,6 @@ import com.bigdata.bop.IConstraint; import com.bigdata.bop.IVariable; import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.spo.SPOAccessPath; import com.bigdata.rdf.spo.SPOKeyOrder; import com.bigdata.rdf.spo.SPOPredicate; import com.bigdata.rdf.spo.SPORelation; @@ -51,9 +50,8 @@ /** * Base class for rules having a single predicate that is none bound in the tail - * and a single variable in the head. These rules can be evaluated using - * {@link SPOAccessPath#distinctTermScan()} rather than a full index scan. For - * example: + * and a single variable in the head. These rules can be evaluated using a + * distinctTermScan rather than a full index scan. For example: * * <pre> * rdf1: (?u ?a ?y) -> (?a rdf:type rdf:Property) @@ -62,7 +60,8 @@ * </pre> * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ + * @version $Id: AbstractRuleDistinctTermScan.java 3448 2010-08-18 20:55:58Z + * thompsonbry $ */ abstract public class AbstractRuleDistinctTermScan extends Rule { Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/DistinctTermAdvancer.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/DistinctTermAdvancer.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/DistinctTermAdvancer.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -35,10 +35,11 @@ import com.bigdata.btree.keys.SuccessorUtil; import com.bigdata.rdf.internal.IVUtility; import com.bigdata.rdf.store.IRawTripleStore; +import com.bigdata.relation.accesspath.AccessPath; /** * Advances the source {@link ITupleCursor} through the distinct term - * identifiers for some {@link SPOAccessPath}. Each time a new + * identifiers for some {@link AccessPath}. Each time a new * {@link ITuple} is visited, the term identifier for the first position in * that tuple is decoded and its successor is formed. The source * {@link ITupleCursor} is then advanced to the key having that term Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -305,8 +305,7 @@ * statement identifier are not specified. This may be used as a convenience * to extract the {s, p, o, c} from an {@link IPredicate} or from an * {@link IAccessPath} when the predicate is not known to be an - * {@link SPOPredicate} or the {@link IAccessPath} is not known to be an - * {@link SPOAccessPath}. + * {@link SPOPredicate}. * * @param predicate * The predicate. Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOAccessPath.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOAccessPath.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOAccessPath.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -46,94 +46,57 @@ */ public class SPOAccessPath extends AccessPath<ISPO> { -// private SPOTupleSerializer tupleSer; - -// /** Relation (resolved lazily if not specified to the ctor). */ -// private SPORelation relation; - /** - * Variant when the {@link SPORelation} has already been materialized. - * <p> - * Note: Filters should be specified when the {@link IAccessPath} is - * constructed so that they will be evaluated on the data service rather - * than materializing the elements and then filtering them. This can be - * accomplished by adding the filter as a constraint on the predicate when - * specifying the access path. * + * @param relation (optional). + * @param indexManager (required) + * @param timestamp * @param predicate * @param keyOrder * @param ndx * @param flags + * @param chunkOfChunksCapacity + * @param chunkCapacity + * @param fullyBufferedReadThreshold */ public SPOAccessPath(final SPORelation relation, + final IIndexManager indexManager, final long timestamp, final IPredicate<ISPO> predicate, final IKeyOrder<ISPO> keyOrder, final IIndex ndx, final int flags, final int chunkOfChunksCapacity, final int chunkCapacity, final int fullyBufferedReadThreshold) { - super(relation, relation.getIndexManager(), relation.getTimestamp(), + super(relation, indexManager, timestamp, +// relation.getIndexManager(), relation.getTimestamp(), predicate, keyOrder, ndx, flags, chunkOfChunksCapacity, chunkCapacity, fullyBufferedReadThreshold); } - /** - * Variant does not require the {@link SPORelation} to have been - * materialized. This is useful when you want an {@link IAccessPath} for a - * specific index partition. - * - * @param indexManager - * @param timestamp - * @param predicate - * @param keyOrder - * @param ndx - * @param flags - * @param chunkOfChunksCapacity - * @param chunkCapacity - * @param fullyBufferedReadThreshold - */ - public SPOAccessPath(final IIndexManager indexManager, - final long timestamp, final IPredicate<ISPO> predicate, - final IKeyOrder<ISPO> keyOrder, final IIndex ndx, final int flags, - final int chunkOfChunksCapacity, final int chunkCapacity, - final int fullyBufferedReadThreshold) { - - super(null/* relation */, indexManager, timestamp, predicate, keyOrder, - ndx, flags, chunkOfChunksCapacity, chunkCapacity, - fullyBufferedReadThreshold); - - } - - /** - * Return the constant bound on the {@link #getPredicate() predicate} for - * this access path at the specified index -or- {@link #NULL} iff the - * predicate is not bound at that position. - * - * @param index - * The index. - * - * @return Either the bound value -or- {@link #NULL} iff the index is - * unbound for the predicate for this access path. - */ - @SuppressWarnings("unchecked") - public IV get(final int index) { - - final IVariableOrConstant<IV> t = predicate.get(index); - - return t == null || t.isVar() ? null : t.get(); - - } - -// protected SPOTupleSerializer getTupleSerializer() { +// /** +// * Variant does not require the {@link SPORelation} to have been +// * materialized. This is useful when you want an {@link IAccessPath} for a +// * specific index partition. +// * +// * @param indexManager +// * @param timestamp +// * @param predicate +// * @param keyOrder +// * @param ndx +// * @param flags +// * @param chunkOfChunksCapacity +// * @param chunkCapacity +// * @param fullyBufferedReadThreshold +// */ +// public SPOAccessPath(final IIndexManager indexManager, +// final long timestamp, final IPredicate<ISPO> predicate, +// final IKeyOrder<ISPO> keyOrder, final IIndex ndx, final int flags, +// final int chunkOfChunksCapacity, final int chunkCapacity, +// final int fullyBufferedReadThreshold) { // -// if (tupleSer == null) { +// super(null/* relation */, indexManager, timestamp, predicate, keyOrder, +// ndx, flags, chunkOfChunksCapacity, chunkCapacity, +// fullyBufferedReadThreshold); // -// tupleSer = (SPOTupleSerializer) ndx.getIndexMetadata() -// .getTupleSerializer(); -// -// } -// -// return tupleSer; -// // } /** @@ -143,35 +106,12 @@ */ public SPOAccessPath init() { -// final IKeyBuilder keyBuilder = getTupleSerializer().getKeyBuilder(); -// -// setFromKey(((SPOKeyOrder) keyOrder).getFromKey(keyBuilder, predicate)); -// -// setToKey(((SPOKeyOrder) keyOrder).getToKey(keyBuilder, predicate)); - super.init(); return this; } -// /** -// * Resolved lazily if not specified to the ctor. -// */ -// synchronized -// public SPORelation getRelation() { -// -// if (relation == null) { -// -// relation = (SPORelation) indexManager.getResourceLocator().locate( -// predicate.getOnlyRelationName(), timestamp); -// -// } -// -// return relation; -// -// } - /** * Strengthened return type. * <p> @@ -185,18 +125,14 @@ } /** - * Overridden to delegate to - * {@link AbstractTripleStore#removeStatements(IChunkedOrderedIterator)} in - * order to (a) write on all access paths; (b) handle statement identifiers, - * including truth maintenance for statement identifiers; and (c) if - * justifications are being maintained, then retract justifications having - * no support once the statements visitable by this access path have been - * retracted. + * Strengthened return type. + * <p> + * {@inheritDoc} */ @Override - public long removeAll() { + public SPOPredicate getPredicate() { - return getRelation().getContainer().removeStatements(iterator()); + return (SPOPredicate) super.getPredicate(); } @@ -206,13 +142,30 @@ * {@inheritDoc} */ @Override - public SPOPredicate getPredicate() { + @SuppressWarnings("unchecked") + public IV get(final int index) { - return (SPOPredicate) super.getPredicate(); + return (IV) super.get(index); } /** + * Overridden to delegate to + * {@link AbstractTripleStore#removeStatements(IChunkedOrderedIterator)} in + * order to (a) write on all access paths; (b) handle statement identifiers, + * including truth maintenance for statement identifiers; and (c) if + * justifications are being maintained, then retract justifications having + * no support once the statements visitable by this access path have been + * retracted. + */ + @Override + public long removeAll() { + + return getRelation().getContainer().removeStatements(iterator()); + + } + + /** * Return a new {@link SPOAccessPath} where the context position has been * bound to the specified constant. The context position MUST be a variable. * All instances of that variable will be replaced by the specified Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -87,6 +87,7 @@ import com.bigdata.rdf.store.LocalTripleStore; import com.bigdata.relation.AbstractRelation; import com.bigdata.relation.IRelation; +import com.bigdata.relation.accesspath.AccessPath; import com.bigdata.relation.accesspath.ElementFilter; import com.bigdata.relation.accesspath.IAccessPath; import com.bigdata.relation.accesspath.IElementFilter; @@ -1221,9 +1222,9 @@ final ILocalBTreeView ndx = (ILocalBTreeView) indexManager .getIndex(name, timestamp); - return new SPOAccessPath(indexManager, timestamp, predicate, - keyOrder, ndx, flags, getChunkOfChunksCapacity(), - getChunkCapacity(), getFullyBufferedReadThreshold()).init(); + return newAccessPath(this/* relation */, indexManager, timestamp, + predicate, keyOrder, ndx, flags, getChunkOfChunksCapacity(), + getChunkCapacity(), getFullyBufferedReadThreshold()); } @@ -1291,12 +1292,25 @@ final int fullyBufferedReadThreshold = container.getFullyBufferedReadThreshold(); - return new SPOAccessPath(this, predicate, keyOrder, ndx, flags, - chunkOfChunksCapacity, chunkCapacity, - fullyBufferedReadThreshold).init(); - + return newAccessPath(this, getIndexManager(), getTimestamp(), + predicate, keyOrder, ndx, flags, chunkOfChunksCapacity, + chunkCapacity, fullyBufferedReadThreshold); + } - + + @Override + public SPOAccessPath newAccessPath(final IRelation<ISPO> relation, + final IIndexManager indexManager, final long timestamp, + final IPredicate<ISPO> predicate, final IKeyOrder<ISPO> keyOrder, + final IIndex ndx, final int flags, final int chunkOfChunksCapacity, + final int chunkCapacity, final int fullyBufferedReadThreshold) { + + return new SPOAccessPath(this/* relation */, indexManager, timestamp, + predicate, keyOrder, ndx, flags, chunkOfChunksCapacity, + chunkCapacity, fullyBufferedReadThreshold).init(); + + } + // public long getElementCount(boolean exact) { // // final IIndex ndx = getIndex(SPOKeyOrder.SPO); Modified: 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/BigdataEvaluationStrategyImpl.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataEvaluationStrategyImpl.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -1714,6 +1714,13 @@ new Bigdata2Sesame2BindingSetIterator<QueryEvaluationException>( new BigdataBindingSetResolverator(database, it2).start(database .getExecutorService())); + + try { + // Wait for the Future (checks for errors). + runningQuery.get(); + } catch (Exception ex) { + throw new QueryEvaluationException(ex); + } // final boolean backchain = // // tripleSource.getDatabase().getAxioms().isRdfSchema() Modified: 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/BigdataSail.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -133,7 +133,6 @@ import com.bigdata.rdf.spo.ISPO; import com.bigdata.rdf.spo.InferredSPOFilter; import com.bigdata.rdf.spo.SPO; -import com.bigdata.rdf.spo.SPOAccessPath; import com.bigdata.rdf.spo.SPOKeyOrder; import com.bigdata.rdf.spo.SPORelation; import com.bigdata.rdf.store.AbstractTripleStore; @@ -148,6 +147,7 @@ import com.bigdata.rdf.store.ScaleOutTripleStore; import com.bigdata.rdf.store.TempTripleStore; import com.bigdata.rdf.vocab.NoVocabulary; +import com.bigdata.relation.accesspath.AccessPath; import com.bigdata.relation.accesspath.EmptyAccessPath; import com.bigdata.relation.accesspath.IAccessPath; import com.bigdata.relation.accesspath.IElementFilter; @@ -2972,7 +2972,7 @@ /** * Note: The <i>includeInferred</i> argument is applied in two ways. - * First, inferences are stripped out of the {@link SPOAccessPath}. + * First, inferences are stripped out of the {@link AccessPath}. * Second, query time expansion of * <code>foo rdf:type rdfs:Resource</code>, owl:sameAs, etc. * <p> Modified: branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/Striterator.java =================================================================== --- branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/Striterator.java 2010-09-29 16:57:20 UTC (rev 3682) +++ branches/QUADS_QUERY_BRANCH/ctc-striterators/src/java/cutthecrap/utils/striterators/Striterator.java 2010-09-29 19:14:33 UTC (rev 3683) @@ -42,8 +42,8 @@ */ public class Striterator implements IStriterator { volatile List<IFilter> filters = null; // Note: NOT serializable. - private transient Iterator realSource; - private transient Iterator m_src = null; + private volatile Iterator realSource; + private volatile Iterator m_src = null; /** * Deserialization constructor. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |