- All Superinterfaces:
Transactional
- All Known Implementing Classes:
DatasetImpl
Query is over a Dataset, a collection of named graphs
and a default graph (also called the unnamed graph).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
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 resource, org.apache.jena.rdf.model.Model model) Add a named graph.Get the dataset in graph formvoid
Start either a READ or WRITE transactionvoid
close()
Close the dataset, potentially releasing any associated resources.void
commit()
Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)boolean
containsNamedModel
(String uri) Does the dataset contain a model with the name supplied?boolean
containsNamedModel
(org.apache.jena.rdf.model.Resource uri) Does the dataset contain a model named by the resource supplied?void
end()
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.Model
Get the default graph as a Jena Modelorg.apache.jena.shared.Lock
getLock()
Get the lock for this datasetorg.apache.jena.rdf.model.Model
getNamedModel
(String uri) Get a graph by name as a Jena Modelorg.apache.jena.rdf.model.Model
getNamedModel
(org.apache.jena.rdf.model.Resource uri) Get a graph by resource as a Jena Modeldefault org.apache.jena.shared.PrefixMapping
Get thePrefixMapping
this dataset.org.apache.jena.rdf.model.Model
Get the graph which is the union of all named graphs as a Jena Modelboolean
isEmpty()
boolean
Say whether a transaction is activeIterator<org.apache.jena.rdf.model.Resource>
List the namesList the namesremoveNamedModel
(String uri) Remove a named graph.removeNamedModel
(org.apache.jena.rdf.model.Resource resource) 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 resource, 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.boolean
Declare whetherabort()
is supported.boolean
Does this dataset support transactions?Methods inherited from interface org.apache.jena.sparql.core.Transactional
begin, begin, calc, calculate, calculateRead, calculateWrite, exec, execute, executeRead, executeWrite, promote, promote, transactionMode, transactionType
-
Method Details
-
getDefaultModel
org.apache.jena.rdf.model.Model getDefaultModel()Get the default graph as a Jena Model -
getUnionModel
org.apache.jena.rdf.model.Model getUnionModel()Get the graph which is the union of all named graphs as a Jena Model -
setDefaultModel
Set the default graph. This operation copies the statements from the model into the default graph of the dataset.- Parameters:
model
- the default graph to set- Returns:
- this
Dataset
for continued usage
-
getNamedModel
Get a graph by name as a Jena Model -
getNamedModel
org.apache.jena.rdf.model.Model getNamedModel(org.apache.jena.rdf.model.Resource uri) Get a graph by resource as a Jena Model -
containsNamedModel
Does the dataset contain a model with the name supplied? -
containsNamedModel
boolean containsNamedModel(org.apache.jena.rdf.model.Resource uri) Does the dataset contain a model named by the resource supplied? -
addNamedModel
Add a named graph.- Parameters:
uri
- the name of the graph to setmodel
- the graph to set- Returns:
- this
Dataset
for continued usage
-
addNamedModel
Dataset addNamedModel(org.apache.jena.rdf.model.Resource resource, org.apache.jena.rdf.model.Model model) Add a named graph.- Parameters:
resource
- the name of the graph to setmodel
- the graph to set- Returns:
- this
Dataset
for continued usage
-
removeNamedModel
Remove a named graph.- Parameters:
uri
- the name of the graph to remove- Returns:
- this
Dataset
for continued usage
-
removeNamedModel
Remove a named graph.- Parameters:
resource
- the name of the graph to remove- Returns:
- this
Dataset
for continued usage
-
replaceNamedModel
Change a named graph for another using the same name- Parameters:
uri
- the name of the graph to replacemodel
- the graph with which to replace it- Returns:
- this
Dataset
for continued usage
-
replaceNamedModel
Dataset replaceNamedModel(org.apache.jena.rdf.model.Resource resource, org.apache.jena.rdf.model.Model model) Change a named graph for another using the same name- Parameters:
resource
- the name of the graph to replacemodel
- the graph with which to replace it- Returns:
- this
Dataset
for continued usage
-
listNames
List the names -
listModelNames
Iterator<org.apache.jena.rdf.model.Resource> listModelNames()List the names -
getLock
org.apache.jena.shared.Lock getLock()Get the lock for this dataset -
getContext
Context getContext()Get the context associated with this dataset -
supportsTransactions
boolean supportsTransactions()Does this dataset support transactions? Supporting transactions means that the dataset implementation providesbegin(org.apache.jena.query.ReadWrite)
,commit()
,end()
which otherwise may throwUnsupportedOperationException
.See
supportsTransactionAbort()
forabort()
. ADataset
that 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 provideabort()
.In addition, check details of a specific implementation.
-
supportsTransactionAbort
boolean supportsTransactionAbort()Declare whetherabort()
is supported. This goes along with clearing up after exceptions inside application transaction code. -
begin
Start either a READ or WRITE transaction- Specified by:
begin
in interfaceTransactional
-
commit
void commit()Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)- Specified by:
commit
in interfaceTransactional
-
abort
void abort()Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)- Specified by:
abort
in interfaceTransactional
-
isInTransaction
boolean isInTransaction()Say whether a transaction is active- Specified by:
isInTransaction
in interfaceTransactional
-
end
void end()Finish the transaction - if a write transaction and commit() has not been called, then abort- Specified by:
end
in interfaceTransactional
-
asDatasetGraph
DatasetGraph asDatasetGraph()Get the dataset in graph form -
getPrefixMapping
default org.apache.jena.shared.PrefixMapping getPrefixMapping()Get thePrefixMapping
this dataset.This is an optional operation.
-
close
void close()Close the dataset, potentially releasing any associated resources. The dataset can not be used for query after this call. -
isEmpty
boolean isEmpty()- Returns:
- Whether this
Dataset
is empty of triples, whether in the default graph or in any named graph.
-