Class TinkerTransactionGraph
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerGraph
-
- org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerTransactionGraph
-
- All Implemented Interfaces:
AutoCloseable,Graph,Host
public final class TinkerTransactionGraph extends AbstractTinkerGraph
An in-memory (with optional persistence on calls toAbstractTinkerGraph.close()), reference implementation of the property graph interfaces with transaction support provided by TinkerPop.- Author:
- Valentyn Kahamlyk
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classTinkerTransactionGraph.TinkerGraphFeaturesclassTinkerTransactionGraph.TinkerGraphGraphFeatures-
Nested classes/interfaces inherited from class org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerGraph
AbstractTinkerGraph.DefaultIdManager, AbstractTinkerGraph.IdManager<T>, AbstractTinkerGraph.TinkerGraphEdgeFeatures, AbstractTinkerGraph.TinkerGraphVertexFeatures, AbstractTinkerGraph.TinkerGraphVertexPropertyFeatures
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Graph
Graph.Exceptions, Graph.Features, Graph.Hidden, Graph.OptIn, Graph.OptIns, Graph.OptOut, Graph.OptOuts, Graph.Variables
-
-
Field Summary
-
Fields inherited from class org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerGraph
allowNullPropertyValues, configuration, currentId, defaultVertexPropertyCardinality, edgeIdManager, edgeIndex, graphComputerView, graphFormat, graphLocation, GREMLIN_TINKERGRAPH_ALLOW_NULL_PROPERTY_VALUES, GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, GREMLIN_TINKERGRAPH_GRAPH_FORMAT, GREMLIN_TINKERGRAPH_GRAPH_LOCATION, GREMLIN_TINKERGRAPH_SERVICE, GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, serviceRegistry, variables, vertexIdManager, vertexIndex, vertexPropertyIdManager
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeaddEdge(TinkerVertex outVertex, TinkerVertex inVertex, String label, Object... keyValues)protected voidaddInEdge(TinkerVertex vertex, String label, Edge edge)protected voidaddOutEdge(TinkerVertex vertex, String label, Edge edge)VertexaddVertex(Object... keyValues)voidclear()Clear internal graph data<E extends Element>
voidcreateIndex(String key, Class<E> elementClass)<E extends Element>
voiddropIndex(String key, Class<E> elementClass)Edgeedge(Object edgeId)ReturnEdgeby id.Iterator<Edge>edges(Object... edgeIds)Graph.Featuresfeatures()Return TinkerGraph feature set.intgetEdgesCount()Graph-specific implementation for number of vertices.TinkerServiceRegistrygetServiceRegistry()intgetVerticesCount()Graph-specific implementation for number of vertices.booleanhasEdge(Object id)booleanhasVertex(Object id)static TinkerTransactionGraphopen()Open a newTinkerTransactionGraphinstance.static TinkerTransactionGraphopen(org.apache.commons.configuration2.Configuration configuration)Open a newTinkerGraphinstance.voidremoveEdge(Object edgeId)voidremoveVertex(Object vertexId)voidtouch(TinkerEdge edge)MarkEdgeas changed in transaction.voidtouch(TinkerVertex vertex)MarkVertexas changed in transaction.Transactiontx()Vertexvertex(Object vertexId)ReturnVertexby id.Iterator<Vertex>vertices(Object... vertexIds)-
Methods inherited from class org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerGraph
close, compute, compute, configuration, createTinkerEdge, createTinkerEdge, createTinkerVertex, createTinkerVertex, getIndexedKeys, instantiate, io, loadGraph, saveGraph, selectIdManager, toString, variables
-
-
-
-
Method Detail
-
open
public static TinkerTransactionGraph open()
Open a newTinkerTransactionGraphinstance. Reference Implementation Help: If aGraphimplementation does not require aConfiguration(or perhaps has a default configuration) it can choose to implement a zero argumentopen()method. This is an optional constructor method for TinkerGraph. It is not enforced by the Gremlin Test Suite.
-
open
public static TinkerTransactionGraph open(org.apache.commons.configuration2.Configuration configuration)
Open a newTinkerGraphinstance. Reference Implementation Help: This method is the one use by theGraphFactoryto instantiateGraphinstances. 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 ofGraphFactory. As such, the exceptions get generalized behind that facade and sinceGraphFactoryis 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- Specified by:
addVertexin interfaceGraph- Specified by:
addVertexin classAbstractTinkerGraph
-
removeVertex
public void removeVertex(Object vertexId)
Description copied from class:AbstractTinkerGraph- Specified by:
removeVertexin classAbstractTinkerGraph
-
touch
public void touch(TinkerVertex vertex)
Description copied from class:AbstractTinkerGraphMarkVertexas changed in transaction. If the graph does not support transactions, then does nothing.- Overrides:
touchin classAbstractTinkerGraph
-
touch
public void touch(TinkerEdge edge)
Description copied from class:AbstractTinkerGraphMarkEdgeas changed in transaction. If the graph does not support transactions, then does nothing.- Overrides:
touchin classAbstractTinkerGraph
-
addEdge
public Edge addEdge(TinkerVertex outVertex, TinkerVertex inVertex, String label, Object... keyValues)
Description copied from class:AbstractTinkerGraph- Specified by:
addEdgein classAbstractTinkerGraph
-
removeEdge
public void removeEdge(Object edgeId)
Description copied from class:AbstractTinkerGraph- Specified by:
removeEdgein classAbstractTinkerGraph
-
clear
public void clear()
Description copied from class:AbstractTinkerGraphClear internal graph data- Overrides:
clearin classAbstractTinkerGraph
-
tx
public Transaction tx()
Description copied from class:AbstractTinkerGraph- Specified by:
txin interfaceGraph- Specified by:
txin classAbstractTinkerGraph
-
getVerticesCount
public int getVerticesCount()
Description copied from class:AbstractTinkerGraphGraph-specific implementation for number of vertices.- Specified by:
getVerticesCountin classAbstractTinkerGraph- Returns:
- count of vertices in Graph.
-
hasVertex
public boolean hasVertex(Object id)
Description copied from class:AbstractTinkerGraph- Specified by:
hasVertexin classAbstractTinkerGraph
-
getEdgesCount
public int getEdgesCount()
Description copied from class:AbstractTinkerGraphGraph-specific implementation for number of vertices.- Specified by:
getEdgesCountin classAbstractTinkerGraph- Returns:
- count of vertices in Graph.
-
hasEdge
public boolean hasEdge(Object id)
Description copied from class:AbstractTinkerGraph- Specified by:
hasEdgein classAbstractTinkerGraph
-
getServiceRegistry
public TinkerServiceRegistry getServiceRegistry()
-
vertex
public Vertex vertex(Object vertexId)
Description copied from class:AbstractTinkerGraphReturnVertexby id. Does not create an iterator, so is the preferred method when only 1 element needs to be returned.- Specified by:
vertexin classAbstractTinkerGraph- Returns:
- Vertex
-
vertices
public Iterator<Vertex> vertices(Object... vertexIds)
Description copied from class:AbstractTinkerGraph- Specified by:
verticesin interfaceGraph- Specified by:
verticesin classAbstractTinkerGraph
-
edge
public Edge edge(Object edgeId)
Description copied from class:AbstractTinkerGraphReturnEdgeby id. Does not create an iterator, so is the preferred method when only 1 element needs to be returned.- Specified by:
edgein classAbstractTinkerGraph- Returns:
- Edge
-
edges
public Iterator<Edge> edges(Object... edgeIds)
Description copied from class:AbstractTinkerGraph- Specified by:
edgesin interfaceGraph- Specified by:
edgesin classAbstractTinkerGraph
-
addOutEdge
protected void addOutEdge(TinkerVertex vertex, String label, Edge edge)
- Specified by:
addOutEdgein classAbstractTinkerGraph
-
addInEdge
protected void addInEdge(TinkerVertex vertex, String label, Edge edge)
- Specified by:
addInEdgein classAbstractTinkerGraph
-
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, allGraph.Featuresreturn true.
-
createIndex
public <E extends Element> void createIndex(String key, Class<E> elementClass)
Create an index for said element class (VertexorEdge) 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 indexelementClass- the element class to index
-
-