Package org.apache.jena.query
Interface Dataset
-
- All Superinterfaces:
Transactional
- All Known Implementing Classes:
DatasetImpl,DatasetOne
public interface Dataset extends Transactional
Query is over a Dataset, a collection of named graphs and a background graph (also called the default graph or unnamed graph).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidabort()Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)DatasetaddNamedModel(java.lang.String uri, Model model)Set a named graph.DatasetGraphasDatasetGraph()Get the dataset in graph formvoidbegin(ReadWrite readWrite)Start either a READ or WRITE transactionvoidclose()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(java.lang.String uri)Does the dataset contain a model with the name supplied?voidend()Finish the transaction - if a write transaction and commit() has not been called, then abortContextgetContext()Get the context associated with this datasetModelgetDefaultModel()Get the default graph as a Jena ModelLockgetLock()Get the lock for this datasetModelgetNamedModel(java.lang.String uri)Get a graph by name as a Jena Modeldefault PrefixMappinggetPrefixMapping()Get thePrefixMappingthis dataset.ModelgetUnionModel()Get the graph which is the union of all named graphs as a Jena ModelbooleanisEmpty()booleanisInTransaction()Say whether a transaction is activejava.util.Iterator<java.lang.String>listNames()List the namesDatasetremoveNamedModel(java.lang.String uri)Remove a named graph.DatasetreplaceNamedModel(java.lang.String uri, Model model)Change a named graph for another using the same nameDatasetsetDefaultModel(Model model)Set the default graph.booleansupportsTransactionAbort()Declare whetherabort()is supported.booleansupportsTransactions()Does this dataset support transactions? Supporting transactions means that the dataset implementation providesbegin(org.apache.jena.query.ReadWrite),commit(),end()which otherwise may throwUnsupportedOperationException.-
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 Detail
-
getDefaultModel
Model getDefaultModel()
Get the default graph as a Jena Model
-
getUnionModel
Model getUnionModel()
Get the graph which is the union of all named graphs as a Jena Model
-
setDefaultModel
Dataset setDefaultModel(Model model)
Set the default graph. Can be set to null for none.- Parameters:
model- the default graph to set- Returns:
- this
Datasetfor continued usage
-
getNamedModel
Model getNamedModel(java.lang.String uri)
Get a graph by name as a Jena Model
-
containsNamedModel
boolean containsNamedModel(java.lang.String uri)
Does the dataset contain a model with the name supplied?
-
addNamedModel
Dataset addNamedModel(java.lang.String uri, Model model)
Set a named graph.- Parameters:
uri- the name of the graph to setmodel- the graph to set- Returns:
- this
Datasetfor continued usage
-
removeNamedModel
Dataset removeNamedModel(java.lang.String uri)
Remove a named graph.- Parameters:
uri- the name of the gaph to remove- Returns:
- this
Datasetfor continued usage
-
replaceNamedModel
Dataset replaceNamedModel(java.lang.String uri, Model model)
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
Datasetfor continued usage
-
listNames
java.util.Iterator<java.lang.String> listNames()
List the names
-
getLock
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(). 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 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
void begin(ReadWrite readWrite)
Start either a READ or WRITE transaction- Specified by:
beginin interfaceTransactional
-
commit
void commit()
Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)- Specified by:
commitin interfaceTransactional
-
abort
void abort()
Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)- Specified by:
abortin interfaceTransactional
-
isInTransaction
boolean isInTransaction()
Say whether a transaction is active- Specified by:
isInTransactionin interfaceTransactional
-
end
void end()
Finish the transaction - if a write transaction and commit() has not been called, then abort- Specified by:
endin interfaceTransactional
-
asDatasetGraph
DatasetGraph asDatasetGraph()
Get the dataset in graph form
-
getPrefixMapping
default PrefixMapping getPrefixMapping()
Get thePrefixMappingthis 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
Datasetis empty of triples, whether in the default graph or in any named graph.
-
-