Dataquay::Transaction Class Reference

Interface for reading and writing an RDF Store within the context of an atomic operation such as an editing command. More...

#include <dataquay/Transaction.h>

Inherits Dataquay::Store.

Inherited by Dataquay::TransactionalStore::TSTransaction.

List of all members.

Public Member Functions

virtual ~Transaction ()
 Delete this transaction object, committing the transaction first.
virtual ChangeSet getChanges () const =0
 Return the ChangeSet applied so far by this transaction.
virtual void rollback ()=0
 Roll back this transaction.
virtual bool add (Triple t)=0
 Add a triple to the store.
virtual bool remove (Triple t)=0
 Remove a triple from the store.
virtual void change (ChangeSet changes)=0
 Atomically apply the sequence of add/remove changes described in the given ChangeSet.
virtual void revert (ChangeSet changes)=0
 Atomically apply the sequence of add/remove changes described in the given ChangeSet, in reverse (ie removing adds and adding removes, in reverse order).
virtual bool contains (Triple t) const =0
 Return true if the store contains the given triple, false otherwise.
virtual Triples match (Triple t) const =0
 Return all triples matching the given wildcard triple.
virtual ResultSet query (QString sparql) const =0
 Run a SPARQL query against the store and return its results.
virtual Triple matchFirst (Triple t) const =0
 Return the first triple to match the given wildcard triple.
virtual Node queryFirst (QString sparql, QString bindingName) const =0
 Run a SPARQL query against the store and return the node of the first result for the given query binding.
virtual QUrl getUniqueUri (QString prefix) const =0
 Get a new URI, starting with the given prefix, that does not currently exist within this store.
virtual QUrl expand (QString uri) const =0
 Expand the given URI (which may use local namespaces) and prefix-expand it, returning the result as a QUrl.


Detailed Description

Interface for reading and writing an RDF Store within the context of an atomic operation such as an editing command.

The Transaction interface provides the same editing operations as the Store interface; it subclasses from Store and may be interchanged with Store in most contexts.

Definition at line 51 of file Transaction.h.


Constructor & Destructor Documentation

virtual Dataquay::Transaction::~Transaction (  )  [inline, virtual]

Delete this transaction object, committing the transaction first.

If you do not want the transaction to be committed, call rollback() prior to destruction. You must delete this object before beginning any other transaction.

Definition at line 60 of file Transaction.h.


Member Function Documentation

virtual ChangeSet Dataquay::Transaction::getChanges (  )  const [pure virtual]

Return the ChangeSet applied so far by this transaction.

This returns all changes provisionally made during the transaction.

(Once the transaction is committed and deleted, you can in principle revert it in its entirety by calling Store::revert() with this change set.)

This is undefined if the transaction has been rolled back (it may return the changes prior to rollback, or an empty ChangeSet, or something else).

!!! FIX -- TransactionalStore depends on getChanges returning the changes prior to rollback, in leaveTransactionContext -- it's called after rollback if a transaction is being rolled back

virtual void Dataquay::Transaction::rollback (  )  [pure virtual]

Roll back this transaction.

All changes made during the transaction will be discarded.

You should not attempt to use the Transaction object again (except to delete it) after this call is made. Any further call to the transaction's Store interface will throw an RDFException. When the transaction is deleted, it will simply be discarded rather than being committed.

virtual bool Dataquay::Store::add ( Triple  t  )  [pure virtual, inherited]

Add a triple to the store.

Prefix expansion is performed on URI nodes in the triple. Return false if the triple was already in the store. (Although Redland permits duplicate triples in a store, Dataquay doesn't.) Throw RDFException if the triple can not be added for some other reason.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

Referenced by Dataquay::PropertyObject::setProperty().

virtual bool Dataquay::Store::remove ( Triple  t  )  [pure virtual, inherited]

Remove a triple from the store.

Prefix expansion is performed on URI nodes in the triple. If some nodes in the triple are Nothing nodes, remove all matching triples. Return false if no matching triple was found in the store. Throw RDFException if removal failed for some other reason.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

Referenced by Dataquay::PropertyObject::removeProperty(), and Dataquay::PropertyObject::setProperty().

virtual void Dataquay::Store::change ( ChangeSet  changes  )  [pure virtual, inherited]

Atomically apply the sequence of add/remove changes described in the given ChangeSet.

Throw RDFException if any operation fails for any reason (including duplication etc).

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

virtual void Dataquay::Store::revert ( ChangeSet  changes  )  [pure virtual, inherited]

Atomically apply the sequence of add/remove changes described in the given ChangeSet, in reverse (ie removing adds and adding removes, in reverse order).

Throw RDFException if any operation fails for any reason (including duplication etc).

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

virtual bool Dataquay::Store::contains ( Triple  t  )  const [pure virtual, inherited]

Return true if the store contains the given triple, false otherwise.

Prefix expansion is performed on URI nodes in the triple. Throw RDFException if the triple is not complete or if the test failed for any other reason.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

virtual Triples Dataquay::Store::match ( Triple  t  )  const [pure virtual, inherited]

Return all triples matching the given wildcard triple.

A node of type Nothing in any part of the triple matches any node in the data store. Prefix expansion is performed on URI nodes in the triple. Return an empty list if there are no matches; may throw RDFException if matching fails in some other way.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

virtual ResultSet Dataquay::Store::query ( QString  sparql  )  const [pure virtual, inherited]

Run a SPARQL query against the store and return its results.

Any prefixes added previously using addQueryPrefix will be available in this query without needing to be declared in the SPARQL given here (equivalent to writing "PREFIX prefix: <uri>" for each prefix,uri pair set with addPrefix).

May throw RDFException.

Note that the RDF store must have an absolute base URI (rather than the default "#") in order to perform queries, as relative URIs in the query will be interpreted relative to the query base rather than the store and without a proper base URI there is no way to override that internally.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

virtual Triple Dataquay::Store::matchFirst ( Triple  t  )  const [pure virtual, inherited]

Return the first triple to match the given wildcard triple.

A node of type Nothing in any part of the triple matches any node in the data store. Prefix expansion is performed on URI nodes in the triple. Return an empty triple (three Nothing nodes) if there are no matches. May throw RDFException.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

Referenced by Dataquay::PropertyObject::getProperty(), and Dataquay::PropertyObject::hasProperty().

virtual Node Dataquay::Store::queryFirst ( QString  sparql,
QString  bindingName 
) const [pure virtual, inherited]

Run a SPARQL query against the store and return the node of the first result for the given query binding.

This is a shorthand for use with queries that are only expected to have one result. May throw RDFException.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

virtual QUrl Dataquay::Store::getUniqueUri ( QString  prefix  )  const [pure virtual, inherited]

Get a new URI, starting with the given prefix, that does not currently exist within this store.

The URI will be prefix expanded.

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

virtual QUrl Dataquay::Store::expand ( QString  uri  )  const [pure virtual, inherited]

Expand the given URI (which may use local namespaces) and prefix-expand it, returning the result as a QUrl.

(The QUrl class is not suitable for storing URIs that use namespaces, particularly local ones.)

Implemented in Dataquay::BasicStore, Dataquay::Connection, and Dataquay::TransactionalStore.

Referenced by Dataquay::PropertyObject::getPropertyUri().


The documentation for this class was generated from the following file:

Generated on Thu Sep 24 23:19:49 2009 for Dataquay by  doxygen 1.5.7.1