Class TinkerVertex
java.lang.Object
org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement
org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex
- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Element
Element.ExceptionsNested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Vertex
Vertex.Exceptions -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AbstractTinkerGraphprotected Map<String,List<VertexProperty>> Multi-label storage for this vertex.Fields inherited from class org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement
currentVersion, id, label, removedFields inherited from interface org.apache.tinkerpop.gremlin.structure.Vertex
DEFAULT_LABEL, EMPTY_ARGS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTinkerVertex(Object id, String label, AbstractTinkerGraph graph) protectedTinkerVertex(Object id, String label, AbstractTinkerGraph graph, long currentVersion) protectedTinkerVertex(Object id, Set<String> labels, AbstractTinkerGraph graph) Constructs a TinkerVertex with multiple labels.protectedTinkerVertex(Object id, Set<String> labels, AbstractTinkerGraph graph, long currentVersion) Canonical constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdd an outgoing edge to the vertex with provided label and edge properties as key/value pairs.voidAdds one or more labels to this element.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) voidRemoves specific labels from this element.voidRemoves all labels from this element, triggering the provider's default label behavior.Gets anIteratorof incident edges.graph()Get the graph that this element is within.keys()Get the keys of the properties associated with this element.label()Deprecated.labels()Gets all labels for this element.<V> Iterator<VertexProperty<V>>properties(String... propertyKeys) Get anIteratorof properties where thepropertyKeysis meant to be a filter on the available keys.<V> VertexProperty<V>Get theVertexPropertyfor the provided key.<V> VertexProperty<V>property(VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues) Create a new vertex property.voidremove()Removes theElementfrom the graph.toString()Gets anIteratorof adjacent vertices.Methods inherited from class org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement
elementAlreadyRemoved, equals, hashCode, id, version
-
Field Details
-
properties
-
outEdges
-
inEdges
-
outEdgesId
-
inEdgesId
-
graph
-
vertexLabels
Multi-label storage for this vertex. Starts as an immutable set (lightweight) and is upgraded to a mutable ConcurrentHashMap-backed set on first label mutation. Concurrent label mutation on the same vertex from multiple threads is not supported.
-
-
Constructor Details
-
TinkerVertex
-
TinkerVertex
-
TinkerVertex
Constructs a TinkerVertex with multiple labels. -
TinkerVertex
protected TinkerVertex(Object id, Set<String> labels, AbstractTinkerGraph graph, long currentVersion) Canonical constructor. Constructs a TinkerVertex with multiple labels and a specific version (for transactional graphs). Uses a single-switch pattern to handle default label injection per the configured cardinality.
-
-
Method Details
-
labels
Description copied from interface:ElementGets all labels for this element.For
Vertex: may return zero or more labels (multi-label support). ForEdge: returns a singleton set (single label only in TinkerGraph). ForVertexProperty: returns a singleton set containing the property key. -
label
Deprecated.Description copied from interface:ElementGets the label for the graphElementwhich helps categorize it.- Specified by:
labelin interfaceElement- Overrides:
labelin classTinkerElement- Returns:
- The label of the element
-
addLabel
Description copied from interface:ElementAdds one or more labels to this element. -
dropLabels
public void dropLabels()Description copied from interface:ElementRemoves all labels from this element, triggering the provider's default label behavior.- Specified by:
dropLabelsin interfaceElement
-
dropLabel
Description copied from interface:ElementRemoves specific labels from this element. If this action removes all labels, triggers the provider's default label behavior. -
clone
- Specified by:
clonein classTinkerElement
-
graph
Description copied from interface:ElementGet the graph that this element is within. -
property
Description copied from interface:VertexGet theVertexPropertyfor 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:VertexCreate 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:
propertyin 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
Description copied from interface:ElementGet the keys of the properties associated with this element. The default implementation iterators the properties and stores the keys into aHashSet. -
addEdge
Description copied from interface:VertexAdd 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 areStringproperty keys and the even numbered arguments are the related property values. -
remove
public void remove()Description copied from interface:ElementRemoves theElementfrom the graph. -
toString
-
edges
Description copied from interface:VertexGets anIteratorof incident edges. -
vertices
Description copied from interface:VertexGets anIteratorof adjacent vertices.- Specified by:
verticesin 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
Description copied from interface:VertexGet anIteratorof properties where thepropertyKeysis meant to be a filter on the available keys. If no keys are provide then return all the properties.- Specified by:
propertiesin interfaceElement- Specified by:
propertiesin interfaceVertex
-