Class NativeStore

  • All Implemented Interfaces:
    FederatedServiceResolverClient, org.eclipse.rdf4j.sail.NotifyingSail, org.eclipse.rdf4j.sail.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 Detail

      • NativeStore

        public NativeStore()
        Creates a new NativeStore.
      • NativeStore

        public NativeStore​(File dataDir)
      • NativeStore

        public NativeStore​(File dataDir,
                           String tripleIndexes)
    • Method Detail

      • setDataDir

        public void setDataDir​(File dataDir)
        Specified by:
        setDataDir in interface org.eclipse.rdf4j.sail.Sail
        Overrides:
        setDataDir in class org.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)
      • getFederatedServiceResolver

        public FederatedServiceResolver getFederatedServiceResolver()
        Returns:
        Returns the SERVICE resolver.
      • initializeInternal

        protected void initializeInternal()
                                   throws org.eclipse.rdf4j.sail.SailException
        Initializes this NativeStore.
        Overrides:
        initializeInternal in class org.eclipse.rdf4j.sail.helpers.AbstractSail
        Throws:
        org.eclipse.rdf4j.sail.SailException - If this NativeStore could not be initialized using the parameters that have been set.
      • shutDownInternal

        protected void shutDownInternal()
                                 throws org.eclipse.rdf4j.sail.SailException
        Specified by:
        shutDownInternal in class org.eclipse.rdf4j.sail.helpers.AbstractSail
        Throws:
        org.eclipse.rdf4j.sail.SailException
      • shutDown

        public void shutDown()
                      throws org.eclipse.rdf4j.sail.SailException
        Specified by:
        shutDown in interface org.eclipse.rdf4j.sail.Sail
        Overrides:
        shutDown in class org.eclipse.rdf4j.sail.helpers.AbstractSail
        Throws:
        org.eclipse.rdf4j.sail.SailException
      • isWritable

        public boolean isWritable()
        Specified by:
        isWritable in interface org.eclipse.rdf4j.sail.Sail
      • getConnectionInternal

        protected org.eclipse.rdf4j.sail.NotifyingSailConnection getConnectionInternal()
                                                                                throws org.eclipse.rdf4j.sail.SailException
        Specified by:
        getConnectionInternal in class org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSail
        Throws:
        org.eclipse.rdf4j.sail.SailException
      • getValueFactory

        public org.eclipse.rdf4j.model.ValueFactory getValueFactory()
        Specified by:
        getValueFactory in interface org.eclipse.rdf4j.sail.Sail
      • getTransactionLock

        protected org.eclipse.rdf4j.common.concurrent.locks.Lock getTransactionLock​(org.eclipse.rdf4j.common.transaction.IsolationLevel level)
                                                                             throws org.eclipse.rdf4j.sail.SailException
        This call will block when IsolationLevels.NONE is provided when there are active transactions with a higher isolation and block when a higher isolation is provided when there are active transactions with IsolationLevels.NONE isolation. Store is either exclusively in IsolationLevels.NONE isolation with potentially zero or more transactions, or exclusively in higher isolation mode with potentially zero or more transactions.
        Parameters:
        level - indicating desired mode IsolationLevels.NONE or higher
        Returns:
        Lock used to prevent Store from switching isolation modes
        Throws:
        org.eclipse.rdf4j.sail.SailException