This page gives an overview of transactions in Jena.
There are two API for transactions: the basic transaction
interface styled after the conventional
commit and a higher level
Txn API that builds
on the basic API using Java8 features.
Transaction provide applications with a safe way to use and update data between threads. The properties of transactions are ACID
- Atomic, Consistent, Isolation, Durable - meaning that groups of changes are made visible to other transactions in a single unit or no changes become visible, and when made changes are not reversed, or the case of persistent storage, not lost or the database corrupted.
Jena provides transaction on datasets and provides “serializable transactions”.
Any application code reading data sees all changes made elsewhere,
not parts of changes. In particular, SPARQL aggregation like
correct and do not see partial changes due to other transactions.
The exact details are dependent on the implementation.
Transactions can not be nested (a transaction happening inside an outer transaction results in changes visible only to the outer transaction until that commits).
Transactions are “per thread”. Actions by different threads on the same dataset are always inside different transactions.
Transactions are part of the interface to RDF Datasets. There is a default implementation, based on MRSW locking (multiple-reader or single-writer) that can be used with any mixed set of components. Certain storage sub-systems provide better concurrency with MR+SW (multiple-read and single writer).
The general dataset can have any graphs added to it (e.g. inference graphs).