Interface Dataset

All Superinterfaces:
Transactional
All Known Implementing Classes:
DatasetImpl

public interface Dataset extends Transactional
Query is over a Dataset, a collection of named graphs and a default graph (also called the unnamed graph).
  • 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

      Dataset setDefaultModel(org.apache.jena.rdf.model.Model model)
      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

      org.apache.jena.rdf.model.Model getNamedModel(String uri)
      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

      boolean containsNamedModel(String uri)
      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

      Dataset addNamedModel(String uri, org.apache.jena.rdf.model.Model model)
      Add a named graph.
      Parameters:
      uri - the name of the graph to set
      model - 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 set
      model - the graph to set
      Returns:
      this Dataset for continued usage
    • removeNamedModel

      Dataset removeNamedModel(String uri)
      Remove a named graph.
      Parameters:
      uri - the name of the graph to remove
      Returns:
      this Dataset for continued usage
    • removeNamedModel

      Dataset removeNamedModel(org.apache.jena.rdf.model.Resource resource)
      Remove a named graph.
      Parameters:
      resource - the name of the graph to remove
      Returns:
      this Dataset for continued usage
    • replaceNamedModel

      Dataset replaceNamedModel(String uri, org.apache.jena.rdf.model.Model model)
      Change a named graph for another using the same name
      Parameters:
      uri - the name of the graph to replace
      model - 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 replace
      model - the graph with which to replace it
      Returns:
      this Dataset for continued usage
    • listNames

      Iterator<String> 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 provides begin(org.apache.jena.query.ReadWrite), commit(), end() which otherwise may throw UnsupportedOperationException.

      See supportsTransactionAbort() for abort(). A Dataset 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 provide abort().

      In addition, check details of a specific implementation.

    • supportsTransactionAbort

      boolean supportsTransactionAbort()
      Declare whether abort() 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:
      begin in interface Transactional
    • commit

      void commit()
      Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)
      Specified by:
      commit in interface Transactional
    • abort

      void abort()
      Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)
      Specified by:
      abort in interface Transactional
    • isInTransaction

      boolean isInTransaction()
      Say whether a transaction is active
      Specified by:
      isInTransaction in interface Transactional
    • end

      void end()
      Finish the transaction - if a write transaction and commit() has not been called, then abort
      Specified by:
      end in interface Transactional
    • asDatasetGraph

      DatasetGraph asDatasetGraph()
      Get the dataset in graph form
    • getPrefixMapping

      default org.apache.jena.shared.PrefixMapping getPrefixMapping()
      Get the PrefixMapping 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.