org.openrdf.sesame.sailimpl.sync
Class SyncRdfRepository

java.lang.Object
  extended byorg.openrdf.sesame.sailimpl.sync.SyncRdfRepository
All Implemented Interfaces:
RdfRepository, RdfSource, Sail, StackedSail
Direct Known Subclasses:
SyncRdfSchemaRepository

public class SyncRdfRepository
extends Object
implements RdfRepository, StackedSail

Version:
$Revision: 1.10.2.2 $
Author:
Arjohn Kampman

Constructor Summary
SyncRdfRepository()
           
 
Method Summary
 void addListener(SailChangedListener listener)
           
 void addStatement(Resource subj, URI pred, Value obj)
          Adds a statament to the repository.
 void changeNamespacePrefix(String namespace, String prefix)
          Changes the prefix of a namespace.
 void clearRepository()
          Clears the repository.
 void commitTransaction()
          Commits a started transaction.
 Sail getBaseSail()
          Gets the base Sail that this Sail works on top of.
 NamespaceIterator getNamespaces()
          Gets the prefix and name of all namespaces.
 StatementIterator getStatements(Resource subj, URI pred, Value obj)
          Gets all statements with a specific subject, predicate and/or object.
 ValueFactory getValueFactory()
          Gets a ValueFactory object that can be used to create URI-, blank node- and literal objects.
 boolean hasStatement(Resource subj, URI pred, Value obj)
          Checks whether some statement with a specific subject, predicate and/or object is present in the repository.
 void initialize(Map configParams)
          Initializes the Sail using a set of configuration parameters.
 Query optimizeQuery(Query qc)
          Gives the RdfSource the oportunity to optimize a Query to its specific storage model.
 void removeListener(SailChangedListener listener)
           
 int removeStatements(Resource subj, URI pred, Value obj)
          Removes data statements that match the (subject, predicate, object) pattern from the repository.
 void setBaseSail(Sail sail)
          Sets the base Sail that this Sail will work on top of.
 void shutDown()
          Allow the SAIL to synchronize any stale data.
 void startTransaction()
          Starts a transaction.
 boolean transactionStarted()
          Checks whether a transaction has been started.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncRdfRepository

public SyncRdfRepository()
Method Detail

setBaseSail

public void setBaseSail(Sail sail)
Description copied from interface: StackedSail
Sets the base Sail that this Sail will work on top of. This method will be called before the initialize() method is called.

Specified by:
setBaseSail in interface StackedSail

getBaseSail

public Sail getBaseSail()
Description copied from interface: StackedSail
Gets the base Sail that this Sail works on top of.

Specified by:
getBaseSail in interface StackedSail

initialize

public void initialize(Map configParams)
                throws SailInitializationException
Description copied from interface: Sail
Initializes the Sail using a set of configuration parameters. The relevant names and values of the parameters are determined by the implementation of the interface.

Specified by:
initialize in interface Sail
Parameters:
configParams - A set a configuration parameters.
Throws:
SailInitializationException - If the Sail could not be initialized.

shutDown

public void shutDown()
Description copied from interface: Sail
Allow the SAIL to synchronize any stale data. The SAIL can assume that shutDown() is called before an application is stopped.

Specified by:
shutDown in interface Sail

startTransaction

public void startTransaction()
Description copied from interface: RdfRepository
Starts a transaction. A transaction needs to be started before data can be added to or removed from the repository.

Specified by:
startTransaction in interface RdfRepository

commitTransaction

public void commitTransaction()
Description copied from interface: RdfRepository
Commits a started transaction. A transaction needs to be commited to be guaranteed that data has been added to, or removed from the repository.

Specified by:
commitTransaction in interface RdfRepository

transactionStarted

public boolean transactionStarted()
Description copied from interface: RdfRepository
Checks whether a transaction has been started.

Specified by:
transactionStarted in interface RdfRepository
Returns:
true if a transaction has been started, false otherwise.

addStatement

public void addStatement(Resource subj,
                         URI pred,
                         Value obj)
                  throws SailUpdateException
Description copied from interface: RdfRepository
Adds a statament to the repository. You must start a transaction before this method can be used.

Specified by:
addStatement in interface RdfRepository
Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Throws:
SailUpdateException - If the statement could not be added.
See Also:
RdfRepository.startTransaction()

removeStatements

public int removeStatements(Resource subj,
                            URI pred,
                            Value obj)
                     throws SailUpdateException
Description copied from interface: RdfRepository
Removes data statements that match the (subject, predicate, object) pattern from the repository. All three parameters may be null to indicate wildcards. You must start a transaction before this method can be used.

Specified by:
removeStatements in interface RdfRepository
Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Returns:
the number of statements that have been removed.
Throws:
SailUpdateException - If the statement(s) could not be removed.
See Also:
RdfRepository.startTransaction()

clearRepository

public void clearRepository()
                     throws SailUpdateException
Description copied from interface: RdfRepository
Clears the repository. After the repository was cleared, it will be in the same state as after initialization. You must start a transaction before this method can be used.

Specified by:
clearRepository in interface RdfRepository
Throws:
SailUpdateException - If the repository could not be cleared (for example when a transaction was not started first).

changeNamespacePrefix

public void changeNamespacePrefix(String namespace,
                                  String prefix)
                           throws SailUpdateException
Description copied from interface: RdfRepository
Changes the prefix of a namespace. The new prefix must be unique in the repository; it is not allowed to be associated with any other namespace. You must start a transaction before this method can be used.

Specified by:
changeNamespacePrefix in interface RdfRepository
Parameters:
namespace - The namespace for which the associated prefix should be changed.
prefix - The new prefix.
Throws:
SailUpdateException - If the namespace prefix could not be changed, for example when no transaction was started.

getValueFactory

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

Specified by:
getValueFactory in interface RdfSource
Returns:
a ValueFactory object for this RdfSource instance.

getStatements

public StatementIterator getStatements(Resource subj,
                                       URI pred,
                                       Value obj)
Description copied from interface: RdfSource
Gets all statements with a specific subject, predicate and/or object. All three parameters may be null to indicate wildcards.

Specified by:
getStatements in interface RdfSource
Parameters:
subj - subject of pattern
pred - predicate of pattern
obj - object of pattern
Returns:
iterator over statements

hasStatement

public boolean hasStatement(Resource subj,
                            URI pred,
                            Value obj)
Description copied from interface: RdfSource
Checks whether some statement with a specific subject, predicate and/or object is present in the repository. All three parameters may be null to indicate wildcards.

Specified by:
hasStatement in interface RdfSource
Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Returns:
boolean indicating if specified statement is present

optimizeQuery

public Query optimizeQuery(Query qc)
Description copied from interface: RdfSource
Gives the RdfSource the oportunity to optimize a Query to its specific storage model.

Specified by:
optimizeQuery in interface RdfSource
Parameters:
qc - The Query to optimize.
Returns:
The optimized query.

getNamespaces

public NamespaceIterator getNamespaces()
Description copied from interface: RdfSource
Gets the prefix and name of all namespaces.

Specified by:
getNamespaces in interface RdfSource
Returns:
iterator over namespaces

addListener

public void addListener(SailChangedListener listener)
Specified by:
addListener in interface RdfRepository

removeListener

public void removeListener(SailChangedListener listener)
Specified by:
removeListener in interface RdfRepository


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