public class ValueStore extends ValueFactoryBase
Modifier and Type | Field and Description |
---|---|
static int |
NAMESPACE_CACHE_SIZE
The default namespace cache size: 64.
|
static int |
NAMESPACE_ID_CACHE_SIZE
The default namespace id cache size: 32.
|
static int |
VALUE_CACHE_SIZE
The default value cache size: 512.
|
static int |
VALUE_ID_CACHE_SIZE
The default value id cache size: 128.
|
Constructor and Description |
---|
ValueStore(File dataDir) |
ValueStore(File dataDir,
boolean forceSync) |
ValueStore(File dataDir,
boolean forceSync,
int valueCacheSize,
int valueIDCacheSize,
int namespaceCacheSize,
int namespaceIDCacheSize) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all values from the ValueStore.
|
void |
close()
Closes the ValueStore, releasing any file references, etc.
|
NativeBNode |
createBNode(String nodeID)
Creates a new blank node with the given node identifier.
|
NativeLiteral |
createLiteral(String value)
Creates a new literal with the supplied label.
|
NativeLiteral |
createLiteral(String value,
String language)
Creates a new literal with the supplied label and language attribute.
|
NativeLiteral |
createLiteral(String value,
URI datatype)
Creates a new literal with the supplied label and datatype.
|
Statement |
createStatement(Resource subject,
URI predicate,
Value object)
Creates a new statement with the supplied subject, predicate and object.
|
Statement |
createStatement(Resource subject,
URI predicate,
Value object,
Resource context)
Creates a new statement with the supplied subject, predicate and object
and associated context.
|
NativeURI |
createURI(String uri)
Creates a new URI from the supplied string-representation.
|
NativeURI |
createURI(String namespace,
String localName)
Creates a new URI from the supplied namespace and local name.
|
int |
getID(Value value)
Gets the ID for the specified value.
|
NativeBNode |
getNativeBNode(BNode bnode)
Creates a NativeBNode that is equal to the supplied bnode.
|
NativeLiteral |
getNativeLiteral(Literal l)
Creates an NativeLiteral that is equal to the supplied literal.
|
NativeResource |
getNativeResource(Resource resource) |
NativeURI |
getNativeURI(URI uri)
Creates a NativeURI that is equal to the supplied URI.
|
NativeValue |
getNativeValue(Value value) |
Lock |
getReadLock()
Gets a read lock on this value store that can be used to prevent values
from being removed while the lock is active.
|
ValueStoreRevision |
getRevision() |
NativeValue |
getValue(int id)
Gets the value for the specified ID.
|
static void |
main(String[] args) |
int |
storeValue(Value value)
Stores the supplied value and returns the ID that has been assigned to it.
|
void |
sync()
Synchronizes any changes that are cached in memory to disk.
|
createBNode, createFPLiteral, createIntegerLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createNumericLiteral, initBNodeParams
public static final int VALUE_CACHE_SIZE
public static final int VALUE_ID_CACHE_SIZE
public static final int NAMESPACE_CACHE_SIZE
public static final int NAMESPACE_ID_CACHE_SIZE
public ValueStore(File dataDir) throws IOException
IOException
public ValueStore(File dataDir, boolean forceSync) throws IOException
IOException
public ValueStore(File dataDir, boolean forceSync, int valueCacheSize, int valueIDCacheSize, int namespaceCacheSize, int namespaceIDCacheSize) throws IOException
IOException
public ValueStoreRevision getRevision()
public Lock getReadLock() throws InterruptedException
InterruptedException
public NativeValue getValue(int id) throws IOException
id
- A value ID.IOException
- If an I/O error occurred.public int getID(Value value) throws IOException
value
- A value.NativeValue.UNKNOWN_ID
if no such ID could be found.IOException
- If an I/O error occurred.public int storeValue(Value value) throws IOException
value
- The Value to store.IOException
- If an I/O error occurred.public void clear() throws IOException
IOException
- If an I/O error occurred.public void sync() throws IOException
IOException
- If an I/O error occurred.public void close() throws IOException
IOException
- If an I/O error occurred.public NativeURI createURI(String uri)
ValueFactory
uri
- A string-representation of a URI.public NativeURI createURI(String namespace, String localName)
ValueFactory
createURI(namespace+localName)
, but allows the ValueFactory to reuse
supplied namespace and local name strings whenever possible. Note that the
values returned by URI.getNamespace()
and
URI.getLocalName()
are not necessarily the same as the values that
are supplied to this method.namespace
- The URI's namespace.localName
- The URI's local name.public NativeBNode createBNode(String nodeID)
ValueFactory
nodeID
- The blank node identifier.public NativeLiteral createLiteral(String value)
ValueFactory
value
- The literal's label.public NativeLiteral createLiteral(String value, String language)
ValueFactory
value
- The literal's label.language
- The literal's language attribute, or null if the literal
doesn't have a language.public NativeLiteral createLiteral(String value, URI datatype)
ValueFactory
value
- The literal's label.datatype
- The literal's datatype, or null if the literal doesn't
have a datatype.public Statement createStatement(Resource subject, URI predicate, Value object)
ValueFactory
subject
- The statement's subject.predicate
- The statement's predicate.object
- The statement's object.public Statement createStatement(Resource subject, URI predicate, Value object, Resource context)
ValueFactory
subject
- The statement's subject.predicate
- The statement's predicate.object
- The statement's object.context
- The statement's context.public NativeValue getNativeValue(Value value)
public NativeResource getNativeResource(Resource resource)
public NativeURI getNativeURI(URI uri)
public NativeBNode getNativeBNode(BNode bnode)
public NativeLiteral getNativeLiteral(Literal l)
Copyright © 2001-2016 Aduna. All Rights Reserved.