Class AbstractTinkerGraph

    • Constructor Detail

      • AbstractTinkerGraph

        public AbstractTinkerGraph()
    • Method Detail

      • addVertex

        public abstract Vertex addVertex​(Object... keyValues)
        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
        Parameters:
        keyValues - The key/value pairs to turn into vertex properties
        Returns:
        The newly created vertex
      • removeVertex

        public abstract void removeVertex​(Object vertexId)
      • removeEdge

        public abstract void removeEdge​(Object edgeId)
      • touch

        public void touch​(TinkerVertex vertex)
        Mark Vertex as changed in transaction. If the graph does not support transactions, then does nothing.
        Parameters:
        vertex -
      • touch

        public void touch​(TinkerEdge edge)
        Mark Edge as changed in transaction. If the graph does not support transactions, then does nothing.
        Parameters:
        edge -
      • vertex

        public abstract Vertex vertex​(Object vertexId)
        Return Vertex by id. Does not create an iterator, so is the preferred method when only 1 element needs to be returned.
        Parameters:
        vertexId -
        Returns:
        Vertex
      • edge

        public abstract Edge edge​(Object edgeId)
        Return Edge by id. Does not create an iterator, so is the preferred method when only 1 element needs to be returned.
        Parameters:
        edgeId -
        Returns:
        Edge
      • edges

        public abstract Iterator<Edge> edges​(Object... edgeIds)
        Get the Edge objects in this graph with the provided edge ids or Edge objects. If no ids are provided, get all edges. Note that an edge identifier does not need to correspond to the actual id used in the graph. It needs to be a bit more flexible than that in that given the Graph.Features around id support, multiple arguments might be applicable here.

        If the graph return true for Graph.Features.ElementFeatures.supportsNumericIds() then it should support filters as with:

        • g.edges(e)
        • g.edges(e.id())
        • g.edges(1)
        • g.edges(1L)
        • g.edges(1.0d)
        • g.edges(1.0f)
        • g.edges("1")

        If the graph return true for Graph.Features.ElementFeatures.supportsCustomIds() ()} then it should support filters as with:

        • g.edges(e)
        • g.edges(e.id())
        • g.edges(e.id().toString())

        If the graph return true for Graph.Features.ElementFeatures.supportsAnyIds() ()} then it should support filters as with:

        • g.edges(e)
        • g.edges(e.id())

        If the graph return true for Graph.Features.ElementFeatures.supportsStringIds() ()} then it should support filters as with:

        • g.edges(e)
        • g.edges(e.id().toString())
        • g.edges("id")
        Specified by:
        edges in interface Graph
        Parameters:
        edgeIds - the ids of the edges to get
        Returns:
        an Iterator of edges that match the provided edge ids
      • tx

        public abstract Transaction tx()
        Configure and control the transactions for those graphs that support this feature.
        Specified by:
        tx in interface Graph
      • getVerticesCount

        public abstract int getVerticesCount()
        Graph-specific implementation for number of vertices.
        Returns:
        count of vertices in Graph.
      • hasVertex

        public abstract boolean hasVertex​(Object id)
      • getEdgesCount

        public abstract int getEdgesCount()
        Graph-specific implementation for number of vertices.
        Returns:
        count of vertices in Graph.
      • hasEdge

        public abstract boolean hasEdge​(Object id)
      • loadGraph

        protected void loadGraph()
      • saveGraph

        protected void saveGraph()
      • io

        public <I extends Io> I io​(Io.Builder<I> builder)
        Description copied from interface: Graph
        Construct a particular Io implementation for reading and writing the Graph and other data. End-users will "select" the Io implementation that they want to use by supplying the Io.Builder that constructs it. In this way, Graph vendors can supply their IoRegistry to that builder thus allowing for custom serializers to be auto-configured into the Io instance. Registering custom serializers is particularly useful for those graphs that have complex types for Element identifiers.

        For those graphs that do not need to register any custom serializers, the default implementation should suffice. If the default is overridden, take care to register the current graph via the Io.Builder.graph(Graph) method.
        Specified by:
        io in interface Graph
      • compute

        public <C extends GraphComputer> C compute​(Class<C> graphComputerClass)
        Description copied from interface: Graph
        Declare the GraphComputer to use for OLAP operations on the graph. If the graph does not support graph computer then an UnsupportedOperationException is thrown.
        Specified by:
        compute in interface Graph
        Parameters:
        graphComputerClass - The graph computer class to use.
        Returns:
        A graph computer for processing this graph
      • compute

        public GraphComputer compute()
        Description copied from interface: Graph
        Generate a GraphComputer using the default engine of the underlying graph system. This is a shorthand method for the more involved method that uses Graph.compute(Class).
        Specified by:
        compute in interface Graph
        Returns:
        A default graph computer
      • variables

        public Graph.Variables variables()
        Description copied from interface: Graph
        A collection of global Graph.Variables associated with the graph. Variables are used for storing metadata about the graph.
        Specified by:
        variables in interface Graph
        Returns:
        The variables associated with this graph
      • clear

        public void clear()
        Clear internal graph data
      • close

        public void close()
        This method only has an effect if the GREMLIN_TINKERGRAPH_GRAPH_LOCATION is set, in which case the data in the graph is persisted to that location. This method may be called multiple times and does not release resources.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Graph
      • configuration

        public org.apache.commons.configuration2.Configuration configuration()
        Description copied from interface: Graph
        Get the Configuration associated with the construction of this graph. Whatever configuration was passed to GraphFactory.open(Configuration) is what should be returned by this method.
        Specified by:
        configuration in interface Graph
        Returns:
        the configuration used during graph construction.
      • getIndexedKeys

        public <E extends ElementSet<String> getIndexedKeys​(Class<E> elementClass)
        Return all the keys currently being index for said element class (Vertex or Edge).
        Type Parameters:
        E - The type of the element class
        Parameters:
        elementClass - the element class to get the indexed keys for
        Returns:
        the set of keys currently being indexed