org.openrdf.sesame.sail
Interface RdfRepository

All Superinterfaces:
RdfSource, Sail
All Known Subinterfaces:
RdfSchemaRepository
All Known Implementing Classes:
NativeRdfRepository, RdfRepository, RdfRepository, RdfSchemaRepository, RdfSchemaRepository, SecuritySail, SyncRdfRepository, SyncRdfSchemaRepository

public interface RdfRepository
extends RdfSource

An extension of the read-only RdfSource interface that adds methods to add data to, and remove data from RDF repositories.

Version:
$Revision: 1.6.2.2 $
Author:
Arjohn Kampman

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.
 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 startTransaction()
          Starts a transaction.
 boolean transactionStarted()
          Checks whether a transaction has been started.
 
Methods inherited from interface org.openrdf.sesame.sail.RdfSource
getNamespaces, getStatements, getValueFactory, hasStatement, optimizeQuery
 
Methods inherited from interface org.openrdf.sesame.sail.Sail
initialize, shutDown
 

Method Detail

startTransaction

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

Throws:
SailInternalException - To indicate an internal error.

commitTransaction

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

Throws:
SailInternalException - To indicate an internal error.

transactionStarted

public boolean transactionStarted()
Checks whether a transaction has been started.

Returns:
true if a transaction has been started, false otherwise.
Throws:
SailInternalException - To indicate an internal error.

addStatement

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

Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Throws:
SailUpdateException - If the statement could not be added.
SailInternalException - To indicate an internal error.
See Also:
startTransaction()

removeStatements

public int removeStatements(Resource subj,
                            URI pred,
                            Value obj)
                     throws SailUpdateException
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.

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.
SailInternalException - To indicate an internal error.
See Also:
startTransaction()

clearRepository

public void clearRepository()
                     throws SailUpdateException
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.

Throws:
SailUpdateException - If the repository could not be cleared (for example when a transaction was not started first).
SailInternalException - To indicate an internal error.

changeNamespacePrefix

public void changeNamespacePrefix(String namespace,
                                  String prefix)
                           throws SailUpdateException
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.

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.
SailInternalException - To indicate an internal error.

addListener

public void addListener(SailChangedListener listener)

removeListener

public void removeListener(SailChangedListener listener)


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