java.lang.Object
org.apache.jena.sparql.core.TransactionalLock
org.apache.jena.sparql.core.TxnDataset2Graph
- All Implemented Interfaces:
Transactional
A
Transactional that passes the transaction operations down to transactions on
independent graphs.
There are limitations:
- we can't atomically do all the commits together in the crash situation.
- This
Transactionalmaintains a MRSW policy because that is all that is required of graphs in general.
DatasetGraphOne) where the one
graph is an InfGraph and should work when the graphs in the dataset is not changing or
when a new memory graph is added mid-transaction.
This is not "nested transactions" - there is no overall "commit" or "abort". If failure/restart occurs, some graphs may have committed and others not. It is the best that can be done given for an arbitrary collection of graphs, backed by different storage and having different capabilities.
Best practice is to change the graph membership outside of any transaction, ideally at setup time of the object using this class. (Caution: SPARQL Update can create graphs.)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote -
Constructor Summary
ConstructorsConstructorDescriptionTxnDataset2Graph(org.apache.jena.graph.Graph primaryGraph, org.apache.jena.graph.Graph... otherGraphs) -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)voidaddGraph(org.apache.jena.graph.Graph graph) voidStart a transaction.
READ or WRITE transactions start in that state and do not change for the lifetime of the transaction.voidcommit()Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)voidend()Finish the transaction - if a write transaction and commit() has not been called, then abortvoidremoveGraph(org.apache.jena.graph.Graph graph) voidsetPrimaryGraph(org.apache.jena.graph.Graph graph) Methods inherited from class org.apache.jena.sparql.core.TransactionalLock
begin, create, createMRPlusSW, createMRSW, createMutex, isInTransaction, isTransactionMode, promote, transactionMode, transactionTypeMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jena.sparql.core.Transactional
begin, calc, calculate, calculateRead, calculateWrite, exec, execute, executeRead, executeWrite, promote
-
Constructor Details
-
TxnDataset2Graph
public TxnDataset2Graph(org.apache.jena.graph.Graph primaryGraph, org.apache.jena.graph.Graph... otherGraphs)
-
-
Method Details
-
addGraph
public void addGraph(org.apache.jena.graph.Graph graph) -
removeGraph
public void removeGraph(org.apache.jena.graph.Graph graph) -
setPrimaryGraph
public void setPrimaryGraph(org.apache.jena.graph.Graph graph) -
begin
Description copied from interface:TransactionalStart a transaction.
READ or WRITE transactions start in that state and do not change for the lifetime of the transaction.WRITE: this guarantees a WRITE will complete ifcommit()is called. The same asbegin(ReadWrite.WRITE).READ: the transaction can not promote to WRITE,ensuring read-only access to the data. The same asbegin(ReadWrite.READ).READ_PROMOTE: the transaction will go from "read" to "write" if an update is attempted and if the dataset has not been changed by another write transaction. See alsoTransactional.promote().READ_COMMITTED_PROMOTE: Use this with care. The promotion will succeed but changes from other transactions become visible.
begin). IfREAD_PROMOTE, the dataset must not have changed; ifREAD_COMMITTED_PROMOTEany intermediate changes are visible but the application can not assume any data it has read in the transaction is the same as it was at the point the transaction started.This operation is optional and some implementations may throw a
JenaTransactionExceptionexception for some or allTxnTypevalues.See
Transactional.begin(ReadWrite)for a form that is required of implementations.- Specified by:
beginin interfaceTransactional- Overrides:
beginin classTransactionalLock
-
commit
public void commit()Description copied from interface:TransactionalCommit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)- Specified by:
commitin interfaceTransactional- Overrides:
commitin classTransactionalLock
-
abort
public void abort()Description copied from interface:TransactionalAbort a transaction - finish the transaction and undo any changes (if a "write" transaction)- Specified by:
abortin interfaceTransactional- Overrides:
abortin classTransactionalLock
-
end
public void end()Description copied from interface:TransactionalFinish the transaction - if a write transaction and commit() has not been called, then abort- Specified by:
endin interfaceTransactional- Overrides:
endin classTransactionalLock
-