public final class TinkerGraph extends Object implements Graph
close()), reference implementation of the property
graph interfaces provided by TinkerPop.| Modifier and Type | Class and Description |
|---|---|
static class |
TinkerGraph.DefaultIdManager
A default set of
TinkerGraph.IdManager implementations for common identifier types. |
static interface |
TinkerGraph.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.
|
class |
TinkerGraph.TinkerGraphEdgeFeatures |
class |
TinkerGraph.TinkerGraphFeatures |
class |
TinkerGraph.TinkerGraphGraphFeatures |
class |
TinkerGraph.TinkerGraphVertexFeatures |
class |
TinkerGraph.TinkerGraphVertexPropertyFeatures |
Graph.Exceptions, Graph.Features, Graph.Hidden, Graph.OptIn, Graph.OptIns, Graph.OptOut, Graph.OptOuts, Graph.Variables| Modifier and Type | Method and Description |
|---|---|
Vertex |
addVertex(Object... keyValues)
Add a
Vertex to the graph given an optional series of key/value pairs. |
void |
clear() |
void |
close()
Closing a
Graph is equivalent to "shutdown" and implies that no futher operations can be executed on
the instance. |
GraphComputer |
compute()
Generate a
GraphComputer using the default engine of the underlying graph system. |
<C extends GraphComputer> |
compute(Class<C> graphComputerClass)
Declare the
GraphComputer to use for OLAP operations on the graph. |
Configuration |
configuration()
Get the
org.apache.commons.configuration.Configuration associated with the construction of this graph. |
<E extends Element> |
createIndex(String key,
Class<E> elementClass)
|
<E extends Element> |
dropIndex(String key,
Class<E> elementClass)
|
Iterator<Edge> |
edges(Object... edgeIds)
|
Graph.Features |
features()
Return TinkerGraph feature set.
|
<E extends Element> |
getIndexedKeys(Class<E> elementClass)
|
<I extends Io> |
io(Io.Builder<I> builder)
Construct a particular
Io implementation for reading and writing the Graph and other data. |
static TinkerGraph |
open()
Open a new
TinkerGraph instance. |
static TinkerGraph |
open(Configuration configuration)
Open a new
TinkerGraph instance. |
String |
toString() |
Transaction |
tx()
Configure and control the transactions for those graphs that support this feature.
|
Graph.Variables |
variables()
A collection of global
Graph.Variables associated with the graph. |
Iterator<Vertex> |
vertices(Object... vertexIds)
|
@Deprecated public static final String CONFIG_VERTEX_ID
GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER@Deprecated public static final String CONFIG_EDGE_ID
GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER@Deprecated public static final String CONFIG_VERTEX_PROPERTY_ID
GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER@Deprecated public static final String CONFIG_DEFAULT_VERTEX_PROPERTY_CARDINALITY
GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY@Deprecated public static final String CONFIG_GRAPH_LOCATION
GREMLIN_TINKERGRAPH_GRAPH_LOCATION@Deprecated public static final String CONFIG_GRAPH_FORMAT
GREMLIN_TINKERGRAPH_GRAPH_FORMATpublic static final String GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER
public static final String GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER
public static final String GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER
public static final String GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY
public static final String GREMLIN_TINKERGRAPH_GRAPH_LOCATION
public static final String GREMLIN_TINKERGRAPH_GRAPH_FORMAT
protected AtomicLong currentId
protected TinkerGraphVariables variables
protected TinkerGraphComputerView graphComputerView
protected org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIndex<TinkerVertex> vertexIndex
protected org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIndex<TinkerEdge> edgeIndex
protected final TinkerGraph.IdManager<?> vertexIdManager
protected final TinkerGraph.IdManager<?> edgeIdManager
protected final TinkerGraph.IdManager<?> vertexPropertyIdManager
protected final VertexProperty.Cardinality defaultVertexPropertyCardinality
public static TinkerGraph open()
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.public static TinkerGraph open(Configuration configuration)
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.configuration - the configuration for the instanceGraphpublic <C extends GraphComputer> C compute(Class<C> graphComputerClass)
GraphGraphComputer to use for OLAP operations on the graph.
If the graph does not support graph computer then an UnsupportedOperationException is thrown.public GraphComputer compute()
GraphGraphComputer using the default engine of the underlying graph system.
This is a shorthand method for the more involved method that uses Graph.compute(Class).public Graph.Variables variables()
GraphGraph.Variables associated with the graph.
Variables are used for storing metadata about the graph.public <I extends Io> I io(Io.Builder<I> builder)
GraphIo 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.public void clear()
public void close()
GraphGraph is equivalent to "shutdown" and implies that no futher operations can be executed on
the instance. Users should consult the documentation of the underlying graph database implementation for what
this "shutdown" will mean as it pertains to open transactions. It will typically be the end user's
responsibility to synchronize the thread that calls close() with other threads that are accessing open
transactions. In other words, be sure that all work performed on the Graph instance is complete prior
to calling this method.close in interface AutoCloseableclose in interface Graphpublic Transaction tx()
GraphTransaction in the TinkerPop context is a
transaction "factory" or "controller" that helps manage transactions owned by the underlying graph database.public Configuration configuration()
Graphorg.apache.commons.configuration.Configuration associated with the construction of this graph.
Whatever configuration was passed to GraphFactory#open(org.apache.commons.configuration.Configuration)
is what should be returned by this method.configuration in interface Graphpublic Iterator<Vertex> vertices(Object... vertexIds)
GraphVertex objects in this graph with the provided vertex ids or Vertex objects 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 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:
true for Graph.Features.ElementFeatures.supportsCustomIds() ()} then it should support
filters as with:
true for Graph.Features.ElementFeatures.supportsAnyIds() ()} then it should support
filters as with:
true for Graph.Features.ElementFeatures.supportsStringIds() ()} then it should support
filters as with:
true for Graph.Features.ElementFeatures.supportsStringIds() ()} then it should support
filters as with:
public Iterator<Edge> edges(Object... edgeIds)
GraphEdge 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:
true for Graph.Features.ElementFeatures.supportsCustomIds() ()} then it should support
filters as with:
true for Graph.Features.ElementFeatures.supportsAnyIds() ()} then it should support
filters as with:
true for Graph.Features.ElementFeatures.supportsStringIds() ()} then it should support
filters as with:
public Graph.Features features()
Graph.Features return true.public <E extends Element> void createIndex(String key, Class<E> elementClass)
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.E - The type of the element classkey - the property key to indexelementClass - the element class to indexpublic <E extends Element> void dropIndex(String key, Class<E> elementClass)
E - The type of the element classkey - the property key to stop indexingelementClass - the element class of the index to dropCopyright © 2013–2016 Apache Software Foundation. All rights reserved.