Class TinkerGraph

  • All Implemented Interfaces:
    AutoCloseable, Graph, Host

    public class TinkerGraph
    extends AbstractTinkerGraph
    An in-memory (with optional persistence on calls to AbstractTinkerGraph.close()), reference implementation of the property graph interfaces provided by TinkerPop.
    Author:
    Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)
    • Method Detail

      • open

        public static TinkerGraph open()
        Open a new TinkerGraph instance.

        Reference Implementation Help: If a Graph implementation does not require a Configuration (or perhaps has a default configuration) it can choose to implement a zero argument open() method. This is an optional constructor method for TinkerGraph. It is not enforced by the Gremlin Test Suite.

      • open

        public static TinkerGraph open​(org.apache.commons.configuration2.Configuration configuration)
        Open a new TinkerGraph instance.

        Reference Implementation Help: This method is the one use by the GraphFactory to instantiate Graph instances. This method must be overridden for the Structure Test Suite to pass. Implementers have latitude in terms of how exceptions are handled within this method. Such exceptions will be considered implementation specific by the test suite as all test generate graph instances by way of GraphFactory. As such, the exceptions get generalized behind that facade and since GraphFactory is the preferred method to opening graphs it will be consistent at that level.

        Parameters:
        configuration - the configuration for the instance
        Returns:
        a newly opened Graph
      • addVertex

        public Vertex addVertex​(Object... keyValues)
        Description copied from class: AbstractTinkerGraph
        Add a Vertex to the graph given an optional series of key/value pairs. These key/values must be provided in an even number where the odd numbered arguments are String property keys and the even numbered arguments are the related property values.
        Specified by:
        addVertex in interface Graph
        Specified by:
        addVertex in class AbstractTinkerGraph
        Parameters:
        keyValues - The key/value pairs to turn into vertex properties
        Returns:
        The newly created vertex
      • getServiceRegistry

        public TinkerServiceRegistry getServiceRegistry()
        Description copied from interface: Graph
        Get the ServiceRegistry associated with the graph. Used by CallStep to invoke service calls.
        Returns:
        The registry of callable services
      • features

        public Graph.Features features()
        Return TinkerGraph feature set.

        Reference Implementation Help: Implementers only need to implement features for which there are negative or instance configured features. By default, all Graph.Features return true.

      • createIndex

        public <E extends Element> void createIndex​(String key,
                                                    Class<E> elementClass)
        Create an index for said element class (Vertex or Edge) and said property key. Whenever an element has the specified key mutated, the index is updated. When the index is created, all existing elements are indexed to ensure that they are captured by the index.
        Type Parameters:
        E - The type of the element class
        Parameters:
        key - the property key to index
        elementClass - the element class to index
      • dropIndex

        public <E extends Element> void dropIndex​(String key,
                                                  Class<E> elementClass)
        Drop the index for the specified element class (Vertex or Edge) and key.
        Type Parameters:
        E - The type of the element class
        Parameters:
        key - the property key to stop indexing
        elementClass - the element class of the index to drop