org.openrdf.sail.nativerdf
Class NativeStore

java.lang.Object
  extended by org.openrdf.sail.helpers.SailBase
      extended by org.openrdf.sail.helpers.NotifyingSailBase
          extended by org.openrdf.sail.nativerdf.NativeStore
All Implemented Interfaces:
NotifyingSail, Sail

public class NativeStore
extends NotifyingSailBase

A SAIL implementation using B-Tree indexing on disk for storing and querying its data.

Author:
Arjohn Kampman, jeen

Field Summary
 
Fields inherited from class org.openrdf.sail.helpers.SailBase
connectionTimeOut, DEFAULT_CONNECTION_TIMEOUT, initializationLock, logger
 
Constructor Summary
NativeStore()
          Creates a new NativeStore.
NativeStore(File dataDir)
           
NativeStore(File dataDir, String tripleIndexes)
           
 
Method Summary
protected  double cardinality(Resource subj, URI pred, Value obj, Resource context)
           
protected  CloseableIteration<? extends Statement,IOException> createStatementIterator(Resource subj, URI pred, Value obj, boolean includeInferred, boolean readTransaction, Resource... contexts)
          Creates a statement iterator based on the supplied pattern.
protected  NotifyingSailConnection getConnectionInternal()
          Returns a store-specific SailConnection object.
protected  CloseableIteration<Resource,IOException> getContextIDs(boolean readTransaction)
           
protected  List<Integer> getContextIDs(Resource... contexts)
           
 boolean getForceSync()
           
protected  org.openrdf.sail.nativerdf.NamespaceStore getNamespaceStore()
           
protected  Lock getTransactionLock()
           
 String getTripleIndexes()
           
protected  org.openrdf.sail.nativerdf.TripleStore getTripleStore()
           
 ValueFactory getValueFactory()
          Gets a ValueFactory object that can be used to create URI-, blank node-, literal- and statement objects.
protected  ValueStore getValueStore()
           
protected  void initializeInternal()
          Initializes this NativeStore.
 boolean isWritable()
          Checks whether this Sail object is writable, i.e.
 void setForceSync(boolean forceSync)
          Specifiec whether updates should be synced to disk forcefully, must be called before initialization.
 void setNamespaceCacheSize(int namespaceCacheSize)
           
 void setNamespaceIDCacheSize(int namespaceIDCacheSize)
           
 void setTripleIndexes(String tripleIndexes)
          Sets the triple indexes for the native store, must be called before initialization.
 void setValueCacheSize(int valueCacheSize)
           
 void setValueIDCacheSize(int valueIDCacheSize)
           
protected  void shutDownInternal()
          Do store-specific operations to ensure proper shutdown of the store.
 
Methods inherited from class org.openrdf.sail.helpers.NotifyingSailBase
addSailChangedListener, getConnection, notifySailChanged, removeSailChangedListener
 
Methods inherited from class org.openrdf.sail.helpers.SailBase
connectionClosed, debugEnabled, getDataDir, initialize, isInitialized, setDataDir, shutDown, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openrdf.sail.Sail
getDataDir, initialize, setDataDir, shutDown
 

Constructor Detail

NativeStore

public NativeStore()
Creates a new NativeStore.


NativeStore

public NativeStore(File dataDir)

NativeStore

public NativeStore(File dataDir,
                   String tripleIndexes)
Method Detail

setTripleIndexes

public void setTripleIndexes(String tripleIndexes)
Sets the triple indexes for the native store, must be called before initialization.

Parameters:
tripleIndexes - An index strings, e.g. spoc,posc.

getTripleIndexes

public String getTripleIndexes()

setForceSync

public void setForceSync(boolean forceSync)
Specifiec whether updates should be synced to disk forcefully, must be called before initialization. Enabling this feature may prevent corruption in case of events like power loss, but can have a severe impact on write performance. By default, this feature is disabled.


getForceSync

public boolean getForceSync()

setValueCacheSize

public void setValueCacheSize(int valueCacheSize)

setValueIDCacheSize

public void setValueIDCacheSize(int valueIDCacheSize)

setNamespaceCacheSize

public void setNamespaceCacheSize(int namespaceCacheSize)

setNamespaceIDCacheSize

public void setNamespaceIDCacheSize(int namespaceIDCacheSize)

initializeInternal

protected void initializeInternal()
                           throws SailException
Initializes this NativeStore.

Overrides:
initializeInternal in class SailBase
Throws:
SailException - If this NativeStore could not be initialized using the parameters that have been set.

shutDownInternal

protected void shutDownInternal()
                         throws SailException
Description copied from class: SailBase
Do store-specific operations to ensure proper shutdown of the store.

Specified by:
shutDownInternal in class SailBase
Throws:
SailException

isWritable

public boolean isWritable()
Description copied from interface: Sail
Checks whether this Sail object is writable, i.e. if the data contained in this Sail object can be changed.


getConnectionInternal

protected NotifyingSailConnection getConnectionInternal()
                                                 throws SailException
Description copied from class: SailBase
Returns a store-specific SailConnection object.

Specified by:
getConnectionInternal in class NotifyingSailBase
Returns:
A connection to the store.
Throws:
SailException

getValueFactory

public ValueFactory getValueFactory()
Description copied from interface: Sail
Gets a ValueFactory object that can be used to create URI-, blank node-, literal- and statement objects.

Returns:
a ValueFactory object for this Sail object.

getTripleStore

protected org.openrdf.sail.nativerdf.TripleStore getTripleStore()

getValueStore

protected ValueStore getValueStore()

getNamespaceStore

protected org.openrdf.sail.nativerdf.NamespaceStore getNamespaceStore()

getTransactionLock

protected Lock getTransactionLock()
                           throws SailException
Throws:
SailException

getContextIDs

protected List<Integer> getContextIDs(Resource... contexts)
                               throws IOException
Throws:
IOException

getContextIDs

protected CloseableIteration<Resource,IOException> getContextIDs(boolean readTransaction)
                                                          throws IOException
Throws:
IOException

createStatementIterator

protected CloseableIteration<? extends Statement,IOException> createStatementIterator(Resource subj,
                                                                                      URI pred,
                                                                                      Value obj,
                                                                                      boolean includeInferred,
                                                                                      boolean readTransaction,
                                                                                      Resource... contexts)
                                                                               throws IOException
Creates a statement iterator based on the supplied pattern.

Parameters:
subj - The subject of the pattern, or null to indicate a wildcard.
pred - The predicate of the pattern, or null to indicate a wildcard.
obj - The object of the pattern, or null to indicate a wildcard.
contexts - The context(s) of the pattern. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository.
Returns:
A StatementIterator that can be used to iterate over the statements that match the specified pattern.
Throws:
IOException

cardinality

protected double cardinality(Resource subj,
                             URI pred,
                             Value obj,
                             Resource context)
                      throws IOException
Throws:
IOException


Copyright © 2001-2012 Aduna. All Rights Reserved.