- All Implemented Interfaces:
Dataset,Transactional
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote -
Constructor Summary
ConstructorsConstructorDescriptionDatasetImpl(org.apache.jena.rdf.model.Model model) Create a Dataset with the model as default model. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)addNamedModel(String uri, org.apache.jena.rdf.model.Model model) Add a named graph.addNamedModel(org.apache.jena.rdf.model.Resource uri, org.apache.jena.rdf.model.Model model) Add a named graph.Get the dataset in graph formvoidbegin()Start a transaction which is READ mode and which will switch to WRITE if an update is attempted but only if no intermediate transaction has performed an update.voidStart either a READ or WRITE transactionvoidStart a transaction.
READ or WRITE transactions start in that state and do not change for the lifetime of the transaction.voidclose()Close the dataset, potentially releasing any associated resources.voidcommit()Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)booleancontainsNamedModel(String uri) Does the dataset contain a model with the name supplied?booleancontainsNamedModel(org.apache.jena.rdf.model.Resource uri) Does the dataset contain a model named by the resource supplied?voidend()Finish the transaction - if a write transaction and commit() has not been called, then abortGet the context associated with this datasetorg.apache.jena.rdf.model.ModelGet the default graph as a Jena Modelorg.apache.jena.shared.LockgetLock()Get the lock for this datasetorg.apache.jena.rdf.model.ModelgetNamedModel(String uri) Get a graph by name as a Jena Modelorg.apache.jena.rdf.model.ModelgetNamedModel(org.apache.jena.rdf.model.Resource uri) Get a graph by resource as a Jena Modelorg.apache.jena.rdf.model.ModelGet the graph which is the union of all named graphs as a Jena ModelbooleanisEmpty()booleanSay whether a transaction is activeIterator<org.apache.jena.rdf.model.Resource>List the namesList the namesbooleanpromote(Transactional.Promote txnType) Attempt to promote a transaction from "read" mode to "write" and the transaction.removeNamedModel(String uri) Remove a named graph.removeNamedModel(org.apache.jena.rdf.model.Resource uri) Remove a named graph.replaceNamedModel(String uri, org.apache.jena.rdf.model.Model model) Change a named graph for another using the same namereplaceNamedModel(org.apache.jena.rdf.model.Resource uri, org.apache.jena.rdf.model.Model model) Change a named graph for another using the same namesetDefaultModel(org.apache.jena.rdf.model.Model model) Set the default graph.booleanDeclare whetherDataset.abort()is supported.booleanDoes this dataset support transactions?Return the current mode of the transaction - "read" or "write".Return the transaction type used inbegin(TxnType).static Datasetwrap(DatasetGraph datasetGraph) Wrap an existing DatasetGraphMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jena.query.Dataset
getPrefixMappingMethods inherited from interface org.apache.jena.sparql.core.Transactional
calc, calculate, calculateRead, calculateWrite, exec, execute, executeRead, executeWrite, promote
-
Constructor Details
-
DatasetImpl
public DatasetImpl(org.apache.jena.rdf.model.Model model) Create a Dataset with the model as default model. Named models must be explicitly added to identify the storage to be used.
-
-
Method Details
-
wrap
Wrap an existing DatasetGraph -
getDefaultModel
public org.apache.jena.rdf.model.Model getDefaultModel()Description copied from interface:DatasetGet the default graph as a Jena Model- Specified by:
getDefaultModelin interfaceDataset
-
getUnionModel
public org.apache.jena.rdf.model.Model getUnionModel()Description copied from interface:DatasetGet the graph which is the union of all named graphs as a Jena Model- Specified by:
getUnionModelin interfaceDataset
-
getLock
public org.apache.jena.shared.Lock getLock()Description copied from interface:DatasetGet the lock for this dataset -
getContext
Description copied from interface:DatasetGet the context associated with this dataset- Specified by:
getContextin interfaceDataset
-
supportsTransactions
public boolean supportsTransactions()Description copied from interface:DatasetDoes this dataset support transactions? Supporting transactions means that the dataset implementation providesDataset.begin(org.apache.jena.query.ReadWrite),Dataset.commit(),Dataset.end()which otherwise may throwUnsupportedOperationException.See
Dataset.supportsTransactionAbort()forDataset.abort(). ADatasetthat provides functionality across independent systems can not provide all features strong guarantees. For example, they may use MRSW locking and some isolation control. Specifically, they do not necessarily provideDataset.abort().In addition, check details of a specific implementation.
- Specified by:
supportsTransactionsin interfaceDataset
-
supportsTransactionAbort
public boolean supportsTransactionAbort()Description copied from interface:DatasetDeclare whetherDataset.abort()is supported. This goes along with clearing up after exceptions inside application transaction code.- Specified by:
supportsTransactionAbortin interfaceDataset
-
begin
public void begin()Description copied from interface:TransactionalStart a transaction which is READ mode and which will switch to WRITE if an update is attempted but only if no intermediate transaction has performed an update.See
Transactional.begin(TxnType)for more details an options.May not be implemented. See
Transactional.begin(ReadWrite)is guaranteed to be provided.- Specified by:
beginin interfaceTransactional
-
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
-
begin
Description copied from interface:DatasetStart either a READ or WRITE transaction- Specified by:
beginin interfaceDataset- Specified by:
beginin interfaceTransactional
-
promote
Description copied from interface:TransactionalAttempt to promote a transaction from "read" mode to "write" and the transaction. This method allows the form of promotion to be specified. The transaction must not have been started withREAD, which is read-only.An argument of
READ_PROMOTEtreats the promotion as if the transaction was started withREAD_PROMOTE(any other writer commiting since the transaction started blocks promotion) andREAD_COMMITTED_PROMOTEtreats the promotion as if the transaction was started withREAD_COMMITTED_PROMOTE(intemediate writer commits become visible).Returns "true" if the transaction is in write mode after the call. The method always succeeds of the transaction is already "write".
This method returns true if a
READ_PROMOTEorREAD_COMMITTED_PROMOTEis promoted.This method returns false if a
READ_PROMOTEcan't be promoted - the transaction is still valid and in "read" mode.This method throws an exception if there is an attempt to promote a
READtransaction.- Specified by:
promotein interfaceTransactional
-
transactionMode
Description copied from interface:TransactionalReturn the current mode of the transaction - "read" or "write". If the caller is not in a transaction, this method returns null.- Specified by:
transactionModein interfaceTransactional
-
transactionType
Description copied from interface:TransactionalReturn the transaction type used inbegin(TxnType). If the caller is not in a transaction, this method returns null.- Specified by:
transactionTypein interfaceTransactional
-
isInTransaction
public boolean isInTransaction()Say whether a transaction is active- Specified by:
isInTransactionin interfaceDataset- Specified by:
isInTransactionin interfaceTransactional
-
commit
public void commit()Description copied from interface:DatasetCommit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)- Specified by:
commitin interfaceDataset- Specified by:
commitin interfaceTransactional
-
abort
public void abort()Description copied from interface:DatasetAbort a transaction - finish the transaction and undo any changes (if a "write" transaction)- Specified by:
abortin interfaceDataset- Specified by:
abortin interfaceTransactional
-
end
public void end()Description copied from interface:DatasetFinish the transaction - if a write transaction and commit() has not been called, then abort- Specified by:
endin interfaceDataset- Specified by:
endin interfaceTransactional
-
asDatasetGraph
Description copied from interface:DatasetGet the dataset in graph form- Specified by:
asDatasetGraphin interfaceDataset
-
getNamedModel
Description copied from interface:DatasetGet a graph by name as a Jena Model- Specified by:
getNamedModelin interfaceDataset
-
getNamedModel
public org.apache.jena.rdf.model.Model getNamedModel(org.apache.jena.rdf.model.Resource uri) Description copied from interface:DatasetGet a graph by resource as a Jena Model- Specified by:
getNamedModelin interfaceDataset
-
addNamedModel
Description copied from interface:DatasetAdd a named graph.- Specified by:
addNamedModelin interfaceDataset- Parameters:
uri- the name of the graph to setmodel- the graph to set- Returns:
- this
Datasetfor continued usage
-
addNamedModel
public Dataset addNamedModel(org.apache.jena.rdf.model.Resource uri, org.apache.jena.rdf.model.Model model) Description copied from interface:DatasetAdd a named graph.- Specified by:
addNamedModelin interfaceDataset- Parameters:
uri- the name of the graph to setmodel- the graph to set- Returns:
- this
Datasetfor continued usage
-
removeNamedModel
Description copied from interface:DatasetRemove a named graph.- Specified by:
removeNamedModelin interfaceDataset- Parameters:
uri- the name of the graph to remove- Returns:
- this
Datasetfor continued usage
-
removeNamedModel
Description copied from interface:DatasetRemove a named graph.- Specified by:
removeNamedModelin interfaceDataset- Parameters:
uri- the name of the graph to remove- Returns:
- this
Datasetfor continued usage
-
replaceNamedModel
Description copied from interface:DatasetChange a named graph for another using the same name- Specified by:
replaceNamedModelin interfaceDataset- Parameters:
uri- the name of the graph to replacemodel- the graph with which to replace it- Returns:
- this
Datasetfor continued usage
-
replaceNamedModel
public Dataset replaceNamedModel(org.apache.jena.rdf.model.Resource uri, org.apache.jena.rdf.model.Model model) Description copied from interface:DatasetChange a named graph for another using the same name- Specified by:
replaceNamedModelin interfaceDataset- Parameters:
uri- the name of the graph to replacemodel- the graph with which to replace it- Returns:
- this
Datasetfor continued usage
-
setDefaultModel
Description copied from interface:DatasetSet the default graph. This operation copies the statements from the model into the default graph of the dataset.- Specified by:
setDefaultModelin interfaceDataset- Parameters:
model- the default graph to set- Returns:
- this
Datasetfor continued usage
-
containsNamedModel
Description copied from interface:DatasetDoes the dataset contain a model with the name supplied?- Specified by:
containsNamedModelin interfaceDataset
-
containsNamedModel
public boolean containsNamedModel(org.apache.jena.rdf.model.Resource uri) Description copied from interface:DatasetDoes the dataset contain a model named by the resource supplied?- Specified by:
containsNamedModelin interfaceDataset
-
listNames
Description copied from interface:DatasetList the names -
listModelNames
Description copied from interface:DatasetList the names- Specified by:
listModelNamesin interfaceDataset
-
close
public void close()Description copied from interface:DatasetClose the dataset, potentially releasing any associated resources. The dataset can not be used for query after this call. -
isEmpty
public boolean isEmpty()
-