Package org.eclipse.rdf4j.sail.nativerdf
Class NativeStore
- java.lang.Object
-
- org.eclipse.rdf4j.sail.helpers.AbstractSail
-
- org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSail
-
- org.eclipse.rdf4j.sail.nativerdf.NativeStore
-
- All Implemented Interfaces:
FederatedServiceResolverClient,NotifyingSail,Sail
- Direct Known Subclasses:
LimitedSizeNativeStore
public class NativeStore extends org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSail implements FederatedServiceResolverClient
A SAIL implementation using B-Tree indexing on disk for storing and querying its data.The NativeStore is designed for datasets between 100,000 and 100 million triples. On most operating systems, if there is sufficient physical memory, the NativeStore will act like the MemoryStore, because the read/write commands will be cached by the OS. This technique allows the NativeStore to operate quite well for millions of triples.
- Author:
- Arjohn Kampman, jeen
-
-
Constructor Summary
Constructors Constructor Description NativeStore()Creates a new NativeStore.NativeStore(File dataDir)NativeStore(File dataDir, String tripleIndexes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Supplier<org.eclipse.rdf4j.collection.factory.api.CollectionFactory>getCollectionFactory()protected NotifyingSailConnectiongetConnectionInternal()EvaluationStrategyFactorygetEvaluationStrategyFactory()FederatedServiceResolvergetFederatedServiceResolver()booleangetForceSync()protected org.eclipse.rdf4j.common.concurrent.locks.LockgetTransactionLock(org.eclipse.rdf4j.common.transaction.IsolationLevel level)This call will block whenIsolationLevels.NONEis provided when there are active transactions with a higher isolation and block when a higher isolation is provided when there are active transactions withIsolationLevels.NONEisolation.StringgetTripleIndexes()org.eclipse.rdf4j.model.ValueFactorygetValueFactory()protected voidinitializeInternal()Initializes this NativeStore.booleanisWritable()voidsetDataDir(File dataDir)voidsetEvaluationStrategyFactory(EvaluationStrategyFactory factory)Sets theEvaluationStrategyto use.voidsetFederatedServiceResolver(FederatedServiceResolver resolver)Overrides theFederatedServiceResolverused by this instance, but the given resolver is not shutDown when this instance is.voidsetForceSync(boolean forceSync)Specifies whether updates should be synced to disk forcefully, must be called before initialization.voidsetNamespaceCacheSize(int namespaceCacheSize)voidsetNamespaceIDCacheSize(int namespaceIDCacheSize)voidsetTripleIndexes(String tripleIndexes)Sets the triple indexes for the native store, must be called before initialization.voidsetValueCacheSize(int valueCacheSize)voidsetValueIDCacheSize(int valueIDCacheSize)voidshutDown()protected voidshutDownInternal()-
Methods inherited from class org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSail
addSailChangedListener, getConnection, notifySailChanged, removeSailChangedListener
-
Methods inherited from class org.eclipse.rdf4j.sail.helpers.AbstractSail
addSupportedIsolationLevel, connectionClosed, debugEnabled, getDataDir, getDefaultIsolationLevel, getDefaultQueryEvaluationMode, getIterationCacheSyncThreshold, getSupportedIsolationLevels, init, isInitialized, isTrackResultSize, removeSupportedIsolationLevel, setConnectionTimeOut, setDefaultIsolationLevel, setDefaultQueryEvaluationMode, setIterationCacheSyncThreshold, setSupportedIsolationLevels, setSupportedIsolationLevels, setTrackResultSize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.sail.Sail
getDataDir, getDefaultIsolationLevel, getSupportedIsolationLevels, init
-
-
-
-
Method Detail
-
setDataDir
public void setDataDir(File dataDir)
- Specified by:
setDataDirin interfaceSail- Overrides:
setDataDirin classorg.eclipse.rdf4j.sail.helpers.AbstractSail
-
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)
Specifies 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)
-
getEvaluationStrategyFactory
public EvaluationStrategyFactory getEvaluationStrategyFactory()
- Returns:
- Returns the
EvaluationStrategy.
-
setEvaluationStrategyFactory
public void setEvaluationStrategyFactory(EvaluationStrategyFactory factory)
Sets theEvaluationStrategyto use.
-
getFederatedServiceResolver
public FederatedServiceResolver getFederatedServiceResolver()
- Specified by:
getFederatedServiceResolverin interfaceFederatedServiceResolverClient- Returns:
- Returns the SERVICE resolver.
-
setFederatedServiceResolver
public void setFederatedServiceResolver(FederatedServiceResolver resolver)
Overrides theFederatedServiceResolverused by this instance, but the given resolver is not shutDown when this instance is.- Specified by:
setFederatedServiceResolverin interfaceFederatedServiceResolverClient- Parameters:
resolver- The SERVICE resolver to set.
-
initializeInternal
protected void initializeInternal() throws SailExceptionInitializes this NativeStore.- Overrides:
initializeInternalin classorg.eclipse.rdf4j.sail.helpers.AbstractSail- Throws:
SailException- If this NativeStore could not be initialized using the parameters that have been set.
-
shutDownInternal
protected void shutDownInternal() throws SailException- Specified by:
shutDownInternalin classorg.eclipse.rdf4j.sail.helpers.AbstractSail- Throws:
SailException
-
shutDown
public void shutDown() throws SailException- Specified by:
shutDownin interfaceSail- Overrides:
shutDownin classorg.eclipse.rdf4j.sail.helpers.AbstractSail- Throws:
SailException
-
isWritable
public boolean isWritable()
- Specified by:
isWritablein interfaceSail
-
getConnectionInternal
protected NotifyingSailConnection getConnectionInternal() throws SailException
- Specified by:
getConnectionInternalin classorg.eclipse.rdf4j.sail.helpers.AbstractNotifyingSail- Throws:
SailException
-
getValueFactory
public org.eclipse.rdf4j.model.ValueFactory getValueFactory()
- Specified by:
getValueFactoryin interfaceSail
-
getTransactionLock
protected org.eclipse.rdf4j.common.concurrent.locks.Lock getTransactionLock(org.eclipse.rdf4j.common.transaction.IsolationLevel level) throws SailExceptionThis call will block whenIsolationLevels.NONEis provided when there are active transactions with a higher isolation and block when a higher isolation is provided when there are active transactions withIsolationLevels.NONEisolation. Store is either exclusively inIsolationLevels.NONEisolation with potentially zero or more transactions, or exclusively in higher isolation mode with potentially zero or more transactions.- Parameters:
level- indicating desired modeIsolationLevels.NONEor higher- Returns:
- Lock used to prevent Store from switching isolation modes
- Throws:
SailException
-
getCollectionFactory
public Supplier<org.eclipse.rdf4j.collection.factory.api.CollectionFactory> getCollectionFactory()
- Specified by:
getCollectionFactoryin interfaceSail
-
-