Class DatasetGraphBase

  • All Implemented Interfaces:
    org.apache.jena.atlas.lib.Closeable, DatasetGraph, Transactional
    Direct Known Subclasses:
    DatasetGraphBaseFind, DatasetGraphQuads

    public abstract class DatasetGraphBase
    extends java.lang.Object
    implements DatasetGraph

    DatasetGraph framework : readonly dataset need only provide find(g,s,p,o), getGraph() and getDefaultGraph() although it may wish to override other operations and do better.

    Implementations include:

    • Method Detail

      • containsGraph

        public boolean containsGraph​(Node graphNode)
        Description copied from interface: DatasetGraph
        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 DatasetGraph
        Returns:
        boolean
      • getUnionGraph

        public Graph getUnionGraph()
        Description copied from interface: DatasetGraph
        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 DatasetGraph
      • getGraph

        public abstract Graph getGraph​(Node graphNode)
        Description copied from interface: DatasetGraph
        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 DatasetGraph
      • removeGraph

        public abstract void removeGraph​(Node graphName)
        Description copied from interface: DatasetGraph
        Remove all data associated with the named graph. This will include prefixes associated with the graph.
        Specified by:
        removeGraph in interface DatasetGraph
      • setDefaultGraph

        public void setDefaultGraph​(Graph g)
        Description copied from interface: DatasetGraph
        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 DatasetGraph.getDefaultGraph()
        Specified by:
        setDefaultGraph in interface DatasetGraph
      • find

        public java.util.Iterator<Quad> find()
        Description copied from interface: DatasetGraph
        Iterate over all quads in the dataset graph
        Specified by:
        find in interface DatasetGraph
      • contains

        public boolean contains​(Quad quad)
        Description copied from interface: DatasetGraph
        Test whether the dataset contains a quad (including default graph)- may include wildcards, Node.ANY or null
        Specified by:
        contains in interface DatasetGraph
      • contains

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

        public void clear()
        Description copied from interface: DatasetGraph
        Remove everything - remove all named graphs, clear the default graph
        Specified by:
        clear in interface DatasetGraph
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: DatasetGraph
        Test whether the dataset is empty
        Specified by:
        isEmpty in interface DatasetGraph
      • size

        public long size()
        Description copied from interface: DatasetGraph
        Get the size (number of named graphs) - may be -1 for unknown
        Specified by:
        size in interface DatasetGraph
      • getLock

        public Lock getLock()
        Description copied from interface: DatasetGraph
        Return a lock for the dataset to help with concurrency control
        Specified by:
        getLock in interface DatasetGraph
        See Also:
        Lock
      • close

        public void close()
        Description copied from interface: DatasetGraph
        Close the dataset
        Specified by:
        close in interface org.apache.jena.atlas.lib.Closeable
        Specified by:
        close in interface DatasetGraph
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object