org.openrdf.sesame.sailimpl.rdbms
Class RdfRepository

java.lang.Object
  extended byorg.openrdf.sesame.sailimpl.rdbms.RdfSource
      extended byorg.openrdf.sesame.sailimpl.rdbms.RdfRepository
All Implemented Interfaces:
RdfRepository, RdfSource, Sail, TableNames, ValueFactory
Direct Known Subclasses:
RdfSchemaRepository

public class RdfRepository
extends RdfSource
implements RdfRepository, TableNames

A portable implementation of the RdfRepository interface for relational databases, based on (a subset of) the SQL2/SQL92 standard. This class defines the update methods. The superclass RdfSource defines the read-only methods.

Author:
Arjohn Kampman

Field Summary
 
Fields inherited from class org.openrdf.sesame.sailimpl.rdbms.RdfSource
JDBC_DRIVER_KEY, JDBC_URL_KEY, KEY_EXPORT_FLAGS, KEY_SCHEMACREATOR, KEY_SCHEMAVERSION, PASSWORD_KEY, USER_KEY, VALUE_DIRTY, VALUE_UP_TO_DATE
 
Fields inherited from interface org.openrdf.sesame.sailimpl.rdbms.TableNames
ADDED_TRIPLES_TABLE, ALL_INFERRED_TABLE, ALL_NEW_TRIPLES_TABLE, CLASS_TABLE, DEPEND_TABLE, DIRECT_SUBCLASSOF_TABLE, DIRECT_SUBPROPERTYOF_TABLE, DOMAIN_TABLE, EXPIRED_LITERALS_TABLE, EXPIRED_RESOURCES_TABLE, EXPIRED_TRIPLES_TABLE, EXPIRED_VALUES_TABLE, GROUNDED_TRIPLES_TABLE, INFERRED_TABLE, INSTANCEOF_TABLE, LITERALS_TABLE, NAMESPACES_TABLE, NEW_GROUNDED_TRIPLES_TABLE, NEW_TRIPLES_TABLE, PROPER_INSTANCEOF_TABLE, PROPERTY_TABLE, RANGE_TABLE, RAW_TRIPLES_TABLE, REP_INFO_TABLE, RESOURCES_TABLE, SUBCLASSOF_TABLE, SUBPROPERTYOF_TABLE, TRIPLES_TABLE
 
Constructor Summary
RdfRepository()
           
 
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 initialize(Map configParams)
          Initializes the Sail using a set of configuration parameters.
 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 class org.openrdf.sesame.sailimpl.rdbms.RdfSource
createBNode, createBNode, createLiteral, createLiteral, createLiteral, createStatement, createURI, createURI, getLiteral, getNamespaces, getResource, getStatements, getStatements, getValue, getValueFactory, hasStatement, hasStatement, initialize, initialize, optimizeQuery, shutDown
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openrdf.sesame.sail.RdfSource
getNamespaces, getStatements, getValueFactory, hasStatement, optimizeQuery
 
Methods inherited from interface org.openrdf.sesame.sail.Sail
shutDown
 

Constructor Detail

RdfRepository

public RdfRepository()
Method Detail

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
Overrides:
initialize in class RdfSource
Parameters:
configParams - configuration parameters
Throws:
SailInitializationException - If the RdfSource could not be initialized using the supplied parameters.
See Also:
Sail.initialize(java.util.Map)

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

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()

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

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.

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.