public interface Path extends Iterable<GraphNode>
Clients typically obtain instances of this class by calling GraphNode.asPath()
, for
example:
GraphNode n = dseSession.executeGraph("g.V().hasLabel('some_vertex').outE().inV().path()").one(); Path path = n.asPath();
Modifier and Type | Method and Description |
---|---|
List<Set<String>> |
getLabels()
Returns the sets of labels of the steps traversed by this path, or an empty list, if this path
is empty.
|
GraphNode |
getObject(int index)
Returns the object associated with the given step of this path.
|
GraphNode |
getObject(String label)
Returns the first object with the given label in this path.
|
List<GraphNode> |
getObjects()
Returns the objects traversed by this path, or an empty list, if this path is empty.
|
List<GraphNode> |
getObjects(String label)
Returns the objects with the given label in this path.
|
boolean |
hasLabel(String label)
Returns whether this path has at least one step with the given label.
|
int |
size()
Returns the size of this path, that is, the number of steps this path traversed.
|
forEach, iterator, spliterator
List<Set<String>> getLabels()
The returned list is immutable.
List<GraphNode> getObjects()
The returned list is immutable.
int size()
GraphNode getObject(int index)
The step index is zero-based, i.e. the first step has index 0
.
If the index is out of bounds, this method returns null
; no exception will be
thrown.
index
- the zero-based step index to find the object for.GraphNode getObject(String label)
If the label is associated with more then one step, then this method returns the object at the first step with that label.
If the label does not exist in this path, this method returns null
.
label
- the label to find an object for.List<GraphNode> getObjects(String label)
If the label is unique, the returned list will contain only one element.
If the label is associated with more then one step, then the list will contain as many elements as the number of times the label appears in this path's steps, in order.
If the label does not exist in this path, an empty list is returned.
The returned list is immutable.
label
- the label to find objects for.boolean hasLabel(String label)
label
- the label to search.true
if this path has at least one step with the given label, false
otherwise.Copyright © 2012–2018. All rights reserved.