com.bigdata.rdf.store
Class TempTripleStore

java.lang.Object
  extended by com.bigdata.relation.AbstractResource<IDatabase<AbstractTripleStore>>
      extended by com.bigdata.rdf.store.AbstractTripleStore
          extended by com.bigdata.rdf.store.AbstractLocalTripleStore
              extended by com.bigdata.rdf.store.TempTripleStore
All Implemented Interfaces:
IRawTripleStore, IDatabase<AbstractTripleStore>, IMutableDatabase<AbstractTripleStore>, IMutableResource<IDatabase<AbstractTripleStore>>, ILocatableResource<IDatabase<AbstractTripleStore>>

public class TempTripleStore
extends AbstractLocalTripleStore

A temporary triple store based on the bigdata architecture. Data is buffered in memory but will overflow to disk for large stores. The backing store is a TemporaryStore.

Note: the TempTripleStore declares indices that do NOT support isolation. This offers a significant performance boost when you do not need transactions or the ability to purge historical data versions from the store as they age.

Note: Users of the TempTripleStore may find it worthwhile to turn off a variety of options in order to minimize the time and space burden of the temporary store depending on the use which will be made of it, including AbstractTripleStore.Options.LEXICON and AbstractTripleStore.Options.ONE_ACCESS_PATH.

Note: Multiple KBs MAY be created in the backing TemporaryStore but all MUST be assigned the TemporaryRawStore.getUUID() as their prefix in order to avoid possible conflicts within a global namespace. This is especially important when the relations in the TemporaryStore are resolvable by an IBigdataFederation or Journal.

Note: This class is often used to support inference. When so used, the statement indices are populated with the term identifiers from the main database and the SPORelation in the TempTripleStore is disabled using AbstractTripleStore.Options.LEXICON.

Note: If you want an in-memory ITripleStore that supports commit and abort then use a LocalTripleStore and specify Options.BUFFER_MODE as BufferMode.Temporary or as BufferMode.Transient if you want the triple store to begin in memory and overflow to disk if necessary. Both of these configurations provide full concurrency control and group commit.

Version:
$Id: TempTripleStore.java 4633 2011-06-06 16:01:07Z thompsonbry $
Author:
Bryan Thompson

Nested Class Summary
static interface TempTripleStore.Options
           
 
Field Summary
 
Fields inherited from class com.bigdata.rdf.store.AbstractTripleStore
lexicon
 
Fields inherited from interface com.bigdata.rdf.store.IRawTripleStore
NULLSTR
 
Constructor Summary
TempTripleStore(IIndexManager indexManager, String namespace, Long timestamp, Properties properties)
          Ctor specified by DefaultResourceLocator.
TempTripleStore(Properties properties)
          Deprecated. by TempTripleStore(TemporaryStore, Properties, AbstractTripleStore) which permits you to reuse the same backing TemporaryStore instance until it becomes full.
TempTripleStore(Properties properties, AbstractTripleStore db)
          Deprecated. Use TempTripleStore(TemporaryStore, Properties, AbstractTripleStore) instead and provide the TemporaryStore reference returned by IIndexStore.getTempStore(). This has the advantage of reusing a single shared TemporaryStore instance until it becomes "large" and then allocating a new instance (note that each instance will consume a direct ByteBuffer from the DirectBufferPool). This is especially important for operations like TruthMaintenance which have to create a lot of temporary stores.
TempTripleStore(TemporaryStore store, Properties properties, AbstractTripleStore db)
          Variant for creating a(nother) TempTripleStore on the same TemporaryStore.
 
Method Summary
 void abort()
          Not supported.
 void close()
          Causes the TempTripleStore to be AbstractTripleStore.destroy()ed, but does not reclaim space in the backing TemporaryStore and does not close the backing TemporaryStore.
 long commit()
          NOP.
 TemporaryStore getIndexManager()
          Return the object used to locate indices, relations, and relation containers and to execute operations on those resources.
 boolean isConcurrent()
          This store is NOT safe for concurrent operations on an ITx.UNISOLATED index.
 boolean isStable()
          True iff the backing store is stable (exists on disk somewhere and may be closed and re-opened).
 
Methods inherited from class com.bigdata.rdf.store.AbstractLocalTripleStore
getLocalBTreeBytesWritten
 
Methods inherited from class com.bigdata.rdf.store.AbstractTripleStore
__tearDownUnitTest, addNamespace, addStatement, addStatement, addStatements, addStatements, addStatements, addStatements, addTerm, addTerms, assertWritable, asStatement, asStatementIterator, asValue, bulkCompleteStatements, bulkCompleteStatements, bulkCompleteStatements, bulkFilterStatements, bulkFilterStatements, clearNamespaces, computeClosureForStatementIdentifiers, copyStatements, copyStatements, create, destroy, determineAxiomClass, determineVocabularyClass, dumpStatements, dumpStore, dumpStore, dumpStore, dumpStore, dumpStore, fixPointStatementIdentifiers, getAccessPath, getAccessPath, getAccessPath, getAccessPath, getAccessPath, getAccessPath, getAccessPath, getAccessPath, getAccessPath, getAccessPath, getAxioms, getBNodeCount, getClosureInstance, getDataLoader, getExplicitStatementCount, getInferenceEngine, getIV, getJustificationCount, getLexiconRelation, getLiteralCount, getMatchProgram, getNamedGraphCount, getNamespace, getNamespaces, getSPOKeyArity, getSPORelation, getStatement, getStatement, getStatement, getStatement, getStatement, getStatementCount, getStatementCount, getStatementCount, getStatementCount, getStatementIdentifiers, getStatements, getStatements, getTerm, getTermCount, getURICount, getValueFactory, getVocabulary, hasStatement, hasStatement, hasStatement, hasStatement, init, isAxiom, isConstrainXXXCShards, isInlineLiterals, isJustify, isOpen, isQuads, isReadOnly, isStatementIdentifiers, match, newJoinNexusFactory, newJoinNexusFactory, newJoinNexusFactory, predicateUsage, predicateUsage, relations, removeNamespace, removeStatements, removeStatements, removeStatements, removeStatements, removeStatements, shutdown, toString, toString, toString, toString
 
Methods inherited from class com.bigdata.relation.AbstractResource
acquireExclusiveLock, getBareProperties, getChunkCapacity, getChunkOfChunksCapacity, getChunkTimeout, getCommitTime, getContainer, getContainerNamespace, getExecutorService, getFullyBufferedReadThreshold, getMaxParallelSubqueries, getNamespace, getProperties, getProperty, getProperty, getTimestamp, isForceSerialExecution, toString, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bigdata.relation.locator.ILocatableResource
getContainerNamespace, getNamespace, getTimestamp
 

Constructor Detail

TempTripleStore

public TempTripleStore(Properties properties)
Deprecated. by TempTripleStore(TemporaryStore, Properties, AbstractTripleStore) which permits you to reuse the same backing TemporaryStore instance until it becomes full.

Create a transient ITripleStore backed by a new TemporaryStore.

Parameters:
properties - See TempTripleStore.Options.

TempTripleStore

public TempTripleStore(Properties properties,
                       AbstractTripleStore db)
Deprecated. Use TempTripleStore(TemporaryStore, Properties, AbstractTripleStore) instead and provide the TemporaryStore reference returned by IIndexStore.getTempStore(). This has the advantage of reusing a single shared TemporaryStore instance until it becomes "large" and then allocating a new instance (note that each instance will consume a direct ByteBuffer from the DirectBufferPool). This is especially important for operations like TruthMaintenance which have to create a lot of temporary stores.

Create a transient ITripleStore backed by a new TemporaryStore. The ITripleStore will default its properties based on those specified for the optional db and then override those defaults using the given properties.

Note: This variant is especially useful when the TempTripleStore will have its own lexicon and you need it to be compatible with the lexicon for the db.

Note: When db is non-null, the relations on the TempTripleStore will be locatable by the specified db.

Parameters:
properties - Overrides for the database's properties.
db - The optional database (a) will establish the defaults for the TempTripleStore; and (b) will be able to locate relations declared on the backing TemporaryStore.

TempTripleStore

public TempTripleStore(TemporaryStore store,
                       Properties properties,
                       AbstractTripleStore db)
Variant for creating a(nother) TempTripleStore on the same TemporaryStore. The TempTripleStore will have its own namespace.

Parameters:
store - The TemporaryStore.
properties - Overrides for the database's properties.
db - The optional database (a) will establish the defaults for the TempTripleStore; and (b) will be able to locate relations declared on the backing TemporaryStore.

TempTripleStore

public TempTripleStore(IIndexManager indexManager,
                       String namespace,
                       Long timestamp,
                       Properties properties)
Ctor specified by DefaultResourceLocator.

Parameters:
indexManager -
namespace -
timestamp -
properties -
Method Detail

getIndexManager

public TemporaryStore getIndexManager()
Description copied from class: AbstractResource
Return the object used to locate indices, relations, and relation containers and to execute operations on those resources.

Note: For scale-out, this is always the federation's index manager NOT the data service local index manager. This is an artifact of how we resolve the metadata for the relation against the global row store.

Overrides:
getIndexManager in class AbstractResource<IDatabase<AbstractTripleStore>>
Returns:
The IIndexManager.

commit

public final long commit()
NOP.

Note: since multiple TempTripleStores may be created on the same backing TemporaryStore it is NOT safe to perform a TemporaryStore#checkpoint(). There is no coordination of write access to the indices so the checkpoint can not be atomic. Therefore this method is a NOP and abort() will throw an exception.

Overrides:
commit in class AbstractTripleStore
Returns:
commit time if store supports commit timestamps

abort

public final void abort()
Not supported.

Overrides:
abort in class AbstractTripleStore
Throws:
UnsupportedOperationException

isStable

public final boolean isStable()
Description copied from class: AbstractTripleStore
True iff the backing store is stable (exists on disk somewhere and may be closed and re-opened).

Note: This is mainly used by the test suites.

Specified by:
isStable in class AbstractTripleStore

close

public final void close()
Causes the TempTripleStore to be AbstractTripleStore.destroy()ed, but does not reclaim space in the backing TemporaryStore and does not close the backing TemporaryStore.

Overrides:
close in class AbstractTripleStore

isConcurrent

public boolean isConcurrent()
This store is NOT safe for concurrent operations on an ITx.UNISOLATED index. However, it does support concurrent readers on the ITx.READ_COMMITTED view of an index.

Specified by:
isConcurrent in class AbstractTripleStore


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.