|
From: <tho...@us...> - 2010-07-27 16:06:10
|
Revision: 3307
http://bigdata.svn.sourceforge.net/bigdata/?rev=3307&view=rev
Author: thompsonbry
Date: 2010-07-27 16:06:03 +0000 (Tue, 27 Jul 2010)
Log Message:
-----------
Cleaned up lots of FIXME's.
Fixed problem with NaNs in xsd:float and xsd:double handling.
Modified Paths:
--------------
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractLiteralIV.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IV.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/XSD.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/XSDDoubleIV.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/XSDFloatIV.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIndexCodes.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/Id2TermWriteProc.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconKeyBuilder.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/Term2IdTupleSerializer.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/magic/IRISUtils.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/relation/rule/BindingSetSortKeyBuilder.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/rio/NQuadsParser.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/JustificationTupleSerializer.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOComparator.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOKeyOrder.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOTupleSerializer.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/TestEncodeDecodeKeys.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPORelation.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/TestAll.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/TestLocalTripleStoreWithoutInlining.java
Added Paths:
-----------
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/BlobOverflowHandler.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/LegacyTermIdUtility.java
Removed Paths:
-------------
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/BlobOverflowHandler.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LegacyTermIdUtility.java
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -171,31 +171,10 @@
* Datatypes namespaces </a>). I propose that we collapse these by default
* onto a canonical datatype URI.
*
- * @todo For a extensible data type which is being projected onto an intrinsic
- * data type we would need both (a) a method to project the RDF Value onto
- * the appropriate intrinsic data type; and (b) a method to materialize an
- * RDF Value from the inline representation.
- * <p>
- * If we put the registrations into their own index, then we could use a
- * more compact representation (the term identifier of the datatype URI is
- * 8 bytes, but we could do with 2 or 4 bytes). Alternatively, we could
- * use the LongPacker to pack an unsigned long integer into as few bytes
- * as possible. This would break the natural ordering across the
- * dataTypeIds, but I can not see how that would matter since the term
- * identifiers are essentially arbitrary anyway so their order has little
- * value.
- *
* @todo Can we inline the language code for a literal? I think that the
* language code must be ASCII and might be restricted to two characters.
* This might use up our {@link DTE#Reserved1} bit.
*
- * @todo One consequences of this refactor is that you must use equals() rather
- * than == to compare internal values, including term identifiers. This
- * boils down to verifying that the two internal values are the same type
- * (same VTE, DTE, etc) and have the same value (termId, long, etc). That
- * can all be done rather quickly, but it is more overhead than testing a
- * == b.
- *
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
* @version $Id: TestEncodeDecodeKeys.java 2753 2010-05-01 16:36:59Z thompsonbry
* $
@@ -346,28 +325,12 @@
}
-// /**
-// * FIXME I think we really need to be able to say from the flags whether
-// * an IV is null or non-null. The context position of statements can
-// * often be null.
-// *
-// * @param flags
-// * The flags byte.
-// */
-// static public boolean isNull(final byte flags) {
-//
-// return false;
-//
-// }
-
/**
* Return <code>true</code> if the flags byte has its <code>extension</code>
* bit set.
*
* @param flags
* The flags byte.
- *
- * @todo unit test for this.
*/
static public boolean isExtension(final byte flags) {
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractLiteralIV.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractLiteralIV.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractLiteralIV.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -34,16 +34,6 @@
* <p>
* {@inheritDoc}
*
- * @todo What are the SPARQL semantics for casting among these datatypes?
- * They should probably be reflected here since that is the real use
- * case. I believe that those casts also require failing a solution if
- * the cast is not legal, in which case these methods might not be all
- * that useful.
- * <p>
- * Also see BigdataLiteralImpl and XMLDatatypeUtil. It handles the
- * conversions by reparsing, but there is no reason to do that here
- * since we have the canonical point in the value space.
- *
* @see http://www.w3.org/TR/rdf-sparql-query/#FunctionMapping, The casting
* rules for SPARQL
*
Deleted: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/BlobOverflowHandler.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/BlobOverflowHandler.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/BlobOverflowHandler.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -1,196 +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;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.log4j.Logger;
-
-import com.bigdata.btree.IOverflowHandler;
-import com.bigdata.btree.ITuple;
-import com.bigdata.btree.keys.KeyBuilder;
-import com.bigdata.io.DataOutputBuffer;
-import com.bigdata.io.IByteArrayBuffer;
-import com.bigdata.rawstore.IBlock;
-import com.bigdata.rawstore.IRawStore;
-
-/**
- * Copies blocks onto the target store during overflow handling. Blocks that are
- * no longer referenced by the file data index will be left behind on the
- * journal and eventually discarded with the journal. The blob reference is a
- * single <code>long</code> integer stored in the value of the tuple and gives
- * the address of the raw record from which the blob may be read on
- * {@link IRawStore} from which the tuple was read.
- *
- * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id: BlobOverflowHandler.java 2265 2009-10-26 12:51:06Z thompsonbry
- * $
- *
- * FIXME {@link IBlock} reads are not finished so this will not work
- * yet. It seems that {@link IBlock} is might stand a refactor so that
- * you get an {@link IByteArrayBuffer} instead of an {@link IBlock}.
- * The remote iterator methods and remote tuple lookup methods (which
- * have not yet been defined) would then use a smart proxy to handle
- * the materialization of the raw record in the caller's JVM. There is
- * no reason to add a streaming interface here since raw records and
- * {@link IOverflowHandler}s are not useful once you get more than a
- * few MB worth of data in the record. At that point you really need to
- * use a REST-ful repository service which stores the data as chunks in
- * the file system (ala BFS, but not trying to store the chunks in the
- * journal or index segment since they are capped at ~200MB each and
- * the file system chunk size might be closer to 64MB).
- *
- * FIXME Move this class to the btree package and integrate into its
- * test suite.
- *
- * FIXME The class of the same name in the BFS package will need to be
- * modified. Per above, BFS will need to store its chunks in the local
- * file system. Therefore the blob reference will have to include the
- * local file name (UUID_chunkNumber_version?) and the chunk will have
- * to be replicated on each node having a given shard of chunks. For
- * BFS, we clearly DO NOT want to move shards around if we can help it
- * since we will have to move a huge amount of data around as well.
- * <p>
- * An alternative is to use a parallel file system to store the chunks,
- * in which case we do not have to worry about replicating the chunks
- * and we can move the shards easily enough since the chunks are
- * elsewhere.
- */
-public class BlobOverflowHandler implements IOverflowHandler {
-
- /**
- *
- */
- private static final long serialVersionUID = 6203072965860516919L;
-
- protected static final transient Logger log = Logger.getLogger(BlobOverflowHandler.class);
-
- /**
- * Sole constructor.
- */
- public BlobOverflowHandler() {
-
- }
-
- /**
- * Lazily initialized by {@link #handle(ITuple, IRawStore)}.
- */
- private transient DataOutputBuffer buf = null;
-
- public void close() {
-
- // release reference to the buffer.
- buf = null;
-
- }
-
- public byte[] handle(final ITuple tuple, final IRawStore target) {
-
- if (buf == null) {
-
- buf = new DataOutputBuffer();
-
- }
-
- /*
- * Decode the blob reference.
- *
- * Note: The blob reference is just the [addr] of the record on the
- * journal or index segment from which that blob reference was read.
- */
- final long addr;
- try {
- addr = tuple.getValueStream().readLong();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- if (addr == 0L) {
- /*
- * Note: empty blocks are allowed and are recorded with 0L as
- * their address.
- */
- return KeyBuilder.asSortKey(0L);
- }
-
- // read block from underlying source store.
- final IBlock block = tuple.readBlock(addr);
-
- // #of bytes in the block.
- final int len = block.length();
-
- // make sure buffer has sufficient capacity.
- buf.ensureCapacity(len);
-
- // prepare buffer for write.
- buf.reset();
-
- // the address on which the block will be written.
- final long addr2;
-
- // read on the source record.
- final InputStream bin = block.inputStream();
- try {
-
- // read source into buffer (will be large enough).
- final int nread = bin.read(buf.array(), 0, len);
-
- if (nread != len) {
-
- throw new RuntimeException("Premature end of block: expected="
- + len + ", actual=" + nread);
-
- }
-
- // write on the target store.
- addr2 = target.write(buf.asByteBuffer());
-
- } catch (IOException ex) {
-
- throw new RuntimeException("Problem copying block: addr=" + addr
- + ", len=" + len, ex);
-
- } finally {
-
- try {
- bin.close();
- } catch (IOException ex) {
- log.warn(ex);
- }
-
- }
-
- /*
- * Format the address of the block on the target store (a long integer)
- * into a byte[] and return that byte[]. This will be the value paired
- * with the tuple in the target resource.
- */
- buf.reset();
- buf.putLong(addr2);
- return buf.toByteArray();
-
- }
-
-}
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DTE.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -30,7 +30,9 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.UUID;
+
import org.openrdf.model.URI;
+
import com.bigdata.rawstore.Bytes;
/**
@@ -76,16 +78,6 @@
*/
public enum DTE {
-// /**
-// * The "inline" value is a term identifier which must be resolved against
-// * the ID2TERM index in the lexicon in order to materialize the
-// * corresponding RDF Value.
-// *
-// * @todo URI for internal term identifiers? (probably not).
-// */
-// TermId((byte) 0, Bytes.SIZEOF_LONG, Long.class, null/* N/A */,
-// DTEFlags.NOFLAGS), //
-
/**
* The "inline" value is a boolean (xsd:boolean). Only the distinct points
* in the xsd:boolean value space are represented. xsd:boolean has multiple
@@ -183,8 +175,6 @@
* The "inline" value is a {@link UUID}.
*
* @see http://lists.xml.org/archives/xml-dev/201003/msg00027.html
- *
- * @todo What is the datatype URI for UUID data types? (bd:UUID)
*/
UUID((byte) 13, Bytes.SIZEOF_UUID, UUID.class, XSD.UUID.stringValue(),
DTEFlags.NOFLAGS), //
@@ -235,8 +225,6 @@
* Note: This masks off everything but the lower 4 bits.
*/
switch (b & 0x0f) {
-// case 0:
-// return TermId;
case 0:
return XSDBoolean;
case 1:
@@ -328,15 +316,6 @@
/**
* The class of the Java object used to represent instances of the coded
* data type.
- *
- * @todo cls extends {@link AbstractIV}? Use {@link TermId} for a
- * term identifier? If blank nodes are inlined, then use a special
- * class for that, otherwise use {@link TermId}? Ditto for SIDs. URIs
- * are never inlined. Datatype literals MAY be inline, depending on
- * the datatype. The unsigned datatypes need to have special handling
- * to avoid problems with math on unsigned values. That special
- * handling could be provided by appropriate subclasses of
- * {@link AbstractLiteralIV}.
*/
private final Class<?> cls;
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -24,8 +24,8 @@
package com.bigdata.rdf.internal;
-import org.openrdf.model.URI;
import org.openrdf.model.Value;
+
import com.bigdata.rdf.model.BigdataValue;
import com.bigdata.rdf.model.BigdataValueFactory;
@@ -97,9 +97,6 @@
//
// /**
// * <code>true</code> iff <code>xsd:decimal</code> should be inlined.
-// *
-// * @todo This option is not yet supported. Combine with XSDInteger for
-// * isBigNumericInline()?
// */
// public boolean isXSDDecimalInline();
//
@@ -111,8 +108,6 @@
// * <p>
// * This option is NOT compatible with
// * {@link AbstractTripleStore.Options#STORE_BLANK_NODES}.
-// *
-// * @todo Separate option to inlined SIDs?
// */
// public boolean isBlankNodeInline();
//
@@ -123,7 +118,7 @@
// public boolean isUUIDInline();
//
// /**
-// * @todo Option to enable storing of long literals (over a configured
+// * Option to enable storing of long literals (over a configured
// * threshold) as blob references. The TERM2ID index would have a
// * hash function (MD5, SHA-1, SHA-2, etc) of the value and assign
// * a termId. The ID2TERM index would map the termId to a blob
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IV.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IV.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IV.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -28,11 +28,11 @@
package com.bigdata.rdf.internal;
import java.io.Serializable;
+
import org.openrdf.model.URI;
import org.openrdf.model.Value;
-import com.bigdata.btree.BytesUtil;
+
import com.bigdata.btree.keys.IKeyBuilder;
-import com.bigdata.btree.keys.SuccessorUtil;
import com.bigdata.rdf.model.BigdataValue;
import com.bigdata.rdf.model.BigdataValueFactory;
import com.bigdata.rdf.store.AbstractTripleStore.Options;
@@ -45,12 +45,6 @@
* The generic type for the RDF {@link Value} implementation.
* @param <T>
* The generic type for the inline value.
- *
- * @todo Consider whether we need the ability to compute the successor of a
- * value in the value space here. There are implementations of successor()
- * for most data types in {@link SuccessorUtil}, including fixed length
- * unsigned byte[]s, and also {@link BytesUtil#successor(byte[])}, which
- * handles variable length unsigned byte[]s.
*/
public interface IV<V extends BigdataValue, T> extends Serializable,
Comparable<IV> {
@@ -201,7 +195,6 @@
* <code>true</code> for xsd:float, xsd:double, and xsd:decimal
*/
boolean isFloatingPointNumeric();
-
/**
* Inflate an inline RDF value to a {@link BigdataValue}. This method DOES
@@ -213,27 +206,11 @@
* The value factory.
* @param config
* The lexicon configuration.
+ *
* @return The corresponding {@link BigdataValue}.
+ *
* @throws UnsupportedOperationException
* unless the RDF value is inline.
- *
- * FIXME Reconcile with BigdataValueImpl and BigdataValue. The
- * role of the valueFactory reference on BigdataValueImpl was to
- * detect when an instance was created by another value factory.
- * The choice of whether or not to inline the value is
- * determined by the lexicon configuration, and that choice is
- * probably captured by a BigdataValueFactory configuration
- * object. Therefore we do need to convert to a different
- * instance when the {@link IV} will be used in a
- * different lexicon configuration context.
- * <P>
- * It would be nice to support shared lexicons for a collection
- * of triple / quad stores. The lexicon would be in the
- * container namespace for that federation of KBs. The
- * individual triple/quad stores would be in the per-KB instance
- * namespace. The collection could have a mixture of triple
- * and/or quad stores since the lexicon does not interact with
- * whether we are using triples or quads (except for SIDs).
*/
V asValue(final BigdataValueFactory vf, final ILexiconConfiguration config)
throws UnsupportedOperationException;
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -194,13 +194,8 @@
*
* @param key
* The byte[].
+ *
* @return The {@link IV}.
- *
- * FIXME handle all of the inline value types.
- *
- * FIXME Construct the InternalValue objects using factory if we
- * will have to scope how the RDF Value is represented to the
- * lexicon relation with which it is associated?
*/
public static IV decode(final byte[] key) {
@@ -215,13 +210,8 @@
* The byte[].
* @param numTerms
* The number of terms to decode.
+ *
* @return The set of {@link IV}s.
- *
- * FIXME handle all of the inline value types.
- *
- * FIXME Construct the InternalValue objects using factory if we
- * will have to scope how the RDF Value is represented to the
- * lexicon relation with which it is associated?
*/
public static IV[] decode(final byte[] key, final int numTerms) {
@@ -255,13 +245,8 @@
*
* @param key
* The byte[].
+ *
* @return The set of {@link IV}s.
- *
- * FIXME handle all of the inline value types.
- *
- * FIXME Construct the InternalValue objects using factory if we
- * will have to scope how the RDF Value is represented to the
- * lexicon relation with which it is associated?
*/
public static IV[] decodeAll(final byte[] key) {
Deleted: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LegacyTermIdUtility.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LegacyTermIdUtility.java 2010-07-27 15:50:21 UTC (rev 3306)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LegacyTermIdUtility.java 2010-07-27 16:06:03 UTC (rev 3307)
@@ -1,249 +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 July 10, 2010
- */
-
-package com.bigdata.rdf.internal;
-
-import org.openrdf.model.BNode;
-import org.openrdf.model.Literal;
-import org.openrdf.model.URI;
-import com.bigdata.btree.keys.IKeyBuilder;
-import com.bigdata.btree.keys.KeyBuilder;
-import com.bigdata.rawstore.Bytes;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
-import com.bigdata.rdf.store.AbstractTripleStore.Options;
-
-class LegacyTermIdUtility implements ITermIdCodes {
-
- /**
- * Return true iff the term identifier is marked as a RDF {@link Literal}.
- * <p>
- * Note: This simply examines the low bits of the term identifier, which
- * marks whether or not the term identifier is a {@link Literal}.
- * <p>
- * Note: Some entailments require the ability to filter based on whether or
- * not a term is a literal. For example, literals may not be entailed into
- * the subject position. This method makes it possible to determine whether
- * or not a term is a literal without materializing the term, thereby
- * allowing the entailments to be computed purely within the term identifier
- * space.
- *
- * @param termId
- * The term identifier.
- *
- * @return <code>true</code> iff the term identifier is marked as an RDF
- * {@link Literal}.
- */
- static final public boolean isLiteral(final long termId) {
-
- return (termId & TERMID_CODE_MASK) == TERMID_CODE_LITERAL;
-
- }
-
- /**
- * Return true iff the term identifier is marked as a RDF {@link BNode}.
- * <p>
- * Note: This simply examines the low bits of the term identifier, which
- * marks whether or not the term identifier is a {@link BNode}.
- *
- * @param termId
- * The term identifier.
- *
- * @return <code>true</code> iff the term identifier is marked as an RDF
- * {@link BNode}.
- */
- static final public boolean isBNode(final long termId) {
-
- return (termId & TERMID_CODE_MASK) == TERMID_CODE_BNODE;
-
- }
-
- /**
- * Return true iff the term identifier is marked as a RDF {@link URI}.
- * <p>
- * Note: This simply examines the low bits of the term identifier, which
- * marks whether or not the term identifier is a {@link URI}.
- *
- * @param termId
- * The term identifier.
- *
- * @return <code>true</code> iff the term identifier is marked as an RDF
- * {@link URI}.
- */
- static final public boolean isURI(final long termId) {
-
- /*
- * Note: The additional != NULL test is necessary for a URI term
- * identifier so that it will not report 'true' for 0L since the two low
- * order bits used to mark a URI are both zero.
- */
-
- return (termId & TERMID_CODE_MASK) == TERMID_CODE_URI && termId != TermId.NULL;
-
- }
-
- /**
- * Return true iff the term identifier identifies a statement (this feature
- * is enabled with {@link Options#STATEMENT_IDENTIFIERS}).
- * <p>
- * Note: This simply examines the low bits of the term identifier, which
- * marks whether or not the term identifier is actually a statement
- * identifier.
- *
- * @param termId
- * The term identifier.
- *
- * @return <code>true</code> iff the term identifier identifies a
- * statement.
- */
- static final public boolean isStatement(final long termId) {
-
- return (termId & TERMID_CODE_MASK) == TERMID_CODE_STATEMENT;
-
- }
-
- /**
- * Return the {@link VTE} identified by the LOW TWO (2)
- * bits in the caller's value.
- *
- * @param b
- * The bit flags.
- * @return The corresponding {@link VTE}.
- */
- static final public VTE VTE(final long l) {
- if (isURI(l))
- return VTE.URI;
- if (isBNode(l))
- return VTE.BNODE;
- if (isLiteral(l))
- return VTE.LITERAL;
- if (isStatement(l))
- return VTE.STATEMENT;
-
- throw new AssertionError(String.valueOf(l));
- }
-
- /**
- * Construct a new style {@link TermId} from an old style long tid. The
- * term type is encoded into the long in the old style long tid and will
- * be converted to a {@link VTE} by this method.
- *
- * @param legacyTid
- * The old style long term identifier. See {@link ITermIdCodes}.
- */
- static final public TermId termId(final long legacyTid) {
-
- if (legacyTid == TermId.NULL)
- return null;
-
- return new TermId(VTE(legacyTid), legacyTid);
-
- }
-
- /**
- * Encode an IV using the old style data scheme, which is to just write the
- * long term identifier without the flags.
- *
- * @param keyBuilder
- * The object used to encode the {@link IV}.
- * @param iv
- * The {@link IV} to encode.
- */
- static final public IKeyBuilder encode(IKeyBuilder keyBuilder, IV iv) {
-
- if (iv.isInline()) {
- throw new IllegalArgumentException();
- }
-
- keyBuilder.append(iv.getTermId());
-
- return keyBuilder;
-
- }
-
- /**
- * Decode an IV using the old style data scheme, which is to just read the
- * long term identifier without any flags.
- *
- * @param key
- * The byte[].
- * @return The {@link IV} or <code>null</code> if the
- * <code>tid == {@link TermId#NULL}</code>.
- */
- static final public TermId decode(byte[] key) {
-
- final long tid = Key...
[truncated message content] |
|
From: <mrp...@us...> - 2010-07-27 21:09:22
|
Revision: 3325
http://bigdata.svn.sourceforge.net/bigdata/?rev=3325&view=rev
Author: mrpersonick
Date: 2010-07-27 21:09:15 +0000 (Tue, 27 Jul 2010)
Log Message:
-----------
getting rid of ITermIdCodes
Modified Paths:
--------------
trunk/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/VTE.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/TermIdEncoder.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/IRawTripleStore.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/LegacyTermIdUtility.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPO.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPORelation.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOTupleSerializer.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOValueCoders.java
Added Paths:
-----------
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIVFilter.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ITermIdCodes.java
Removed Paths:
-------------
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdCodes.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdFilter.java
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/inf/BackchainTypeResourceIterator.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -35,7 +35,7 @@
import com.bigdata.rdf.internal.IV;
import com.bigdata.rdf.internal.TermId;
-import com.bigdata.rdf.lexicon.ITermIdFilter;
+import com.bigdata.rdf.lexicon.ITermIVFilter;
import com.bigdata.rdf.model.StatementEnum;
import com.bigdata.rdf.rules.InferenceEngine;
import com.bigdata.rdf.spo.ExplicitSPOFilter;
@@ -212,7 +212,7 @@
resourceIds = new PushbackIterator<IV>(new MergedOrderedIterator(//
db.getSPORelation().distinctTermScan(SPOKeyOrder.SPO), //
db.getSPORelation().distinctTermScan(SPOKeyOrder.OSP,
- new ITermIdFilter() {
+ new ITermIVFilter() {
private static final long serialVersionUID = 1L;
public boolean isValid(IV iv) {
// filter out literals from the OSP scan.
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/VTE.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/VTE.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/VTE.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -27,7 +27,6 @@
package com.bigdata.rdf.internal;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.lexicon.TermIdEncoder;
/**
@@ -35,15 +34,13 @@
* setting the bit flags used to identify the type of an RDF Value (URI,
* Literal, Blank Node, SID, etc).
*
- * @todo This replaces {@link ITermIdCodes}.
- *
* @todo update {@link TermIdEncoder}. This encodes term identifiers for
* scale-out but moving some bits around. It will be simpler now that the
* term identifier is all bits in the long integer with an additional byte
* prefix to differentiate URI vs Literal vs BNode vs SID and to indicate
* the inline value type (termId vs everything else).
*/
-public enum VTE implements ITermIdCodes {
+public enum VTE {
/** A URI. */
URI((byte) 0x00),
Copied: trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIVFilter.java (from rev 3324, trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdFilter.java)
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIVFilter.java (rev 0)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIVFilter.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -0,0 +1,22 @@
+package com.bigdata.rdf.lexicon;
+
+import java.io.Serializable;
+import com.bigdata.rdf.internal.IV;
+
+/**
+ * Interface for filtering internal values.
+ *
+ * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
+ * @version $Id$
+ */
+public interface ITermIVFilter extends Serializable {
+
+ /**
+ * Return <code>true</code> iff the term {@link IV} should be visited.
+ *
+ * @param iv
+ * The internal value
+ */
+ public boolean isValid(IV iv);
+
+}
\ No newline at end of file
Deleted: trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdCodes.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdCodes.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdCodes.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -1,87 +0,0 @@
-/**
-
-Copyright (C) SYSTAP, LLC 2006-2007. 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 Jan 6, 2008
- */
-
-package com.bigdata.rdf.lexicon;
-
-import org.openrdf.model.BNode;
-import org.openrdf.model.Literal;
-import org.openrdf.model.URI;
-
-/**
- * An interface that defines bit masks that are applied to the low bits of the
- * assigned term identifiers and which indicate directly (without consulting the
- * term index) whether a term is a URI, Literal, BNode, or Statement. This is
- * used to quickly test the type of a term identifier without requiring the term
- * value to be materialized from the {@link LexiconKeyOrder#ID2TERM} index.
- *
- * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
- */
-public interface ITermIdCodes {
-
- /**
- * The bit mask that is bit-wise ANDed with a term identifier in order to
- * reveal the term code (the low two bits of the mask are set).
- *
- * @see #TERMID_CODE_URI
- * @see #TERMID_CODE_BNODE
- * @see #TERMID_CODE_LITERAL
- * @see #TERMID_CODE_STATEMENT
- */
- static final public long TERMID_CODE_MASK = 0x03L;
-
- /**
- * The #of bits in the {@link #TERMID_CODE_MASK} (
- * {@value #TERMID_CODE_MASK_BITS}).
- */
- static final public long TERMID_CODE_MASK_BITS = 2L;
-
- /**
- * The bit value used to indicate that a term identifier stands for a
- * {@link URI}.
- */
- static final public long TERMID_CODE_URI = 0x00L;
-
- /**
- * The bit value used to indicate that a term identifier stands for a
- * {@link BNode}.
- */
- static final public long TERMID_CODE_BNODE = 0x01L;
-
- /**
- * The bit value used to indicate that a term identifier stands for a
- * {@link Literal}.
- */
- static final public long TERMID_CODE_LITERAL = 0x02L;
-
- /**
- * The bit value used to indicate that a term identifier stands for a
- * statement (when support for statement identifiers is enabled).
- */
- static final public long TERMID_CODE_STATEMENT = 0x03L;
-
-}
Deleted: trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdFilter.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdFilter.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdFilter.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -1,31 +0,0 @@
-package com.bigdata.rdf.lexicon;
-
-import java.io.Serializable;
-
-import com.bigdata.rdf.internal.IV;
-import com.bigdata.rdf.internal.TermId;
-import com.bigdata.rdf.store.AbstractTripleStore;
-
-/**
- * Interface for filtering base term identifiers, typically based on the bit
- * flags defined {@link ITermIdCodes}.
- *
- * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
- */
-public interface ITermIdFilter extends Serializable {
-
- /**
- * Return <code>true</code> iff the term identifier should be visited.
- *
- * @param termId
- * The term identifier.
- *
- * @see AbstractTripleStore#isURI(long)
- * @see AbstractTripleStore#isBNode(long)
- * @see AbstractTripleStore#isLiteral(long)
- * @see AbstractTripleStore#isStatement(IV)
- */
- public boolean isValid(IV iv);
-
-}
\ No newline at end of file
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/TermIdEncoder.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/TermIdEncoder.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/TermIdEncoder.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -287,58 +287,58 @@
}
- /**
- * Set the bit flags for the Value type on the 2 low order bits.
- *
- * @param id
- * The encoded term identifier.
- * @param code
- * The term code, which is one of the values defined by
- * {@link ITermIndexCodes}.
- *
- * @return The term identifier with the 2 low order bits set to reflect
- * the term code using the bit flags defined by
- * {@link ITermIdCodes} which correspond to the specified term
- * code.
- */
- public static long setFlags(long id, final byte code) {
+// /**
+// * Set the bit flags for the Value type on the 2 low order bits.
+// *
+// * @param id
+// * The encoded term identifier.
+// * @param code
+// * The term code, which is one of the values defined by
+// * {@link ITermIndexCodes}.
+// *
+// * @return The term identifier with the 2 low order bits set to reflect
+// * the term code using the bit flags defined by
+// * {@link ITermIdCodes} which correspond to the specified term
+// * code.
+// */
+// public static long setFlags(long id, final byte code) {
+//
+// switch (code) {
+//
+// case ITermIndexCodes.TERM_CODE_URI:
+//
+// id |= ITermIdCodes.TERMID_CODE_URI;
+//
+// break;
+//
+// case ITermIndexCodes.TERM_CODE_LIT:
+// case ITermIndexCodes.TERM_CODE_DTL:
+// case ITermIndexCodes.TERM_CODE_LCL:
+//
+// id |= ITermIdCodes.TERMID_CODE_LITERAL;
+//
+// break;
+//
+// case ITermIndexCodes.TERM_CODE_BND:
+//
+// id |= ITermIdCodes.TERMID_CODE_BNODE;
+//
+// break;
+//
+// case ITermIndexCodes.TERM_CODE_STMT:
+//
+// id |= ITermIdCodes.TERMID_CODE_STATEMENT;
+//
+// break;
+//
+// default:
+//
+// throw new AssertionError("Unknown term type: code=" + code);
+//
+// }
+//
+// return id;
+//
+// }
- switch (code) {
-
- case ITermIndexCodes.TERM_CODE_URI:
-
- id |= ITermIdCodes.TERMID_CODE_URI;
-
- break;
-
- case ITermIndexCodes.TERM_CODE_LIT:
- case ITermIndexCodes.TERM_CODE_DTL:
- case ITermIndexCodes.TERM_CODE_LCL:
-
- id |= ITermIdCodes.TERMID_CODE_LITERAL;
-
- break;
-
- case ITermIndexCodes.TERM_CODE_BND:
-
- id |= ITermIdCodes.TERMID_CODE_BNODE;
-
- break;
-
- case ITermIndexCodes.TERM_CODE_STMT:
-
- id |= ITermIdCodes.TERMID_CODE_STATEMENT;
-
- break;
-
- default:
-
- throw new AssertionError("Unknown term type: code=" + code);
-
- }
-
- return id;
-
- }
-
}
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPORelation.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -71,7 +71,7 @@
import com.bigdata.rdf.inf.Justification;
import com.bigdata.rdf.internal.IV;
import com.bigdata.rdf.internal.IVUtility;
-import com.bigdata.rdf.lexicon.ITermIdFilter;
+import com.bigdata.rdf.lexicon.ITermIVFilter;
import com.bigdata.rdf.lexicon.LexiconRelation;
import com.bigdata.rdf.model.StatementEnum;
import com.bigdata.rdf.spo.JustIndexWriteProc.WriteJustificationsProcConstructor;
@@ -1297,7 +1297,7 @@
* fast scans across multiple shards when chunk-wise order is Ok.
*/
public IChunkedIterator<IV> distinctTermScan(
- final IKeyOrder<ISPO> keyOrder, final ITermIdFilter termIdFilter) {
+ final IKeyOrder<ISPO> keyOrder, final ITermIVFilter termIdFilter) {
final FilterConstructor<SPO> filter = new FilterConstructor<SPO>();
@@ -1398,7 +1398,7 @@
*/
public IChunkedIterator<IV> distinctMultiTermScan(
final IKeyOrder<ISPO> keyOrder, final IV[] knownTerms,
- final ITermIdFilter termIdFilter) {
+ final ITermIVFilter termIdFilter) {
final FilterConstructor<SPO> filter = new FilterConstructor<SPO>();
final int nterms = knownTerms.length;
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -80,9 +80,9 @@
import com.bigdata.rdf.internal.IDatatypeURIResolver;
import com.bigdata.rdf.internal.IExtension;
import com.bigdata.rdf.internal.IExtensionFactory;
+import com.bigdata.rdf.internal.ITermIdCodes;
import com.bigdata.rdf.internal.IV;
import com.bigdata.rdf.lexicon.BigdataRDFFullTextIndex;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.lexicon.ITermIndexCodes;
import com.bigdata.rdf.lexicon.ITextIndexer;
import com.bigdata.rdf.lexicon.LexiconRelation;
@@ -192,7 +192,7 @@
*/
abstract public class AbstractTripleStore extends
AbstractResource<IDatabase<AbstractTripleStore>> implements ITripleStore,
- IRawTripleStore, IMutableDatabase<AbstractTripleStore>, ITermIdCodes {
+ IRawTripleStore, IMutableDatabase<AbstractTripleStore> {
final static protected Logger log = Logger.getLogger(ITripleStore.class);
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/IRawTripleStore.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/IRawTripleStore.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/store/IRawTripleStore.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -29,8 +29,8 @@
import org.openrdf.model.Value;
+import com.bigdata.rdf.internal.ITermIdCodes;
import com.bigdata.rdf.internal.IV;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.lexicon.LexiconRelation;
import com.bigdata.rdf.model.BigdataValue;
import com.bigdata.rdf.model.StatementEnum;
Copied: trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ITermIdCodes.java (from rev 3324, trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/ITermIdCodes.java)
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ITermIdCodes.java (rev 0)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ITermIdCodes.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -0,0 +1,89 @@
+/**
+
+Copyright (C) SYSTAP, LLC 2006-2007. 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 Jan 6, 2008
+ */
+
+package com.bigdata.rdf.internal;
+
+import org.openrdf.model.BNode;
+import org.openrdf.model.Literal;
+import org.openrdf.model.URI;
+import com.bigdata.rdf.lexicon.LexiconKeyOrder;
+
+/**
+ * An interface that defines bit masks that are applied to the low bits of the
+ * assigned term identifiers and which indicate directly (without consulting the
+ * term index) whether a term is a URI, Literal, BNode, or Statement. This is
+ * used to quickly test the type of a term identifier without requiring the term
+ * value to be materialized from the {@link LexiconKeyOrder#ID2TERM} index.
+ *
+ * @deprecated completely superseded by the new {@link IV} lexicon refactor
+ * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
+ * @version $Id$
+ */
+public interface ITermIdCodes {
+
+ /**
+ * The bit mask that is bit-wise ANDed with a term identifier in order to
+ * reveal the term code (the low two bits of the mask are set).
+ *
+ * @see #TERMID_CODE_URI
+ * @see #TERMID_CODE_BNODE
+ * @see #TERMID_CODE_LITERAL
+ * @see #TERMID_CODE_STATEMENT
+ */
+ static final public long TERMID_CODE_MASK = 0x03L;
+
+ /**
+ * The #of bits in the {@link #TERMID_CODE_MASK} (
+ * {@value #TERMID_CODE_MASK_BITS}).
+ */
+ static final public long TERMID_CODE_MASK_BITS = 2L;
+
+ /**
+ * The bit value used to indicate that a term identifier stands for a
+ * {@link URI}.
+ */
+ static final public long TERMID_CODE_URI = 0x00L;
+
+ /**
+ * The bit value used to indicate that a term identifier stands for a
+ * {@link BNode}.
+ */
+ static final public long TERMID_CODE_BNODE = 0x01L;
+
+ /**
+ * The bit value used to indicate that a term identifier stands for a
+ * {@link Literal}.
+ */
+ static final public long TERMID_CODE_LITERAL = 0x02L;
+
+ /**
+ * The bit value used to indicate that a term identifier stands for a
+ * statement (when support for statement identifiers is enabled).
+ */
+ static final public long TERMID_CODE_STATEMENT = 0x03L;
+
+}
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/LegacyTermIdUtility.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/LegacyTermIdUtility.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/LegacyTermIdUtility.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -33,7 +33,6 @@
import com.bigdata.btree.keys.IKeyBuilder;
import com.bigdata.btree.keys.KeyBuilder;
import com.bigdata.rawstore.Bytes;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.store.AbstractTripleStore.Options;
class LegacyTermIdUtility implements ITermIdCodes {
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPO.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPO.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPO.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -29,10 +29,10 @@
import junit.framework.TestCase2;
import com.bigdata.io.ByteArrayBuffer;
+import com.bigdata.rdf.internal.ITermIdCodes;
import com.bigdata.rdf.internal.IV;
import com.bigdata.rdf.internal.TermId;
import com.bigdata.rdf.internal.VTE;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.model.StatementEnum;
import com.bigdata.rdf.store.IRawTripleStore;
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPORelation.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPORelation.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPORelation.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -30,10 +30,10 @@
import java.util.Properties;
import com.bigdata.rdf.axioms.NoAxioms;
+import com.bigdata.rdf.internal.ITermIdCodes;
import com.bigdata.rdf.internal.IV;
import com.bigdata.rdf.internal.TermId;
import com.bigdata.rdf.internal.VTE;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.model.StatementEnum;
import com.bigdata.rdf.rules.RuleContextEnum;
import com.bigdata.rdf.store.AbstractTripleStore;
@@ -96,8 +96,7 @@
* test the term id bits.
*/
private static TermId uriId(long in) {
- return new TermId(VTE.URI, in << ITermIdCodes.TERMID_CODE_MASK_BITS
- | ITermIdCodes.TERMID_CODE_URI);
+ return new TermId(VTE.URI, in);
}
// private static long literalId(long in) {
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOTupleSerializer.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOTupleSerializer.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOTupleSerializer.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -52,9 +52,9 @@
import com.bigdata.btree.BytesUtil;
import com.bigdata.btree.IRangeQuery;
import com.bigdata.btree.ITupleSerializer;
+import com.bigdata.rdf.internal.ITermIdCodes;
import com.bigdata.rdf.internal.TermId;
import com.bigdata.rdf.internal.VTE;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.model.StatementEnum;
/**
@@ -123,7 +123,7 @@
*
* Note: Only explicit statements may have statement identifiers.
*/
- final TermId sid = new TermId(VTE.STATEMENT, 1 << 2 | ITermIdCodes.TERMID_CODE_STATEMENT);
+ final TermId sid = new TermId(VTE.STATEMENT, 1);
{
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOValueCoders.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOValueCoders.java 2010-07-27 20:24:50 UTC (rev 3324)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/spo/TestSPOValueCoders.java 2010-07-27 21:09:15 UTC (rev 3325)
@@ -42,9 +42,9 @@
import com.bigdata.io.AbstractFixedByteArrayBuffer;
import com.bigdata.io.DataOutputBuffer;
import com.bigdata.io.FixedByteArrayBuffer;
+import com.bigdata.rdf.internal.ITermIdCodes;
import com.bigdata.rdf.internal.TermId;
import com.bigdata.rdf.internal.VTE;
-import com.bigdata.rdf.lexicon.ITermIdCodes;
import com.bigdata.rdf.lexicon.LexiconRelation;
import com.bigdata.rdf.model.StatementEnum;
@@ -99,8 +99,7 @@
protected TermId getSID() {
- return new TermId(VTE.STATEMENT, (r.nextInt(Integer.MAX_VALUE - 1) + 1) << 2
- | ITermIdCodes.TERMID_CODE_STATEMENT);
+ return new TermId(VTE.STATEMENT, (r.nextInt(Integer.MAX_VALUE - 1) + 1));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tho...@us...> - 2010-08-03 15:13:24
|
Revision: 3401
http://bigdata.svn.sourceforge.net/bigdata/?rev=3401&view=rev
Author: thompsonbry
Date: 2010-08-03 15:13:17 +0000 (Tue, 03 Aug 2010)
Log Message:
-----------
Bug fix for https://sourceforge.net/apps/trac/bigdata/ticket/136 (bulk loaded does not support inlining of values).
I also turned the EDS test suite back on with this change set. We currently only run the bulk loader's test suite against the EDS mode, so it was not being executed by CI. Once we get CI against a single-node cluster running, this should be changed to run against the full cluster rather than the EDS mode (EmbeddedDataService).
Modified Paths:
--------------
trunk/bigdata-rdf/src/java/com/bigdata/rdf/rio/AsynchronousStatementBufferFactory.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/rio/AbstractRIOTestCase.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/rio/small.rdf
trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/AbstractTestCase.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/TestAll.java
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/rio/AsynchronousStatementBufferFactory.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/rio/AsynchronousStatementBufferFactory.java 2010-08-03 15:11:09 UTC (rev 3400)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/rio/AsynchronousStatementBufferFactory.java 2010-08-03 15:13:17 UTC (rev 3401)
@@ -116,7 +116,6 @@
import com.bigdata.rdf.spo.SPORelation;
import com.bigdata.rdf.spo.SPOTupleSerializer;
import com.bigdata.rdf.store.AbstractTripleStore;
-import com.bigdata.rdf.store.IRawTripleStore;
import com.bigdata.rdf.store.ScaleOutTripleStore;
import com.bigdata.relation.accesspath.BlockingBuffer;
import com.bigdata.relation.accesspath.IBuffer;
@@ -2803,11 +2802,28 @@
*/
@SuppressWarnings("unchecked")
static <V extends BigdataValue> IChunkedIterator<V> newT2IdIterator(
+ final LexiconRelation r,
final Iterator<V> itr, final int chunkSize) {
- return new ChunkedWrappedIterator(new Striterator(itr), chunkSize,
- BigdataValue.class);
+ return new ChunkedWrappedIterator(new Striterator(itr)
+ .addFilter(new Filter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected boolean isValid(final Object obj) {
+ /*
+ * Assigns the IV as a side effect iff the RDF Value can
+ * be inlined according to the governing lexicon
+ * configuration and returns true iff the value CAN NOT
+ * be inlined. Thus, inlining is doing as a side effect
+ * while the caller sees only those Values which need to
+ * be written onto the TERM2ID index.
+ */
+ return r.getInlineIV((Value) obj) == null;
+ }
+ }), chunkSize, BigdataValue.class);
+
}
/**
@@ -3064,6 +3080,13 @@
}
+ if (v.getIV().isInline()) {
+
+ // Do not write inline values on the reverse index.
+ continue;
+
+ }
+
final byte[] key = v.getIV().encode(tmp.reset())
.getKey();
@@ -3767,8 +3790,10 @@
try {
final Callable<Void> task = new AsyncTerm2IdIndexWriteTask(
- tidsLatch, lexiconRelation, newT2IdIterator(values
- .values().iterator(), producerChunkSize),
+ tidsLatch, lexiconRelation, newT2IdIterator(//
+ lexiconRelation,//
+ values.values().iterator(),//
+ producerChunkSize),
buffer_t2id);
// queue chunks onto the write buffer.
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/rio/AbstractRIOTestCase.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/rio/AbstractRIOTestCase.java 2010-08-03 15:11:09 UTC (rev 3400)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/rio/AbstractRIOTestCase.java 2010-08-03 15:13:17 UTC (rev 3401)
@@ -683,7 +683,8 @@
new FileInputStream(resource))), baseURI, rdfFormat,
options);
- log.info("End of reparse: nerrors=" + nerrs + ", file="
+ if(log.isInfoEnabled())
+ log.info("End of reparse: nerrors=" + nerrs + ", file="
+ resource);
}
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/rio/small.rdf
===================================================================
(Binary files differ)
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/AbstractTestCase.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/AbstractTestCase.java 2010-08-03 15:11:09 UTC (rev 3400)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/AbstractTestCase.java 2010-08-03 15:13:17 UTC (rev 3401)
@@ -912,8 +912,8 @@
* @param maxerrors
* The maximum #of errors before the test will abort.
*/
- public StatementVerifier(AbstractTripleStore db, int capacity,
- AtomicInteger nerrs, final int maxerrors) {
+ public StatementVerifier(final AbstractTripleStore db, final int capacity,
+ final AtomicInteger nerrs, final int maxerrors) {
super(db.getValueFactory());
@@ -927,7 +927,7 @@
Statement.class, null/* filter */) {
@Override
- protected long flush(int n, Statement[] a) {
+ protected long flush(final int n, final Statement[] a) {
verifyStatements( n , a );
@@ -945,7 +945,7 @@
* @param msg
* The error message.
*/
- private void error(String msg) {
+ private void error(final String msg) {
log.error(msg);
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/TestAll.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/TestAll.java 2010-08-03 15:11:09 UTC (rev 3400)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/store/TestAll.java 2010-08-03 15:13:17 UTC (rev 3401)
@@ -83,8 +83,12 @@
// suite.addTest( TestScaleOutTripleStoreWithLocalDataServiceFederation.suite() );
-// suite.addTest(com.bigdata.rdf.store.TestScaleOutTripleStoreWithEmbeddedFederation
-// .suite());
+/*
+ * @todo We should run this test suite against a CI cluster on a single machine using
+ * the full bigdata federation rather than EDS.
+ */
+ suite.addTest(com.bigdata.rdf.store.TestScaleOutTripleStoreWithEmbeddedFederation
+ .suite());
// if (Boolean.parseBoolean(System.getProperty("maven.test.services.skip",
// "false"))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mrp...@us...> - 2010-08-05 17:57:07
|
Revision: 3415
http://bigdata.svn.sourceforge.net/bigdata/?rev=3415&view=rev
Author: mrpersonick
Date: 2010-08-05 17:57:00 +0000 (Thu, 05 Aug 2010)
Log Message:
-----------
eliminated use of non-final variables and hacked in a late initialization
Modified Paths:
--------------
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtension.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtensionFactory.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java
trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ColorsEnumExtension.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/EpochExtension.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/SampleExtensionFactory.java
trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/TestEncodeDecodeKeys.java
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -9,17 +9,12 @@
public DefaultExtensionFactory() {
- extensions = new IExtension[] {
- };
+ extensions = new IExtension[0];
}
- public void resolveDatatypes(final IDatatypeURIResolver resolver) {
+ public void init(final IDatatypeURIResolver resolver) {
- for (IExtension extension : extensions) {
- extension.resolveDatatype(resolver);
- }
-
}
public IExtension[] getExtensions() {
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtension.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtension.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtension.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -40,14 +40,14 @@
*/
public interface IExtension<V extends BigdataValue> {
- /**
- * This will be called very early in the IExtension lifecycle so that the
- * {@link TermId} for the datatype URI will be on hand when needed.
- *
- * @param resolver
- * the datatype URI resolver
- */
- void resolveDatatype(final IDatatypeURIResolver resolver);
+// /**
+// * This will be called very early in the IExtension lifecycle so that the
+// * {@link TermId} for the datatype URI will be on hand when needed.
+// *
+// * @param resolver
+// * the datatype URI resolver
+// */
+// void resolveDatatype(final IDatatypeURIResolver resolver);
/**
* Return the fully resolved datatype in the form of a {@link BigdataURI}
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtensionFactory.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtensionFactory.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/IExtensionFactory.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -42,7 +42,7 @@
* @param resolver
* the datatype URI resolver
*/
- void resolveDatatypes(final IDatatypeURIResolver resolver);
+ void init(final IDatatypeURIResolver resolver);
/**
* Return the supported extensions.
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/ILexiconConfiguration.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -64,6 +64,15 @@
V asValue(final ExtensionIV iv, final BigdataValueFactory vf);
/**
+ * Initialize the extensions, which need to resolve their datatype URIs
+ * into term ids.
+ *
+ * @param resolver
+ * the datatype URI resolver
+ */
+ void initExtensions(final IDatatypeURIResolver resolver);
+
+ /**
* <code>true</code> iff the <code>vte</code> and <code>dte</code>
* should be inlined.
*
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/internal/LexiconConfiguration.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -30,6 +30,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+import org.apache.log4j.Logger;
import org.openrdf.model.BNode;
import org.openrdf.model.Literal;
import org.openrdf.model.URI;
@@ -40,33 +41,58 @@
import com.bigdata.rdf.model.BigdataValueFactory;
/**
- * An object which describes which kinds of RDF Values are inlined into the statement indices and how other RDF Values are coded into the lexicon.
+ * An object which describes which kinds of RDF Values are inlined into the
+ * statement indices and how other RDF Values are coded into the lexicon.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
* @version $Id$
*/
-public class LexiconConfiguration<V extends BigdataValue> implements ILexiconConfiguration<V> {
+public class LexiconConfiguration<V extends BigdataValue>
+ implements ILexiconConfiguration<V> {
+ protected static final Logger log =
+ Logger.getLogger(LexiconConfiguration.class);
+
private final boolean inlineLiterals, inlineBNodes;
+ private final IExtensionFactory xFactory;
+
private final Map<TermId, IExtension> termIds;
private final Map<String, IExtension> datatypes;
-
- public LexiconConfiguration(final boolean inlineLiterals, final boolean inlineBNodes, final IExtensionFactory xFactory) {
+
+ public LexiconConfiguration(final boolean inlineLiterals,
+ final boolean inlineBNodes, final IExtensionFactory xFactory) {
+
this.inlineLiterals = inlineLiterals;
this.inlineBNodes = inlineBNodes;
-
+ this.xFactory = xFactory;
+
termIds = new HashMap<TermId, IExtension>();
datatypes = new HashMap<String, IExtension>();
- for (IExtension extension : xFactory.getExtensions()) {
- BigdataURI datatype = extension.getDatatype();
- if (datatype == null)
- continue;
- termIds.put((TermId) datatype.getIV(), extension);
- datatypes.put(datatype.stringValue(), extension);
+
+ }
+
+ public void initExtensions(final IDatatypeURIResolver resolver) {
+
+ xFactory.init(resolver);
+
+ /*
+ * Hacky way to know we haven't been initialized yet without using
+ * non-final variables.
+ */
+ if (termIds.size() == 0 && xFactory.getExtensions().length > 0) {
+
+ for (IExtension extension : xFactory.getExtensions()) {
+ BigdataURI datatype = extension.getDatatype();
+ if (datatype == null)
+ continue;
+ termIds.put((TermId) datatype.getIV(), extension);
+ datatypes.put(datatype.stringValue(), extension);
+ }
+
}
-
+
}
public V asValue(final ExtensionIV iv, final BigdataValueFactory vf) {
@@ -92,10 +118,11 @@
if (datatypes.containsKey(datatype.stringValue())) {
+ final IExtension xFactory =
+ datatypes.get(datatype.stringValue());
+
try {
- final IExtension xFactory = datatypes.get(datatype.stringValue());
-
final IV iv = xFactory.createIV(value);
if (iv != null && value instanceof BigdataValue)
@@ -105,6 +132,9 @@
} catch (Exception ex) {
+ log.warn("problem creating inline internal value for " +
+ "extension datatype: " + value.stringValue());
+
/*
* Some sort of parse error in the literal value most
* likely. Resort to term identifiers.
@@ -172,6 +202,8 @@
// some dummy doesn't know how to format a number
// default to term identifier for this term
+ log.warn("number format exception: " + v);
+
}
if (iv != null && value instanceof BigdataValue)
Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java
===================================================================
--- trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/lexicon/LexiconRelation.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -397,12 +397,6 @@
determineExtensionFactoryClass();
final IExtensionFactory xFactory = xfc.newInstance();
- /*
- * Allow the extensions to resolve their datatype URIs into
- * term identifiers.
- */
- xFactory.resolveDatatypes(this);
-
lexiconConfiguration = new LexiconConfiguration(
inlineLiterals, inlineBNodes, xFactory);
@@ -2679,6 +2673,15 @@
//
// }
+ /*
+ * Allow the extensions to resolve their datatype URIs into
+ * term identifiers. Unfortunately no way to tell whether to call this
+ * or not without using non-final variables. The configuration will
+ * have to be responsible for determining whether they are initialized
+ * or not (again using only final variables). Hacky.
+ */
+ lexiconConfiguration.initExtensions(this);
+
return lexiconConfiguration;
}
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ColorsEnumExtension.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ColorsEnumExtension.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/ColorsEnumExtension.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -44,18 +44,14 @@
*/
public transient static final URI COLOR = new URIImpl(BD.NAMESPACE + "Color");
- private BigdataURI color;
+ private final BigdataURI color;
- public ColorsEnumExtension() {
+ public ColorsEnumExtension(final IDatatypeURIResolver resolver) {
- }
-
- public void resolveDatatype(final IDatatypeURIResolver resolver) {
-
this.color = resolver.resolve(COLOR);
}
-
+
public BigdataURI getDatatype() {
return color;
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/EpochExtension.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/EpochExtension.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/EpochExtension.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -46,17 +46,14 @@
*/
public transient static final URI EPOCH = new URIImpl(BD.NAMESPACE + "Epoch");
- private BigdataURI epoch;
+ private final BigdataURI epoch;
- public EpochExtension() {
- }
-
- public void resolveDatatype(final IDatatypeURIResolver resolver) {
-
+ public EpochExtension(final IDatatypeURIResolver resolver) {
+
this.epoch = resolver.resolve(EPOCH);
}
-
+
public BigdataURI getDatatype() {
return epoch;
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/SampleExtensionFactory.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/SampleExtensionFactory.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/SampleExtensionFactory.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -1,5 +1,8 @@
package com.bigdata.rdf.internal;
+import java.util.Collection;
+import java.util.LinkedList;
+
/**
* Simple {@link IExtensionFactory} implementation that creates two
* {@link IExtension}s - the {@link EpochExtension} and the
@@ -7,28 +10,29 @@
*/
public class SampleExtensionFactory implements IExtensionFactory {
- private final IExtension[] extensions;
+ private final Collection<IExtension> extensions;
+ private volatile IExtension[] extensionsArray;
+
public SampleExtensionFactory() {
- extensions = new IExtension[] {
- new EpochExtension(),
- new ColorsEnumExtension()
- };
-
+ extensions = new LinkedList<IExtension>();
+
}
- public void resolveDatatypes(final IDatatypeURIResolver resolver) {
-
- for (IExtension extension : extensions) {
- extension.resolveDatatype(resolver);
+ public void init(final IDatatypeURIResolver resolver) {
+
+ if (extensions.size() == 0) {
+ extensions.add(new EpochExtension(resolver));
+ extensions.add(new ColorsEnumExtension(resolver));
+ extensionsArray = extensions.toArray(new IExtension[2]);
}
}
public IExtension[] getExtensions() {
- return extensions;
+ return extensionsArray;
}
Modified: trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/TestEncodeDecodeKeys.java
===================================================================
--- trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/TestEncodeDecodeKeys.java 2010-08-05 16:29:44 UTC (rev 3414)
+++ trunk/bigdata-rdf/src/test/com/bigdata/rdf/internal/TestEncodeDecodeKeys.java 2010-08-05 17:57:00 UTC (rev 3415)
@@ -720,8 +720,8 @@
final BigdataValueFactory vf = BigdataValueFactoryImpl.getInstance("test");
- EpochExtension<BigdataValue> ext = new EpochExtension<BigdataValue>();
- ext.resolveDatatype(new IDatatypeURIResolver() {
+ EpochExtension<BigdataValue> ext =
+ new EpochExtension<BigdataValue>(new IDatatypeURIResolver() {
public BigdataURI resolve(URI uri) {
BigdataURI buri = vf.createURI(uri.stringValue());
buri.setIV(new TermId(VTE.URI, 1024));
@@ -743,8 +743,8 @@
final BigdataValueFactory vf = BigdataValueFactoryImpl.getInstance("test");
- ColorsEnumExtension<BigdataValue> ext = new ColorsEnumExtension<BigdataValue>();
- ext.resolveDatatype(new IDatatypeURIResolver() {
+ ColorsEnumExtension<BigdataValue> ext =
+ new ColorsEnumExtension<BigdataValue>(new IDatatypeURIResolver() {
public BigdataURI resolve(URI uri) {
BigdataURI buri = vf.createURI(uri.stringValue());
buri.setIV(new TermId(VTE.URI, 1024));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|