Class VirtDataset.VirtDataSetGraph

  • All Implemented Interfaces:
    org.apache.jena.atlas.lib.Closeable, org.apache.jena.sparql.core.DatasetGraph, org.apache.jena.sparql.core.Transactional
    Enclosing class:
    VirtDataset

    public class VirtDataset.VirtDataSetGraph
    extends java.lang.Object
    implements org.apache.jena.sparql.core.DatasetGraph
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional

        org.apache.jena.sparql.core.Transactional.Promote
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abort()
      Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)
      void add​(org.apache.jena.graph.Node g, org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o)
      Add a quad
      void add​(org.apache.jena.sparql.core.Quad quad)
      Add a quad
      void addGraph​(org.apache.jena.graph.Node graphName, org.apache.jena.graph.Graph graph)
      Add the given graph to the dataset.
      void begin​(org.apache.jena.query.ReadWrite readWrite)
      Start either a READ or WRITE transaction
      void begin​(org.apache.jena.query.TxnType txnType)  
      void clear()  
      void close()
      Close the dataset
      void commit()
      Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)
      boolean contains​(org.apache.jena.graph.Node g, org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o)
      Test whether the dataset (including default graph) contains a quad - may include wildcards, Node.ANY or null
      boolean contains​(org.apache.jena.sparql.core.Quad quad)
      Test whether the dataset contains a quad (including default graph)- may include wildcards, Node.ANY or null
      boolean containsGraph​(org.apache.jena.graph.Node graphNode)
      Does the DatasetGraph contain a specific named graph? Whether a dataset contains a graph if there are no triples is not defined - see the specific implementation.
      void delete​(org.apache.jena.graph.Node g, org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o)
      Delete a quad
      void delete​(org.apache.jena.sparql.core.Quad quad)
      Delete a quad
      void deleteAny​(org.apache.jena.graph.Node g, org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o)
      Delete any quads matching the pattern
      void end()
      Finish the transaction - if a write transaction and commit() has not been called, then abort
      java.util.Iterator<org.apache.jena.sparql.core.Quad> find()
      Iterate over all quads in the dataset graph
      java.util.Iterator<org.apache.jena.sparql.core.Quad> find​(org.apache.jena.graph.Node g, org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o)
      Find matching quads in the dataset (including default graph) - may include wildcards, Node.ANY or null
      java.util.Iterator<org.apache.jena.sparql.core.Quad> find​(org.apache.jena.sparql.core.Quad quad)
      Find matching quads in the dataset - may include wildcards, Node.ANY or null
      java.util.Iterator<org.apache.jena.sparql.core.Quad> findNG​(org.apache.jena.graph.Node g, org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o)
      Find matching quads in the dataset in named graphs only - may include wildcards, Node.ANY or null
      org.apache.jena.sparql.util.Context getContext()
      Get the context associated with this object - may be null
      org.apache.jena.graph.Graph getDefaultGraph()
      Get the default graph as a Jena Graph
      org.apache.jena.graph.Graph getGraph​(org.apache.jena.graph.Node graphNode)
      Get the graph named by graphNode : returns null when there is no such graph.
      protected java.util.List<org.apache.jena.graph.Node> getListGraphNodes()  
      org.apache.jena.shared.Lock getLock()
      Return a lock for the dataset to help with concurrency control
      org.apache.jena.graph.Graph getUnionGraph()
      Return a Graph that is the union of all named graphs in this dataset.
      boolean isEmpty()
      Test whether the dataset is empty
      boolean isInTransaction()
      Say whether inside a transaction.
      java.util.Iterator<org.apache.jena.graph.Node> listGraphNodes()
      Iterate over all names of named graphs
      org.apache.jena.riot.system.PrefixMap prefixes()
      Prefixes for this DatasetGraph
      boolean promote​(org.apache.jena.sparql.core.Transactional.Promote promote)  
      void removeGraph​(org.apache.jena.graph.Node graphName)
      Remove all data associated with the named graph
      void setDefaultGraph​(org.apache.jena.graph.Graph g)
      Set the default graph.
      long size()
      Get the size (number of named graphs) - may be -1 for unknown
      boolean supportsTransactionAbort()
      Declare whether abort() is supported.
      boolean supportsTransactions()
      A DatasetGraph supports tranactions if it provides begin(org.apache.jena.query.TxnType)/ commit()/end().
      org.apache.jena.query.ReadWrite transactionMode()  
      org.apache.jena.query.TxnType transactionType()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.jena.sparql.core.DatasetGraph

        addAll, stream, stream
      • Methods inherited from interface org.apache.jena.sparql.core.Transactional

        begin, calc, calculate, calculateRead, calculateWrite, exec, execute, executeRead, executeWrite, promote
    • Constructor Detail

      • VirtDataSetGraph

        public VirtDataSetGraph​(VirtDataset vds)
    • Method Detail

      • getDefaultGraph

        public org.apache.jena.graph.Graph getDefaultGraph()
        Get the default graph as a Jena Graph
        Specified by:
        getDefaultGraph in interface org.apache.jena.sparql.core.DatasetGraph
      • getGraph

        public org.apache.jena.graph.Graph getGraph​(org.apache.jena.graph.Node graphNode)
        Get the graph named by graphNode : returns null when there is no such graph. NB Whether a dataset contains a graph if there are no triples is not defined - see the specific implementation. Some datasets are "open" - they have all graphs even if no triples.
        Specified by:
        getGraph in interface org.apache.jena.sparql.core.DatasetGraph
      • getUnionGraph

        public org.apache.jena.graph.Graph getUnionGraph()
        Return a Graph that is the union of all named graphs in this dataset. This union graph is read-only (its prefix mapping in the current JVM may be changed but that may not persist).
        Specified by:
        getUnionGraph in interface org.apache.jena.sparql.core.DatasetGraph
      • containsGraph

        public boolean containsGraph​(org.apache.jena.graph.Node graphNode)
        Does the DatasetGraph contain a specific named graph? Whether a dataset contains a graph if there are no triples is not defined - see the specific implementation. Some datasets are "open" - they have all graphs even if no triples and this returns true always.
        Specified by:
        containsGraph in interface org.apache.jena.sparql.core.DatasetGraph
        Parameters:
        graphNode -
        Returns:
        boolean
      • getListGraphNodes

        protected java.util.List<org.apache.jena.graph.Node> getListGraphNodes()
      • listGraphNodes

        public java.util.Iterator<org.apache.jena.graph.Node> listGraphNodes()
        Iterate over all names of named graphs
        Specified by:
        listGraphNodes in interface org.apache.jena.sparql.core.DatasetGraph
      • getLock

        public org.apache.jena.shared.Lock getLock()
        Return a lock for the dataset to help with concurrency control
        Specified by:
        getLock in interface org.apache.jena.sparql.core.DatasetGraph
        See Also:
        Lock
      • size

        public long size()
        Get the size (number of named graphs) - may be -1 for unknown
        Specified by:
        size in interface org.apache.jena.sparql.core.DatasetGraph
      • close

        public void close()
        Close the dataset
        Specified by:
        close in interface org.apache.jena.atlas.lib.Closeable
        Specified by:
        close in interface org.apache.jena.sparql.core.DatasetGraph
      • getContext

        public org.apache.jena.sparql.util.Context getContext()
        Get the context associated with this object - may be null
        Specified by:
        getContext in interface org.apache.jena.sparql.core.DatasetGraph
      • prefixes

        public org.apache.jena.riot.system.PrefixMap prefixes()
        Prefixes for this DatasetGraph
        Specified by:
        prefixes in interface org.apache.jena.sparql.core.DatasetGraph
      • setDefaultGraph

        public void setDefaultGraph​(org.apache.jena.graph.Graph g)
        Set the default graph. Set the active graph if it was null. This replaces the contents default graph, not merge data into it. Do not assume that the same object is returned by getDefaultGraph()
        Specified by:
        setDefaultGraph in interface org.apache.jena.sparql.core.DatasetGraph
      • addGraph

        public void addGraph​(org.apache.jena.graph.Node graphName,
                             org.apache.jena.graph.Graph graph)
        Add the given graph to the dataset. Replaces any existing data for the named graph; to add data, get the graph and add triples to it, or add quads to the dataset. Do not assume that the same Java object is returned by getGraph(org.apache.jena.graph.Node)
        Specified by:
        addGraph in interface org.apache.jena.sparql.core.DatasetGraph
      • removeGraph

        public void removeGraph​(org.apache.jena.graph.Node graphName)
        Remove all data associated with the named graph
        Specified by:
        removeGraph in interface org.apache.jena.sparql.core.DatasetGraph
      • add

        public void add​(org.apache.jena.sparql.core.Quad quad)
        Add a quad
        Specified by:
        add in interface org.apache.jena.sparql.core.DatasetGraph
      • delete

        public void delete​(org.apache.jena.sparql.core.Quad quad)
        Delete a quad
        Specified by:
        delete in interface org.apache.jena.sparql.core.DatasetGraph
      • add

        public void add​(org.apache.jena.graph.Node g,
                        org.apache.jena.graph.Node s,
                        org.apache.jena.graph.Node p,
                        org.apache.jena.graph.Node o)
        Add a quad
        Specified by:
        add in interface org.apache.jena.sparql.core.DatasetGraph
      • delete

        public void delete​(org.apache.jena.graph.Node g,
                           org.apache.jena.graph.Node s,
                           org.apache.jena.graph.Node p,
                           org.apache.jena.graph.Node o)
        Delete a quad
        Specified by:
        delete in interface org.apache.jena.sparql.core.DatasetGraph
      • deleteAny

        public void deleteAny​(org.apache.jena.graph.Node g,
                              org.apache.jena.graph.Node s,
                              org.apache.jena.graph.Node p,
                              org.apache.jena.graph.Node o)
        Delete any quads matching the pattern
        Specified by:
        deleteAny in interface org.apache.jena.sparql.core.DatasetGraph
      • find

        public java.util.Iterator<org.apache.jena.sparql.core.Quad> find()
        Iterate over all quads in the dataset graph
        Specified by:
        find in interface org.apache.jena.sparql.core.DatasetGraph
      • find

        public java.util.Iterator<org.apache.jena.sparql.core.Quad> find​(org.apache.jena.sparql.core.Quad quad)
        Find matching quads in the dataset - may include wildcards, Node.ANY or null
        Specified by:
        find in interface org.apache.jena.sparql.core.DatasetGraph
      • find

        public java.util.Iterator<org.apache.jena.sparql.core.Quad> find​(org.apache.jena.graph.Node g,
                                                                         org.apache.jena.graph.Node s,
                                                                         org.apache.jena.graph.Node p,
                                                                         org.apache.jena.graph.Node o)
        Find matching quads in the dataset (including default graph) - may include wildcards, Node.ANY or null
        Specified by:
        find in interface org.apache.jena.sparql.core.DatasetGraph
        See Also:
        Graph.find(Node, Node, Node)
      • findNG

        public java.util.Iterator<org.apache.jena.sparql.core.Quad> findNG​(org.apache.jena.graph.Node g,
                                                                           org.apache.jena.graph.Node s,
                                                                           org.apache.jena.graph.Node p,
                                                                           org.apache.jena.graph.Node o)
        Find matching quads in the dataset in named graphs only - may include wildcards, Node.ANY or null
        Specified by:
        findNG in interface org.apache.jena.sparql.core.DatasetGraph
        See Also:
        Graph.find(Node, Node, Node)
      • contains

        public boolean contains​(org.apache.jena.graph.Node g,
                                org.apache.jena.graph.Node s,
                                org.apache.jena.graph.Node p,
                                org.apache.jena.graph.Node o)
        Test whether the dataset (including default graph) contains a quad - may include wildcards, Node.ANY or null
        Specified by:
        contains in interface org.apache.jena.sparql.core.DatasetGraph
      • contains

        public boolean contains​(org.apache.jena.sparql.core.Quad quad)
        Test whether the dataset contains a quad (including default graph)- may include wildcards, Node.ANY or null
        Specified by:
        contains in interface org.apache.jena.sparql.core.DatasetGraph
      • clear

        public void clear()
        Specified by:
        clear in interface org.apache.jena.sparql.core.DatasetGraph
      • isEmpty

        public boolean isEmpty()
        Test whether the dataset is empty
        Specified by:
        isEmpty in interface org.apache.jena.sparql.core.DatasetGraph
      • supportsTransactions

        public boolean supportsTransactions()
        A DatasetGraph supports tranactions if it provides begin(org.apache.jena.query.TxnType)/ commit()/end(). There core storage DatasetGraph that provide fully serialized transactions. DatasetGraph that provide functionality acorss independent systems can not provide such strong guarantees. For example, they may use MRSW locking and some isolation control. Specifically, they do not necessarily provide abort().

        See supportsTransactionAbort() for abort(). In addition, check details of a specific implementation.

        Specified by:
        supportsTransactions in interface org.apache.jena.sparql.core.DatasetGraph
      • supportsTransactionAbort

        public boolean supportsTransactionAbort()
        Declare whether abort() is supported. This goes along with clearing up after exceptions inside application transaction code.
        Specified by:
        supportsTransactionAbort in interface org.apache.jena.sparql.core.DatasetGraph
      • isInTransaction

        public boolean isInTransaction()
        Say whether inside a transaction.
        Specified by:
        isInTransaction in interface org.apache.jena.sparql.core.Transactional
      • 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.sparql.core.Transactional
      • promote

        public boolean promote​(org.apache.jena.sparql.core.Transactional.Promote promote)
        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.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.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.sparql.core.Transactional
      • transactionMode

        public org.apache.jena.query.ReadWrite transactionMode()
        Specified by:
        transactionMode in interface org.apache.jena.sparql.core.Transactional
      • transactionType

        public org.apache.jena.query.TxnType transactionType()
        Specified by:
        transactionType in interface org.apache.jena.sparql.core.Transactional