Class VirtDataset

  • All Implemented Interfaces:
    org.apache.jena.graph.Graph, org.apache.jena.graph.impl.GraphWithPerform, org.apache.jena.query.Dataset, org.apache.jena.sparql.core.Transactional

    public class VirtDataset
    extends VirtGraph
    implements org.apache.jena.query.Dataset
    • Constructor Detail

      • VirtDataset

        public VirtDataset()
      • VirtDataset

        public VirtDataset​(java.lang.String _graphName,
                           javax.sql.DataSource _ds)
      • VirtDataset

        public VirtDataset​(javax.sql.DataSource _ds)
      • VirtDataset

        public VirtDataset​(java.lang.String _graphName,
                           javax.sql.ConnectionPoolDataSource _ds)
      • VirtDataset

        public VirtDataset​(javax.sql.ConnectionPoolDataSource _ds)
      • VirtDataset

        public VirtDataset​(java.lang.String _graphName,
                           javax.sql.XADataSource _ds)
      • VirtDataset

        public VirtDataset​(javax.sql.XADataSource _ds)
      • VirtDataset

        protected VirtDataset​(VirtGraph g)
      • VirtDataset

        public VirtDataset​(java.lang.String url_hostlist,
                           java.lang.String user,
                           java.lang.String password)
    • Method Detail

      • getDefaultModel

        public org.apache.jena.rdf.model.Model getDefaultModel()
        Get the default graph as a Jena Model
        Specified by:
        getDefaultModel in interface org.apache.jena.query.Dataset
      • getUnionModel

        public org.apache.jena.rdf.model.Model getUnionModel()
        Specified by:
        getUnionModel in interface org.apache.jena.query.Dataset
      • setDefaultModel

        public VirtDataset setDefaultModel​(org.apache.jena.rdf.model.Model model)
        Set the background graph. Can be set to null for none.
        Specified by:
        setDefaultModel in interface org.apache.jena.query.Dataset
      • getNamedModel

        public org.apache.jena.rdf.model.Model getNamedModel​(java.lang.String name)
        Get a graph by name as a Jena Model
        Specified by:
        getNamedModel in interface org.apache.jena.query.Dataset
      • getNamedModel

        public org.apache.jena.rdf.model.Model getNamedModel​(org.apache.jena.rdf.model.Resource resource)
        Get a graph by name as a Jena Model
        Specified by:
        getNamedModel in interface org.apache.jena.query.Dataset
      • containsNamedModel

        public boolean containsNamedModel​(java.lang.String name)
        Does the dataset contain a model with the name supplied?
        Specified by:
        containsNamedModel in interface org.apache.jena.query.Dataset
      • containsNamedModel

        public boolean containsNamedModel​(org.apache.jena.rdf.model.Resource resource)
        Does the dataset contain a model with the name supplied?
        Specified by:
        containsNamedModel in interface org.apache.jena.query.Dataset
      • addNamedModel

        public VirtDataset addNamedModel​(java.lang.String name,
                                         org.apache.jena.rdf.model.Model model,
                                         boolean checkExists)
        Set a named graph.
      • addNamedModel

        public VirtDataset addNamedModel​(java.lang.String name,
                                         org.apache.jena.rdf.model.Model model)
        Set a named graph.
        Specified by:
        addNamedModel in interface org.apache.jena.query.Dataset
      • addNamedModel

        public org.apache.jena.query.Dataset addNamedModel​(org.apache.jena.rdf.model.Resource resource,
                                                           org.apache.jena.rdf.model.Model model)
        Add a named graph.
        Specified by:
        addNamedModel in interface org.apache.jena.query.Dataset
        Parameters:
        resource - the name of the graph to set
        model - the graph to set
        Returns:
        this Dataset for continued usage
      • removeNamedModel

        public VirtDataset removeNamedModel​(java.lang.String name)
        Remove a named graph.
        Specified by:
        removeNamedModel in interface org.apache.jena.query.Dataset
      • removeNamedModel

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

        public VirtDataset replaceNamedModel​(java.lang.String name,
                                             org.apache.jena.rdf.model.Model model)
        Change a named graph for another uisng the same name
        Specified by:
        replaceNamedModel in interface org.apache.jena.query.Dataset
      • replaceNamedModel

        public VirtDataset 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
        Specified by:
        replaceNamedModel in interface org.apache.jena.query.Dataset
        Parameters:
        resource - the name of the graph to replace
        model - the graph with which to replace it
        Returns:
        this Dataset for continued usage
      • listNames

        public java.util.Iterator<java.lang.String> listNames()
        List the names
        Specified by:
        listNames in interface org.apache.jena.query.Dataset
      • listModelNames

        public java.util.Iterator<org.apache.jena.rdf.model.Resource> listModelNames()
        List the names
        Specified by:
        listModelNames in interface org.apache.jena.query.Dataset
      • getLock

        public org.apache.jena.shared.Lock getLock()
        Get the lock for this dataset
        Specified by:
        getLock in interface org.apache.jena.query.Dataset
      • getContext

        public org.apache.jena.sparql.util.Context getContext()
        Specified by:
        getContext in interface org.apache.jena.query.Dataset
      • supportsTransactions

        public boolean supportsTransactions()
        Specified by:
        supportsTransactions in interface org.apache.jena.query.Dataset
      • supportsXATransactions

        public boolean supportsXATransactions()
      • supportsTransactionAbort

        public boolean supportsTransactionAbort()
        Specified by:
        supportsTransactionAbort in interface org.apache.jena.query.Dataset
      • begin

        public void begin​(org.apache.jena.query.TxnType txnType)
        Specified by:
        begin in interface org.apache.jena.sparql.core.Transactional
      • begin

        public void begin​(org.apache.jena.query.ReadWrite readWrite)
        Start either a READ or WRITE transaction
        Specified by:
        begin in interface org.apache.jena.query.Dataset
        Specified by:
        begin in interface org.apache.jena.sparql.core.Transactional
      • promote

        public boolean promote​(org.apache.jena.sparql.core.Transactional.Promote promote)
        Attempt to promote a transaction from "read" mode to "write" and the transaction. This method allows the form of promotion to be specified. The transaction must not have been started with READ, which is read-only.

        An argument of READ_PROMOTE treats the promotion as if the transaction was started with READ_PROMOTE (any other writer commiting since the transaction started blocks promotion) and READ_COMMITTED_PROMOTE treats the promotion as if the transaction was started with READ_COMMITTED_PROMOTE (intemediate writer commits become visible).

        Returns "true" if the transaction is in write mode after the call. The method always succeeds of the transaction is already "write".

        This method returns true if a READ_PROMOTE or READ_COMMITTED_PROMOTE is promoted.

        This method returns false if a READ_PROMOTE can't be promoted - the transaction is still valid and in "read" mode.

        This method throws an exception if there is an attempt to promote a READ transaction.

        Specified by:
        promote in interface org.apache.jena.sparql.core.Transactional
      • commit

        public void commit()
        Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)
        Specified by:
        commit in interface org.apache.jena.query.Dataset
        Specified by:
        commit in interface org.apache.jena.sparql.core.Transactional
      • abort

        public void abort()
        Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)
        Specified by:
        abort in interface org.apache.jena.query.Dataset
        Specified by:
        abort in interface org.apache.jena.sparql.core.Transactional
      • isInTransaction

        public boolean isInTransaction()
        Say whether a transaction is active
        Specified by:
        isInTransaction in interface org.apache.jena.query.Dataset
        Specified by:
        isInTransaction in interface org.apache.jena.sparql.core.Transactional
      • end

        public void end()
        Finish the transaction - if a write transaction and commit() has not been called, then abort
        Specified by:
        end in interface org.apache.jena.query.Dataset
        Specified by:
        end in interface org.apache.jena.sparql.core.Transactional
      • transactionMode

        public org.apache.jena.query.ReadWrite transactionMode()
        Return the current mode of the transaction - "read" or "write". If the caller is not in a transaction, this method returns null.
        Specified by:
        transactionMode in interface org.apache.jena.sparql.core.Transactional
      • transactionType

        public org.apache.jena.query.TxnType transactionType()
        Return the transaction type used in begin(TxnType). If the caller is not in a transaction, this method returns null.
        Specified by:
        transactionType in interface org.apache.jena.sparql.core.Transactional
      • close

        public void close()
        Specified by:
        close in interface org.apache.jena.query.Dataset
        Specified by:
        close in interface org.apache.jena.graph.Graph
        Overrides:
        close in class VirtGraph
      • addLink

        protected void addLink​(VirtGraph obj)
      • removeLink

        protected void removeLink​(VirtGraph obj)
      • asDatasetGraph

        public org.apache.jena.sparql.core.DatasetGraph asDatasetGraph()
        Get the dataset in graph form
        Specified by:
        asDatasetGraph in interface org.apache.jena.query.Dataset