Class AbstractTinkerGraph
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerGraph
 
- 
- All Implemented Interfaces:
- AutoCloseable,- Graph,- Host
 - Direct Known Subclasses:
- TinkerGraph,- TinkerTransactionGraph
 
 public abstract class AbstractTinkerGraph extends Object implements Graph Base class forTinkerGraphandTinkerTransactionGraph. Contains common methods, variables and constants, but leaves the work with elements and indices to concrete implementations.- Author:
- Valentyn Kahamlyk
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classAbstractTinkerGraph.DefaultIdManagerA default set ofAbstractTinkerGraph.IdManagerimplementations for common identifier types.static interfaceAbstractTinkerGraph.IdManager<T>TinkerGraph will use an implementation of this interface to generate identifiers when a user does not supply them and to handle identifier conversions when querying to provide better flexibility with respect to handling different data types that mean the same thing.classAbstractTinkerGraph.TinkerGraphEdgeFeaturesclassAbstractTinkerGraph.TinkerGraphVertexFeaturesclassAbstractTinkerGraph.TinkerGraphVertexPropertyFeatures- 
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.GraphGraph.Exceptions, Graph.Features, Graph.Hidden, Graph.OptIn, Graph.OptIns, Graph.OptOut, Graph.OptOuts, Graph.Variables
 
- 
 - 
Field Summary
 - 
Constructor SummaryConstructors Constructor Description AbstractTinkerGraph()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract EdgeaddEdge(TinkerVertex outVertex, TinkerVertex inVertex, String label, Object... keyValues)protected abstract voidaddInEdge(TinkerVertex vertex, String label, Edge edge)protected abstract voidaddOutEdge(TinkerVertex vertex, String label, Edge edge)abstract VertexaddVertex(Object... keyValues)Add aVertexto the graph given an optional series of key/value pairs.voidclear()Clear internal graph datavoidclose()This method only has an effect if theGREMLIN_TINKERGRAPH_GRAPH_LOCATIONis set, in which case the data in the graph is persisted to that location.GraphComputercompute()Generate aGraphComputerusing the default engine of the underlying graph system.<C extends GraphComputer>
 Ccompute(Class<C> graphComputerClass)Declare theGraphComputerto use for OLAP operations on the graph.org.apache.commons.configuration2.Configurationconfiguration()Get theConfigurationassociated with the construction of this graph.protected TinkerEdgecreateTinkerEdge(Object id, Vertex outVertex, String label, Vertex inVertex)protected TinkerEdgecreateTinkerEdge(Object id, Vertex outVertex, String label, Vertex inVertex, long currentVersion)protected TinkerVertexcreateTinkerVertex(Object id, String label, AbstractTinkerGraph graph)protected TinkerVertexcreateTinkerVertex(Object id, String label, AbstractTinkerGraph graph, long currentVersion)abstract Edgeedge(Object edgeId)ReturnEdgeby id.abstract Iterator<Edge>edges(Object... edgeIds)abstract intgetEdgesCount()Graph-specific implementation for number of vertices.<E extends Element>
 Set<String>getIndexedKeys(Class<E> elementClass)abstract intgetVerticesCount()Graph-specific implementation for number of vertices.abstract booleanhasEdge(Object id)abstract booleanhasVertex(Object id)protected TinkerServiceRegistry.TinkerServiceFactoryinstantiate(String className)<I extends Io>
 Iio(Io.Builder<I> builder)Construct a particularIoimplementation for reading and writing theGraphand other data.protected voidloadGraph()abstract voidremoveEdge(Object edgeId)abstract voidremoveVertex(Object vertexId)protected voidsaveGraph()protected static <T extends Element>
 AbstractTinkerGraph.IdManager<T>selectIdManager(org.apache.commons.configuration2.Configuration config, String configKey, Class<T> clazz)Construct anAbstractTinkerGraph.IdManagerfrom the TinkerGraphConfiguration.StringtoString()voidtouch(TinkerEdge edge)MarkEdgeas changed in transaction.voidtouch(TinkerVertex vertex)MarkVertexas changed in transaction.abstract Transactiontx()Configure and control the transactions for those graphs that support this feature.Graph.Variablesvariables()A collection of globalGraph.Variablesassociated with the graph.abstract Vertexvertex(Object vertexId)ReturnVertexby id.abstract Iterator<Vertex>vertices(Object... vertexIds)
 
- 
- 
- 
Field Detail- 
GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGERpublic static final String GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER - See Also:
- Constant Field Values
 
 - 
GREMLIN_TINKERGRAPH_EDGE_ID_MANAGERpublic static final String GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER - See Also:
- Constant Field Values
 
 - 
GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGERpublic static final String GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER - See Also:
- Constant Field Values
 
 - 
GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITYpublic static final String GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY - See Also:
- Constant Field Values
 
 - 
GREMLIN_TINKERGRAPH_GRAPH_LOCATIONpublic static final String GREMLIN_TINKERGRAPH_GRAPH_LOCATION - See Also:
- Constant Field Values
 
 - 
GREMLIN_TINKERGRAPH_GRAPH_FORMATpublic static final String GREMLIN_TINKERGRAPH_GRAPH_FORMAT - See Also:
- Constant Field Values
 
 - 
GREMLIN_TINKERGRAPH_ALLOW_NULL_PROPERTY_VALUESpublic static final String GREMLIN_TINKERGRAPH_ALLOW_NULL_PROPERTY_VALUES - See Also:
- Constant Field Values
 
 - 
GREMLIN_TINKERGRAPH_SERVICEpublic static final String GREMLIN_TINKERGRAPH_SERVICE - See Also:
- Constant Field Values
 
 - 
currentIdprotected AtomicLong currentId 
 - 
variablesprotected TinkerGraphVariables variables 
 - 
graphComputerViewprotected TinkerGraphComputerView graphComputerView 
 - 
vertexIndexprotected AbstractTinkerIndex<TinkerVertex> vertexIndex 
 - 
edgeIndexprotected AbstractTinkerIndex<TinkerEdge> edgeIndex 
 - 
vertexIdManagerprotected AbstractTinkerGraph.IdManager<Vertex> vertexIdManager 
 - 
edgeIdManagerprotected AbstractTinkerGraph.IdManager<Edge> edgeIdManager 
 - 
vertexPropertyIdManagerprotected AbstractTinkerGraph.IdManager<VertexProperty> vertexPropertyIdManager 
 - 
defaultVertexPropertyCardinalityprotected VertexProperty.Cardinality defaultVertexPropertyCardinality 
 - 
allowNullPropertyValuesprotected boolean allowNullPropertyValues 
 - 
serviceRegistryprotected TinkerServiceRegistry serviceRegistry 
 - 
configurationprotected org.apache.commons.configuration2.Configuration configuration 
 - 
graphLocationprotected String graphLocation 
 - 
graphFormatprotected String graphFormat 
 
- 
 - 
Method Detail- 
removeVertexpublic abstract void removeVertex(Object vertexId) 
 - 
addEdgepublic abstract Edge addEdge(TinkerVertex outVertex, TinkerVertex inVertex, String label, Object... keyValues) 
 - 
removeEdgepublic abstract void removeEdge(Object edgeId) 
 - 
touchpublic void touch(TinkerVertex vertex) MarkVertexas changed in transaction. If the graph does not support transactions, then does nothing.- Parameters:
- vertex-
 
 - 
touchpublic void touch(TinkerEdge edge) MarkEdgeas changed in transaction. If the graph does not support transactions, then does nothing.- Parameters:
- edge-
 
 - 
vertexpublic abstract Vertex vertex(Object vertexId) ReturnVertexby id. Does not create an iterator, so is the preferred method when only 1 element needs to be returned.- Parameters:
- vertexId-
- Returns:
- Vertex
 
 - 
verticespublic abstract Iterator<Vertex> vertices(Object... vertexIds) Get theVertexobjects in this graph with the provided vertex ids orVertexobjects themselves. If no ids are provided, get all vertices. Note that a vertex 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 theGraph.Featuresaround id support, multiple arguments might be applicable here. If the graph returntrueforGraph.Features.ElementFeatures.supportsNumericIds()then it should support filters as with:- g.vertices(v)
- g.vertices(v.id())
- g.vertices(1)
- g.vertices(1L)
- g.vertices(1.0d)
- g.vertices(1.0f)
- g.vertices("1")
 trueforGraph.Features.ElementFeatures.supportsCustomIds()()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id())
- g.vertices(v.id().toString())
 trueforGraph.Features.ElementFeatures.supportsAnyIds()()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id())
 trueforGraph.Features.ElementFeatures.supportsStringIds()()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id().toString())
- g.vertices("id")
 trueforGraph.Features.ElementFeatures.supportsStringIds()()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id().toString())
- g.vertices("id")
 
 - 
edgepublic abstract Edge edge(Object edgeId) ReturnEdgeby id. Does not create an iterator, so is the preferred method when only 1 element needs to be returned.- Parameters:
- edgeId-
- Returns:
- Edge
 
 - 
edgespublic abstract Iterator<Edge> edges(Object... edgeIds) Get theEdgeobjects in this graph with the provided edge ids orEdgeobjects. 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 theGraph.Featuresaround id support, multiple arguments might be applicable here. If the graph returntrueforGraph.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")
 trueforGraph.Features.ElementFeatures.supportsCustomIds()()} then it should support filters as with:- g.edges(e)
- g.edges(e.id())
- g.edges(e.id().toString())
 trueforGraph.Features.ElementFeatures.supportsAnyIds()()} then it should support filters as with:- g.edges(e)
- g.edges(e.id())
 trueforGraph.Features.ElementFeatures.supportsStringIds()()} then it should support filters as with:- g.edges(e)
- g.edges(e.id().toString())
- g.edges("id")
 
 - 
txpublic abstract Transaction tx() Configure and control the transactions for those graphs that support this feature.
 - 
getVerticesCountpublic abstract int getVerticesCount() Graph-specific implementation for number of vertices.- Returns:
- count of vertices in Graph.
 
 - 
hasVertexpublic abstract boolean hasVertex(Object id) 
 - 
getEdgesCountpublic abstract int getEdgesCount() Graph-specific implementation for number of vertices.- Returns:
- count of vertices in Graph.
 
 - 
hasEdgepublic abstract boolean hasEdge(Object id) 
 - 
loadGraphprotected void loadGraph() 
 - 
saveGraphprotected void saveGraph() 
 - 
iopublic <I extends Io> I io(Io.Builder<I> builder) Description copied from interface:GraphConstruct a particularIoimplementation for reading and writing theGraphand other data. End-users will "select" theIoimplementation that they want to use by supplying theIo.Builderthat constructs it. In this way,Graphvendors can supply theirIoRegistryto that builder thus allowing for custom serializers to be auto-configured into theIoinstance. Registering custom serializers is particularly useful for those graphs that have complex types forElementidentifiers. 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 theIo.Builder.graph(Graph)method.
 - 
computepublic <C extends GraphComputer> C compute(Class<C> graphComputerClass) Description copied from interface:GraphDeclare theGraphComputerto use for OLAP operations on the graph. If the graph does not support graph computer then anUnsupportedOperationExceptionis thrown.
 - 
computepublic GraphComputer compute() Description copied from interface:GraphGenerate aGraphComputerusing the default engine of the underlying graph system. This is a shorthand method for the more involved method that usesGraph.compute(Class).
 - 
variablespublic Graph.Variables variables() Description copied from interface:GraphA collection of globalGraph.Variablesassociated with the graph. Variables are used for storing metadata about the graph.
 - 
clearpublic void clear() Clear internal graph data
 - 
closepublic void close() This method only has an effect if theGREMLIN_TINKERGRAPH_GRAPH_LOCATIONis 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:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Graph
 
 - 
configurationpublic org.apache.commons.configuration2.Configuration configuration() Description copied from interface:GraphGet theConfigurationassociated with the construction of this graph. Whatever configuration was passed toGraphFactory.open(Configuration)is what should be returned by this method.- Specified by:
- configurationin interface- Graph
- Returns:
- the configuration used during graph construction.
 
 - 
addOutEdgeprotected abstract void addOutEdge(TinkerVertex vertex, String label, Edge edge) 
 - 
addInEdgeprotected abstract void addInEdge(TinkerVertex vertex, String label, Edge edge) 
 - 
createTinkerVertexprotected TinkerVertex createTinkerVertex(Object id, String label, AbstractTinkerGraph graph) 
 - 
createTinkerVertexprotected TinkerVertex createTinkerVertex(Object id, String label, AbstractTinkerGraph graph, long currentVersion) 
 - 
createTinkerEdgeprotected TinkerEdge createTinkerEdge(Object id, Vertex outVertex, String label, Vertex inVertex) 
 - 
createTinkerEdgeprotected TinkerEdge createTinkerEdge(Object id, Vertex outVertex, String label, Vertex inVertex, long currentVersion) 
 - 
getIndexedKeyspublic <E extends Element> Set<String> getIndexedKeys(Class<E> elementClass) - 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
 
 - 
selectIdManagerprotected static <T extends Element> AbstractTinkerGraph.IdManager<T> selectIdManager(org.apache.commons.configuration2.Configuration config, String configKey, Class<T> clazz) Construct anAbstractTinkerGraph.IdManagerfrom the TinkerGraphConfiguration.
 - 
instantiateprotected TinkerServiceRegistry.TinkerServiceFactory instantiate(String className) 
 
- 
 
-