Class CollectionGraph

  • All Implemented Interfaces:
    Graph, GraphWithPerform

    public class CollectionGraph
    extends GraphBase
    A simple graph implementation that wraps a collection of triples. This is intended to be used in places where a graph is required but iteration is the only expected operation. All graph operations are supported but many are not efficient and will be slow on large collections. In these cases a memory based graph will be more efficient.

    This implementation:

    • Does not support deleting triples from the iterator
    • Does not handle literal typing
    • Constructor Detail

      • CollectionGraph

        public CollectionGraph()
        Construct an empty graph using an empty HashSet. Iterator deletion is supported.
      • CollectionGraph

        public CollectionGraph​(java.util.Collection<Triple> triples)
        Construct a graph from a collection. Iterator deletion is not supported.
        Parameters:
        triples - The collection of triples.
    • Method Detail

      • performAdd

        public void performAdd​(Triple t)
        Description copied from class: GraphBase
        Add a triple to the triple store. The default implementation throws an AddDeniedException; subclasses must override if they want to be able to add triples.
        Specified by:
        performAdd in interface GraphWithPerform
        Overrides:
        performAdd in class GraphBase
      • performDelete

        public void performDelete​(Triple t)
        Description copied from class: GraphBase
        Remove a triple from the triple store. The default implementation throws a DeleteDeniedException; subclasses must override if they want to be able to remove triples.
        Specified by:
        performDelete in interface GraphWithPerform
        Overrides:
        performDelete in class GraphBase
      • getCapabilities

        public Capabilities getCapabilities()
        Description copied from class: GraphBase
        Answer the capabilities of this graph; the default is an AllCapabilities object (the same one each time, not that it matters - Capabilities should be immutable).
        Specified by:
        getCapabilities in interface Graph
        Overrides:
        getCapabilities in class GraphBase