Class TinkerVertex
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement
-
- org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex
-
public class TinkerVertex extends TinkerElement implements Vertex
- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Element
Element.Exceptions
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Vertex
Vertex.Exceptions
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractTinkerGraph
graph
protected Map<String,Set<Edge>>
inEdges
protected Map<String,Set<Object>>
inEdgesId
protected Map<String,Set<Edge>>
outEdges
protected Map<String,Set<Object>>
outEdgesId
protected Map<String,List<VertexProperty>>
properties
-
Fields inherited from class org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement
currentVersion, id, label, removed
-
Fields inherited from interface org.apache.tinkerpop.gremlin.structure.Vertex
DEFAULT_LABEL, EMPTY_ARGS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TinkerVertex(Object id, String label, AbstractTinkerGraph graph)
protected
TinkerVertex(Object id, String label, AbstractTinkerGraph graph, long currentVersion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Edge
addEdge(String label, Vertex vertex, Object... keyValues)
Add an outgoing edge to the vertex with provided label and edge properties as key/value pairs.Object
clone()
protected <V> TinkerVertexProperty<V>
createTinkerVertexProperty(Object id, TinkerVertex vertex, String key, V value, Object... propertyKeyValues)
protected <V> TinkerVertexProperty<V>
createTinkerVertexProperty(TinkerVertex vertex, String key, V value, Object... propertyKeyValues)
Iterator<Edge>
edges(Direction direction, String... edgeLabels)
Gets anIterator
of incident edges.Graph
graph()
Get the graph that this element is within.Set<String>
keys()
Get the keys of the properties associated with this element.<V> Iterator<VertexProperty<V>>
properties(String... propertyKeys)
Get anIterator
of properties where thepropertyKeys
is meant to be a filter on the available keys.<V> VertexProperty<V>
property(String key)
Get theVertexProperty
for the provided key.<V> VertexProperty<V>
property(VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues)
Create a new vertex property.void
remove()
Removes theElement
from the graph.String
toString()
Iterator<Vertex>
vertices(Direction direction, String... edgeLabels)
Gets anIterator
of adjacent vertices.-
Methods inherited from class org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement
elementAlreadyRemoved, equals, hashCode, id, label, version
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
properties
protected Map<String,List<VertexProperty>> properties
-
graph
protected final AbstractTinkerGraph graph
-
-
Constructor Detail
-
TinkerVertex
protected TinkerVertex(Object id, String label, AbstractTinkerGraph graph)
-
TinkerVertex
protected TinkerVertex(Object id, String label, AbstractTinkerGraph graph, long currentVersion)
-
-
Method Detail
-
clone
public Object clone()
- Specified by:
clone
in classTinkerElement
-
graph
public Graph graph()
Description copied from interface:Element
Get the graph that this element is within.
-
property
public <V> VertexProperty<V> property(String key)
Description copied from interface:Vertex
Get theVertexProperty
for the provided key. If the property does not exist, returnVertexProperty.empty()
. If there are more than one vertex properties for the provided key, then throwVertex.Exceptions.multiplePropertiesExistForProvidedKey(java.lang.String)
.
-
property
public <V> VertexProperty<V> property(VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues)
Description copied from interface:Vertex
Create a new vertex property. If the cardinality isVertexProperty.Cardinality.single
, then set the key to the value. If the cardinality isVertexProperty.Cardinality.list
, then add a new value to the key. If the cardinality isVertexProperty.Cardinality.set
, then only add a new value if that value doesn't already exist for the key. If the value already exists for the key, add the provided key value vertex property properties to it.- Specified by:
property
in interfaceVertex
- Type Parameters:
V
- the type of the value of the vertex property- Parameters:
cardinality
- the desired cardinality of the property keykey
- the key of the vertex propertyvalue
- The value of the vertex propertykeyValues
- the key/value pairs to turn into vertex property properties- Returns:
- the newly created vertex property
-
keys
public Set<String> keys()
Description copied from interface:Element
Get the keys of the properties associated with this element. The default implementation iterators the properties and stores the keys into aHashSet
.
-
addEdge
public Edge addEdge(String label, Vertex vertex, Object... keyValues)
Description copied from interface:Vertex
Add an outgoing edge to the vertex with provided label and edge properties as key/value pairs. These key/values must be provided in an even number where the odd numbered arguments areString
property keys and the even numbered arguments are the related property values.
-
remove
public void remove()
Description copied from interface:Element
Removes theElement
from the graph.
-
edges
public Iterator<Edge> edges(Direction direction, String... edgeLabels)
Description copied from interface:Vertex
Gets anIterator
of incident edges.
-
vertices
public Iterator<Vertex> vertices(Direction direction, String... edgeLabels)
Description copied from interface:Vertex
Gets anIterator
of adjacent vertices.- Specified by:
vertices
in interfaceVertex
- Parameters:
direction
- The adjacency direction of the vertices to retrieve off this vertexedgeLabels
- The labels of the edges associated with the vertices to retrieve. If no labels are provided, then get all edges.- Returns:
- An iterator of vertices meeting the provided specification
-
createTinkerVertexProperty
protected <V> TinkerVertexProperty<V> createTinkerVertexProperty(TinkerVertex vertex, String key, V value, Object... propertyKeyValues)
-
createTinkerVertexProperty
protected <V> TinkerVertexProperty<V> createTinkerVertexProperty(Object id, TinkerVertex vertex, String key, V value, Object... propertyKeyValues)
-
properties
public <V> Iterator<VertexProperty<V>> properties(String... propertyKeys)
Description copied from interface:Vertex
Get anIterator
of properties where thepropertyKeys
is meant to be a filter on the available keys. If no keys are provide then return all the properties.- Specified by:
properties
in interfaceElement
- Specified by:
properties
in interfaceVertex
-
-