java.lang.Object
org.apache.tinkerpop.gremlin.structure.util.detached.DetachedElement<Vertex>
org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex
All Implemented Interfaces:
Serializable, Element, Attachable<Vertex>, Host, Vertex

public class DetachedVertex extends DetachedElement<Vertex> implements Vertex
Represents a 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.

A 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.

Author:
Stephen Mallette (http://stephen.genoprime.com), Marko A. Rodriguez (http://markorodriguez.com)
See Also:
  • Field Details

    • vertexLabels

      protected Set<String> vertexLabels
  • Constructor Details

  • Method Details

    • label

      public String label()
      Description copied from interface: Element
      Gets the label for the graph Element which helps categorize it.
      Specified by:
      label in interface Element
      Overrides:
      label in class DetachedElement<Vertex>
      Returns:
      The label of the element
    • labels

      public Set<String> labels()
      Description copied from interface: Element
      Gets all labels for this element.

      For Vertex: may return zero or more labels (multi-label support). For Edge: returns a singleton set (single label only in TinkerGraph). For VertexProperty: returns a singleton set containing the property key.

      Specified by:
      labels in interface Element
      Overrides:
      labels in class DetachedElement<Vertex>
      Returns:
      An unmodifiable Set of labels; may be empty for vertices with no labels
    • property

      public <V> VertexProperty<V> property(String key, V value)
      Description copied from interface: Element
      Add or set a property value for the Element given its key.
      Specified by:
      property in interface Element
      Specified by:
      property in interface Vertex
      Overrides:
      property in class DetachedElement<Vertex>
      Type Parameters:
      V - the type of the value of the vertex property
      Parameters:
      key - the key of the vertex property
      value - The value of the vertex property
      Returns:
      the newly created vertex property
    • property

      public <V> VertexProperty<V> property(String key, V value, Object... keyValues)
      Description copied from interface: Vertex
      Set the provided key to the provided value using default VertexProperty.Cardinality for that key. The default cardinality can be vendor defined and is usually tied to the graph schema. The default implementation of this method determines the cardinality graph().features().vertex().getCardinality(key). The provided key/values are the properties of the newly created VertexProperty. These key/values must be provided in an even number where the odd numbered arguments are String.
      Specified by:
      property in interface Vertex
      Type Parameters:
      V - the type of the value of the vertex property
      Parameters:
      key - the key of the vertex property
      value - The value of the vertex property
      keyValues - the key/value pairs to turn into vertex property properties
      Returns:
      the newly created vertex property
    • 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 is 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.
      Specified by:
      property in interface Vertex
      Type Parameters:
      V - the type of the value of the vertex property
      Parameters:
      cardinality - the desired cardinality of the property key
      key - the key of the vertex property
      value - The value of the vertex property
      keyValues - the key/value pairs to turn into vertex property properties
      Returns:
      the newly created vertex property
    • property

      public <V> VertexProperty<V> property(String key)
      Description copied from interface: Element
      Get a Property for the Element given its key. The default implementation calls the raw Element.properties(java.lang.String...).
      Specified by:
      property in interface Element
      Specified by:
      property in interface Vertex
      Overrides:
      property in class DetachedElement<Vertex>
      Type Parameters:
      V - the expected type of the vertex property value
      Parameters:
      key - the key of the vertex property to get
      Returns:
      the retrieved vertex property
    • addEdge

      public Edge addEdge(String label, Vertex inVertex, 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 are String property keys and the even numbered arguments are the related property values.
      Specified by:
      addEdge in interface Vertex
      Parameters:
      label - The label of the edge
      inVertex - The vertex to receive an incoming edge from the current vertex
      keyValues - The key/value pairs to turn into edge properties
      Returns:
      the newly created edge
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • properties

      public <V> Iterator<VertexProperty<V>> properties(String... propertyKeys)
      Description copied from interface: Element
      Get an Iterator of properties where the propertyKeys is meant to be a filter on the available keys. If no keys are provide then return all the properties.
      Specified by:
      properties in interface Element
      Specified by:
      properties in interface Vertex
      Overrides:
      properties in class DetachedElement<Vertex>
    • edges

      public Iterator<Edge> edges(Direction direction, String... edgeLabels)
      Description copied from interface: Vertex
      Gets an Iterator of incident edges.
      Specified by:
      edges in interface Vertex
      Parameters:
      direction - The incident direction of the edges to retrieve off this vertex
      edgeLabels - The labels of the edges to retrieve. If no labels are provided, then get all edges.
      Returns:
      An iterator of edges meeting the provided specification
    • vertices

      public Iterator<Vertex> vertices(Direction direction, String... labels)
      Description copied from interface: Vertex
      Gets an Iterator of adjacent vertices.
      Specified by:
      vertices in interface Vertex
      Parameters:
      direction - The adjacency direction of the vertices to retrieve off this vertex
      labels - 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
    • remove

      public void remove()
      Description copied from interface: Element
      Removes the Element from the graph.
      Specified by:
      remove in interface Element
    • build

      public static DetachedVertex.Builder build()
      Provides a way to construct an immutable DetachedVertex.