public class DetachedVertex extends DetachedElement<Vertex> implements Vertex
Vertex
that is disconnected from a Graph
. "Disconnection" can mean detachment from
a Graph
in the sense that a Vertex
was constructed from a Graph
instance and this reference
was removed or it can mean that the DetachedVertex
could have been constructed independently of a
Graph
instance in the first place.
DetachedVertex
only has reference to the properties that are associated with it at the time of detachment
(or construction) and is not traversable or mutable.Vertex.Exceptions
id, label, properties
DEFAULT_LABEL
Modifier | Constructor and Description |
---|---|
|
DetachedVertex(Object id,
String label,
Map<String,Object> properties) |
protected |
DetachedVertex(Vertex vertex,
boolean withProperties) |
Modifier and Type | Method and Description |
---|---|
Edge |
addEdge(String label,
Vertex inVertex,
Object... keyValues)
Add an outgoing edge to the vertex with provided label and edge properties as key/value pairs.
|
static Vertex |
addTo(Graph graph,
DetachedVertex detachedVertex) |
Vertex |
attach(Graph hostGraph) |
Vertex |
attach(Vertex hostVertex) |
GraphTraversal<Vertex,Edge> |
edges(Direction direction,
String... edgeLabels)
Gets an
Iterator of incident edges. |
<V> Iterator<VertexProperty<V>> |
properties(String... propertyKeys)
Get an
Iterator of properties. |
<V> VertexProperty<V> |
property(String key)
Get a
Property for the Element given its key. |
<V> VertexProperty<V> |
property(String key,
V value)
Add or set a property value for the
Element given its key. |
<V> VertexProperty<V> |
property(VertexProperty.Cardinality cardinality,
String key,
V value,
Object... keyValues)
Create a new vertex property.
|
String |
toString() |
GraphTraversal<Vertex,Vertex> |
vertices(Direction direction,
String... labels)
Gets an
Iterator of adjacent vertices. |
equals, graph, hashCode, id, label, remove
protected DetachedVertex(Vertex vertex, boolean withProperties)
public <V> VertexProperty<V> property(String key, V value)
Element
Element
given its key.property
in interface Element
property
in interface Vertex
property
in class DetachedElement<Vertex>
V
- the type of the value of the vertex propertykey
- the key of the vertex propertyvalue
- The value of the vertex propertypublic <V> VertexProperty<V> property(VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues)
Vertex
VertexProperty.Cardinality.single
, then set the key to the value.
If the cardinality is VertexProperty.Cardinality.list
, then add a new value to the key.
If the cardinality is VertexProperty.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.property
in interface Vertex
V
- the type of the value of the vertex propertycardinality
- 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 propertiespublic <V> VertexProperty<V> property(String key)
Element
Property
for the Element
given its key.
The default implementation calls the raw Element.properties(java.lang.String...)
.property
in interface Element
property
in interface Vertex
property
in class DetachedElement<Vertex>
V
- the expected type of the vertex property valuekey
- the key of the vertex property to getpublic Edge addEdge(String label, Vertex inVertex, Object... keyValues)
Vertex
String
property keys and the even numbered arguments are the related property values.public Vertex attach(Vertex hostVertex)
attach
in interface Attachable<Vertex>
public Vertex attach(Graph hostGraph)
attach
in interface Attachable<Vertex>
public static Vertex addTo(Graph graph, DetachedVertex detachedVertex)
public <V> Iterator<VertexProperty<V>> properties(String... propertyKeys)
Element
Iterator
of properties.properties
in interface Element
properties
in interface Vertex
properties
in class DetachedElement<Vertex>
public GraphTraversal<Vertex,Edge> edges(Direction direction, String... edgeLabels)
Vertex
Iterator
of incident edges.public GraphTraversal<Vertex,Vertex> vertices(Direction direction, String... labels)
Vertex
Iterator
of adjacent vertices.vertices
in interface Vertex
direction
- The adjacency direction of the vertices to retrieve off this vertexlabels
- The labels of the edges associated with the vertices to retrieve. If no labels are provided, then get all edges.Copyright © 2013–2015 Apache Software Foundation. All rights reserved.