com.hp.hpl.jena.sparql.core
Class DatasetImpl

java.lang.Object
  extended by com.hp.hpl.jena.sparql.core.DatasetImpl
All Implemented Interfaces:
Dataset, DataSource

public class DatasetImpl
extends Object
implements Dataset, DataSource

A implementation of a Dataset. This is the "usual" implementation based on wrapping a DatasetGraph and providing an adapter layer from Model/Resource to Graph/Node The characteristics of this adpter depend on the charcateristics of DatasetGraph.


Constructor Summary
DatasetImpl(Dataset ds)
           
DatasetImpl(com.hp.hpl.jena.rdf.model.Model model)
          Create a Dataset with the model as default model.
 
Method Summary
 void abort()
          Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)
 void addNamedModel(String uri, com.hp.hpl.jena.rdf.model.Model model)
          Set a named graph.
 DatasetGraph asDatasetGraph()
          Get the dataset in graph form
 void begin(ReadWrite mode)
          Start either a READ or WRITE transaction
static Dataset cloneStructure(DatasetGraph datasetGraph)
          Clone the structure of a DatasetGraph.
 void 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?
 void end()
          Finish the transaction - if a write transaction and commit() has not been called, then abort
 com.hp.hpl.jena.rdf.model.Model getDefaultModel()
          Get the default graph as a Jena Model
 com.hp.hpl.jena.shared.Lock getLock()
          Get the lock for this dataset
 com.hp.hpl.jena.rdf.model.Model getNamedModel(String uri)
          Get a graph by name as a Jena Model
 boolean isInTransaction()
          Say whether a transaction is active
 Iterator<String> listNames()
          List the names
 void removeNamedModel(String uri)
          Remove a named graph.
 void replaceNamedModel(String uri, com.hp.hpl.jena.rdf.model.Model model)
          Change a named graph for another using the same name
 void setDefaultModel(com.hp.hpl.jena.rdf.model.Model model)
          Set the background graph.
 boolean supportsTransactions()
          Does this dataset support transactions? Supporting transactions mean that the dataset implementation provides Dataset.begin(com.hp.hpl.jena.query.ReadWrite), Dataset.commit(), Dataset.abort(), Dataset.end() which otherwise may throw UnsupportedOperationException
static Dataset wrap(DatasetGraph datasetGraph)
          Wrap an existing DatasetGraph
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatasetImpl

public DatasetImpl(com.hp.hpl.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.


DatasetImpl

public DatasetImpl(Dataset ds)
Method Detail

wrap

public static Dataset wrap(DatasetGraph datasetGraph)
Wrap an existing DatasetGraph


cloneStructure

public static Dataset cloneStructure(DatasetGraph datasetGraph)
Clone the structure of a DatasetGraph. The current graph themselves are shared but new naming and new graphs are only in the cloned


getDefaultModel

public com.hp.hpl.jena.rdf.model.Model getDefaultModel()
Description copied from interface: Dataset
Get the default graph as a Jena Model

Specified by:
getDefaultModel in interface Dataset

getLock

public com.hp.hpl.jena.shared.Lock getLock()
Description copied from interface: Dataset
Get the lock for this dataset

Specified by:
getLock in interface Dataset

supportsTransactions

public boolean supportsTransactions()
Description copied from interface: Dataset
Does this dataset support transactions? Supporting transactions mean that the dataset implementation provides Dataset.begin(com.hp.hpl.jena.query.ReadWrite), Dataset.commit(), Dataset.abort(), Dataset.end() which otherwise may throw UnsupportedOperationException

Specified by:
supportsTransactions in interface Dataset

begin

public void begin(ReadWrite mode)
Description copied from interface: Dataset
Start either a READ or WRITE transaction

Specified by:
begin in interface Dataset

isInTransaction

public boolean isInTransaction()
Say whether a transaction is active

Specified by:
isInTransaction in interface Dataset

commit

public void commit()
Description copied from interface: Dataset
Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)

Specified by:
commit in interface Dataset

abort

public void abort()
Description copied from interface: Dataset
Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)

Specified by:
abort in interface Dataset

end

public void end()
Description copied from interface: Dataset
Finish the transaction - if a write transaction and commit() has not been called, then abort

Specified by:
end in interface Dataset

asDatasetGraph

public DatasetGraph asDatasetGraph()
Description copied from interface: Dataset
Get the dataset in graph form

Specified by:
asDatasetGraph in interface Dataset

getNamedModel

public com.hp.hpl.jena.rdf.model.Model getNamedModel(String uri)
Description copied from interface: Dataset
Get a graph by name as a Jena Model

Specified by:
getNamedModel in interface Dataset

addNamedModel

public void addNamedModel(String uri,
                          com.hp.hpl.jena.rdf.model.Model model)
                   throws LabelExistsException
Description copied from interface: Dataset
Set a named graph.

Specified by:
addNamedModel in interface Dataset
Throws:
LabelExistsException

removeNamedModel

public void removeNamedModel(String uri)
Description copied from interface: Dataset
Remove a named graph.

Specified by:
removeNamedModel in interface Dataset

replaceNamedModel

public void replaceNamedModel(String uri,
                              com.hp.hpl.jena.rdf.model.Model model)
Description copied from interface: Dataset
Change a named graph for another using the same name

Specified by:
replaceNamedModel in interface Dataset

setDefaultModel

public void setDefaultModel(com.hp.hpl.jena.rdf.model.Model model)
Description copied from interface: Dataset
Set the background graph. Can be set to null for none.

Specified by:
setDefaultModel in interface Dataset

containsNamedModel

public boolean containsNamedModel(String uri)
Description copied from interface: Dataset
Does the dataset contain a model with the name supplied?

Specified by:
containsNamedModel in interface Dataset

listNames

public Iterator<String> listNames()
Description copied from interface: Dataset
List the names

Specified by:
listNames in interface Dataset

close

public void close()
Description copied from interface: Dataset
Close the dataset, potentially releasing any associated resources. The dataset can not be used for query after this call.

Specified by:
close in interface Dataset


Licenced under the Apache License, Version 2.0