org.openrdf.sesame.sailimpl.nativerdf
Class ValueStore

java.lang.Object
  extended byorg.openrdf.sesame.sailimpl.nativerdf.ValueStore
All Implemented Interfaces:
ValueFactory

public class ValueStore
extends Object
implements ValueFactory

Class that provides indexed storage and retrieval of RDF values.


Constructor Summary
ValueStore(File dataDir, NamespaceStore namespaceStore, NativeRdfRepository repository)
           
 
Method Summary
 void clear()
          Removes all values from the ValueStore.
 void close()
          Closes the ValueStore, releasing any file references, etc.
 void commitTransaction()
          Commits a transaction, applying all updates that have been performed during the transaction.
 BNode createBNode()
          Creates a new bNode.
 BNode createBNode(String nodeId)
          creates a new bNode with the given node identifier.
 Literal createLiteral(String value)
          Creates a new literal with the supplied value.
 Literal createLiteral(String value, String language)
          Creates a new literal with the supplied value and language attribute.
 Literal createLiteral(String value, URI datatype)
          Creates a new literal with the supplied value and datatype.
 Statement createStatement(Resource subject, URI predicate, Value object)
          Creates a new statement with the supplied subject, predicate and object.
 URI createURI(String uri)
          Creates a new URI from the supplied string-representation.
 URI createURI(String namespace, String localName)
          Creates a new URI that will get the supplied namespace and local name.
 int getID(Value value)
          Gets the ID for the specified value.
 int getID(Value value, boolean dirtyReads)
           
 Value getValue(int id)
          Gets the value for the specified ID.
static void main(String[] args)
           
 void rollbackTransaction()
          Rolls back all updates that have been performed in the current transaction and closes it.
 void startTransaction()
          Starts a transaction.
 int storeValue(Value value)
          Stores the supplied value and returns the ID that has been assigned to it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueStore

public ValueStore(File dataDir,
                  NamespaceStore namespaceStore,
                  NativeRdfRepository repository)
           throws IOException
Method Detail

getValue

public Value getValue(int id)
               throws IOException
Gets the value for the specified ID.

Parameters:
id - A value ID.
Returns:
The value for the ID, or null no such value could be found.
Throws:
IOException - If an I/O error occurred.

getID

public int getID(Value value)
          throws IOException
Gets the ID for the specified value.

Parameters:
value - A value.
Returns:
The ID for the specified value, or 0 if no such ID could be found.
Throws:
IOException - If an I/O error occurred.

getID

public int getID(Value value,
                 boolean dirtyReads)
          throws IOException
Throws:
IOException

startTransaction

public void startTransaction()
                      throws IOException
Starts a transaction. This prepares the ValueStore for upcoming updates to the stored data.

Throws:
IOException - If an I/O error occurred.

commitTransaction

public void commitTransaction()
                       throws IOException
Commits a transaction, applying all updates that have been performed during the transaction.

Throws:
IOException - If an I/O error occurred.

rollbackTransaction

public void rollbackTransaction()
                         throws IOException
Rolls back all updates that have been performed in the current transaction and closes it.

Throws:
IOException - If an I/O error occurred.

storeValue

public int storeValue(Value value)
               throws IOException
Stores the supplied value and returns the ID that has been assigned to it. In case the value was already present, the value will not be stored again and the ID of the existing value is returned. This method can only be called as part of a transaction. The supplied value will not be stored until the transaction has been committed.

Parameters:
value - The Value to store.
Returns:
The ID that has been assigned to the value.
Throws:
IOException - If an I/O error occurred.
See Also:
startTransaction(), commitTransaction()

clear

public void clear()
           throws IOException
Removes all values from the ValueStore. This method can only be called as part of a transaction. The ValueStore will not be cleared until the transaction is committed.

Throws:
IOException - If an I/O error occurred.
See Also:
startTransaction(), commitTransaction()

close

public void close()
           throws IOException
Closes the ValueStore, releasing any file references, etc. In case a transaction is currently open, it will be rolled back. Once closed, the ValueStore can no longer be used.

Throws:
IOException - If an I/O error occurred.

createURI

public URI createURI(String uri)
Description copied from interface: ValueFactory
Creates a new URI from the supplied string-representation.

Specified by:
createURI in interface ValueFactory
Parameters:
uri - A string-representation of a URI.
Returns:
An object representing the URI.

createURI

public URI createURI(String namespace,
                     String localName)
Description copied from interface: ValueFactory
Creates a new URI that will get the supplied namespace and local name.

Specified by:
createURI in interface ValueFactory
Parameters:
namespace - A namespace.
localName - A legal local name. A legal local name adheres to the definition of an NCName as specified at http://www.w3.org/TR/REC-xml-names/#NT-NCName.

createBNode

public BNode createBNode()
Description copied from interface: ValueFactory
Creates a new bNode.

Specified by:
createBNode in interface ValueFactory
Returns:
An object representing the bNode.

createBNode

public BNode createBNode(String nodeId)
Description copied from interface: ValueFactory
creates a new bNode with the given node identifier.

Specified by:
createBNode in interface ValueFactory
Parameters:
nodeId - the bnode identifier
Returns:
an object representing the bnode.

createLiteral

public Literal createLiteral(String value)
Description copied from interface: ValueFactory
Creates a new literal with the supplied value.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The literal's value.

createLiteral

public Literal createLiteral(String value,
                             String language)
Description copied from interface: ValueFactory
Creates a new literal with the supplied value and language attribute.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The literal's value.
language - The literal's language attribute, or null if the literal doesn't have a language.

createLiteral

public Literal createLiteral(String value,
                             URI datatype)
Description copied from interface: ValueFactory
Creates a new literal with the supplied value and datatype.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The literal's value.
datatype - The literal's datatype, or null if the literal doesn't have a datatype.

createStatement

public Statement createStatement(Resource subject,
                                 URI predicate,
                                 Value object)
Description copied from interface: ValueFactory
Creates a new statement with the supplied subject, predicate and object.

Specified by:
createStatement in interface ValueFactory
Parameters:
subject - The statement's subject.
predicate - The statement's predicate.
object - The statement's object.
Returns:
The created statement.

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.