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).
    • 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 Dataset for 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 set
        model - the graph to set
        Returns:
        this Dataset for continued usage
      • removeNamedModel

        Dataset removeNamedModel​(java.lang.String uri)
        Remove a named graph.
        Parameters:
        uri - the name of the gaph to remove
        Returns:
        this Dataset for 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 replace
        model - the graph with which to replace it
        Returns:
        this Dataset for 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 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.
      • 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
      • 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
      • 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.