Interface GraphTraversal<S,E>
-
- All Superinterfaces:
AutoCloseable
,Cloneable
,Iterator<E>
,Serializable
,Traversal<S,E>
- All Known Subinterfaces:
CredentialTraversal<S,E>
,CredentialTraversalDsl<S,E>
,GraphTraversal.Admin<S,E>
- All Known Implementing Classes:
DefaultCredentialTraversal
,DefaultGraphTraversal
public interface GraphTraversal<S,E> extends Traversal<S,E>
- Author:
- Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
GraphTraversal.Admin<S,E>
static class
GraphTraversal.Symbols
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal
Traversal.Exceptions
-
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default GraphTraversal<S,Edge>
addE(String edgeLabel)
Adds anEdge
with the specified edge label.default GraphTraversal<S,Edge>
addE(Traversal<?,String> edgeLabelTraversal)
default GraphTraversal<S,Vertex>
addV()
Adds aVertex
with a default vertex label.default GraphTraversal<S,Vertex>
addV(String vertexLabel)
Adds aVertex
.default GraphTraversal<S,Vertex>
addV(Traversal<?,String> vertexLabelTraversal)
default GraphTraversal<S,E>
aggregate(String sideEffectKey)
Eagerly collects objects up to this step into a side-effect.default GraphTraversal<S,E>
aggregate(Scope scope, String sideEffectKey)
Collects objects in a list using theScope
argument to determine whether it should be lazyScope.local
or eager (Scope.global
while gathering those objects.default <S2> GraphTraversal<S,E>
all(P<S2> predicate)
FiltersE
lists given the providedpredicate
.default GraphTraversal<S,E>
and(Traversal<?,?>... andTraversals)
Ensures that all of the provided traversals yield a result.default <S2> GraphTraversal<S,E>
any(P<S2> predicate)
FiltersE
lists given the providedpredicate
.default GraphTraversal<S,E>
as(String stepLabel, String... stepLabels)
A step modulator that provides a label to the step that can be accessed later in the traversal by other steps.default GraphTraversal.Admin<S,E>
asAdmin()
Get access to administrative methods of the traversal via its accompanyingTraversal.Admin
.default GraphTraversal<S,Date>
asDate()
Parse value of the incoming traverser as an ISO-8601Date
.default GraphTraversal<S,String>
asString()
Returns the value of incoming traverser as strings.default GraphTraversal<S,E>
barrier()
Turns the lazy traversal pipeline into a bulk-synchronous pipeline which basically iterates that traversal to the size of the barrier.default GraphTraversal<S,E>
barrier(int maxBarrierSize)
Turns the lazy traversal pipeline into a bulk-synchronous pipeline which basically iterates that traversal to the size of the barrier.default GraphTraversal<S,E>
barrier(Consumer<TraverserSet<Object>> barrierConsumer)
Turns the lazy traversal pipeline into a bulk-synchronous pipeline which basically iterates that traversal to the size of the barrier.default GraphTraversal<S,Vertex>
both(String... edgeLabels)
Map theVertex
to its adjacent vertices given the edge labels.default GraphTraversal<S,Edge>
bothE(String... edgeLabels)
Map theVertex
to its incident edges given the edge labels.default GraphTraversal<S,Vertex>
bothV()
Map theEdge
to its incident vertices.default <M,E2>
GraphTraversal<S,E2>branch(Function<Traverser<E>,M> function)
Split theTraverser
to all the specified functions.default <M,E2>
GraphTraversal<S,E2>branch(Traversal<?,M> branchTraversal)
Split theTraverser
to all the specified traversals.default GraphTraversal<S,E>
by()
Theby()
can be applied to a number of different step to alter their behaviors.default GraphTraversal<S,E>
by(String key)
Theby()
can be applied to a number of different step to alter their behaviors.default <V> GraphTraversal<S,E>
by(String key, Comparator<V> comparator)
Theby()
can be applied to a number of different step to alter their behaviors.default GraphTraversal<S,E>
by(Comparator<E> comparator)
Theby()
can be applied to a number of different step to alter their behaviors.default <U> GraphTraversal<S,E>
by(Function<U,Object> function, Comparator comparator)
Theby()
can be applied to a number of different step to alter their behaviors.default <V> GraphTraversal<S,E>
by(Function<V,Object> function)
Theby()
can be applied to a number of different step to alter their behaviors.default GraphTraversal<S,E>
by(Order order)
Theby()
can be applied to a number of different step to alter their behaviors.default GraphTraversal<S,E>
by(Traversal<?,?> traversal)
Theby()
can be applied to a number of different step to alter their behaviors.default <V> GraphTraversal<S,E>
by(Traversal<?,?> traversal, Comparator<V> comparator)
Theby()
can be applied to a number of different step to alter their behaviors.default GraphTraversal<S,E>
by(T token)
Theby()
can be applied to a number of different step to alter their behaviors.default <E> GraphTraversal<S,E>
call(String service)
Perform the specified service call with no parameters.default <E> GraphTraversal<S,E>
call(String service, Map params)
Perform the specified service call with the specified static parameters.default <E> GraphTraversal<S,E>
call(String service, Map params, Traversal<?,Map<?,?>> childTraversal)
Perform the specified service call with both static and dynamic parameters produced by the specified child traversal.default <E> GraphTraversal<S,E>
call(String service, Traversal<?,Map<?,?>> childTraversal)
Perform the specified service call with dynamic parameters produced by the specified child traversal.default <E2> GraphTraversal<S,E2>
cap(String sideEffectKey, String... sideEffectKeys)
Iterates the traversal up to the itself and emits the side-effect referenced by the key.default <M,E2>
GraphTraversal<S,E2>choose(Function<E,M> choiceFunction)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal.default <E2> GraphTraversal<S,E2>
choose(Predicate<E> choosePredicate, Traversal<?,E2> trueChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then like semantics within a traversal.default <E2> GraphTraversal<S,E2>
choose(Predicate<E> choosePredicate, Traversal<?,E2> trueChoice, Traversal<?,E2> falseChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal.default <E2> GraphTraversal<S,E2>
choose(Traversal<?,?> traversalPredicate, Traversal<?,E2> trueChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then like semantics within a traversal.default <E2> GraphTraversal<S,E2>
choose(Traversal<?,?> traversalPredicate, Traversal<?,E2> trueChoice, Traversal<?,E2> falseChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal.default <M,E2>
GraphTraversal<S,E2>choose(Traversal<?,M> choiceTraversal)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal.default <E2> GraphTraversal<S,E2>
coalesce(Traversal<?,E2>... coalesceTraversals)
Evaluates the provided traversals and returns the result of the first traversal to emit at least one object.default GraphTraversal<S,E>
coin(double probability)
Filter theE
object given a biased coin toss.default GraphTraversal<S,List<?>>
combine(Object values)
Combines the list traverser and list argument.default GraphTraversal<S,String>
concat(String... concatStrings)
Concatenate an arbitrary number of strings to the incoming traverser.default GraphTraversal<S,String>
concat(Traversal<?,String> concatTraversal, Traversal<?,String>... otherConcatTraversals)
Concatenate values of an arbitrary number of string traversals to the incoming traverser.default GraphTraversal<S,String>
conjoin(String delimiter)
Joins together the elements of the incoming list traverser together with the provided delimiter.default GraphTraversal<S,E>
connectedComponent()
Executes a Connected Component algorithm over the graph.default <E2> GraphTraversal<S,E2>
constant(E2 e)
Map any object to a fixedE
value.default GraphTraversal<S,Long>
count()
Map the traversal stream to its reduction as a sum of theTraverser.bulk()
values (i.e.default GraphTraversal<S,Long>
count(Scope scope)
Map the traversal stream to its reduction as a sum of theTraverser.bulk()
values given the specifiedScope
(i.e.default GraphTraversal<S,E>
cyclicPath()
default GraphTraversal<S,Date>
dateAdd(DT dateToken, int value)
Increase value of inputDate
.default GraphTraversal<S,Long>
dateDiff(Date value)
Returns the difference between twoDate
in epoch time.default GraphTraversal<S,Long>
dateDiff(Traversal<?,Date> dateTraversal)
Returns the difference between twoDate
in epoch time.default GraphTraversal<S,E>
dedup(String... dedupLabels)
Remove all duplicates in the traversal stream up to this point.default GraphTraversal<S,E>
dedup(Scope scope, String... dedupLabels)
Remove all duplicates in the traversal stream up to this point.default GraphTraversal<S,Set<?>>
difference(Object values)
Calculates the difference between the list traverser and list argument.default GraphTraversal<S,Set<?>>
disjunct(Object values)
Calculates the disjunction between the list traverser and list argument.default GraphTraversal<S,E>
drop()
Removes elements and properties from the graph.default GraphTraversal<S,Edge>
E(Object... edgeIdsOrElements)
AE
step is usually used to start a traversal but it may also be used mid-traversal.default GraphTraversal<S,Element>
element()
default <E2> GraphTraversal<S,Map<Object,E2>>
elementMap(String... propertyKeys)
default GraphTraversal<S,E>
emit()
Emit is used in conjunction withrepeat(Traversal)
to emit all objects from the loop.default GraphTraversal<S,E>
emit(Predicate<Traverser<E>> emitPredicate)
Emit is used in conjunction withrepeat(Traversal)
to determine what objects get emit from the loop.default GraphTraversal<S,E>
emit(Traversal<?,?> emitTraversal)
Emit is used in conjunction withrepeat(Traversal)
to determine what objects get emit from the loop.default GraphTraversal<S,E>
fail()
When triggered, immediately throws aRuntimeException
which implements theFailure
interface.default GraphTraversal<S,E>
fail(String message)
When triggered, immediately throws aRuntimeException
which implements theFailure
interface.default GraphTraversal<S,E>
filter(Predicate<Traverser<E>> predicate)
Map theTraverser
to eithertrue
orfalse
, wherefalse
will not pass the traverser to the next step.default GraphTraversal<S,E>
filter(Traversal<?,?> filterTraversal)
Map theTraverser
to eithertrue
orfalse
, wherefalse
will not pass the traverser to the next step.default <E2> GraphTraversal<S,E2>
flatMap(Function<Traverser<E>,Iterator<E2>> function)
default <E2> GraphTraversal<S,E2>
flatMap(Traversal<?,E2> flatMapTraversal)
default GraphTraversal<S,List<E>>
fold()
Rolls up objects in the stream into an aggregate list.default <E2> GraphTraversal<S,E2>
fold(E2 seed, BiFunction<E2,E,E2> foldFunction)
Rolls up objects in the stream into an aggregate value as defined by aseed
andBiFunction
.default GraphTraversal<S,E>
from(String fromStepLabel)
Providefrom()
-modulation to respective steps.default GraphTraversal<S,E>
from(Traversal<?,Vertex> fromVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the outgoing vertex of the newly addedEdge
.default GraphTraversal<S,E>
from(Vertex fromVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the outgoing vertex of the newly addedEdge
.default <K,V>
GraphTraversal<S,Map<K,V>>group()
Organize objects in the stream into aMap
.default GraphTraversal<S,E>
group(String sideEffectKey)
Organize objects in the stream into aMap
.default <K> GraphTraversal<S,Map<K,Long>>
groupCount()
Counts the number of times a particular objects has been part of a traversal, returning aMap
where the object is the key and the value is the count.default GraphTraversal<S,E>
groupCount(String sideEffectKey)
Counts the number of times a particular objects has been part of a traversal, returning aMap
where the object is the key and the value is the count.default GraphTraversal<S,E>
has(String propertyKey)
Filters vertices, edges and vertex properties based on the existence of properties.default GraphTraversal<S,E>
has(String propertyKey, Object value)
Filters vertices, edges and vertex properties based on their properties.default GraphTraversal<S,E>
has(String label, String propertyKey, Object value)
Filters vertices, edges and vertex properties based on their properties.default GraphTraversal<S,E>
has(String label, String propertyKey, P<?> predicate)
Filters vertices, edges and vertex properties based on their properties.default GraphTraversal<S,E>
has(String propertyKey, P<?> predicate)
Filters vertices, edges and vertex properties based on their properties.default GraphTraversal<S,E>
has(String propertyKey, Traversal<?,?> propertyTraversal)
Filters vertices, edges and vertex properties based on the value of the specified property key.default GraphTraversal<S,E>
has(T accessor, Object value)
Filters vertices, edges and vertex properties based on their properties.default GraphTraversal<S,E>
has(T accessor, P<?> predicate)
Filters vertices, edges and vertex properties based on their properties.default GraphTraversal<S,E>
has(T accessor, Traversal<?,?> propertyTraversal)
default GraphTraversal<S,E>
hasId(Object id, Object... otherIds)
Filters vertices, edges and vertex properties based on their identifier.default GraphTraversal<S,E>
hasId(P<Object> predicate)
Filters vertices, edges and vertex properties based on their identifier.default GraphTraversal<S,E>
hasKey(String label, String... otherLabels)
FiltersProperty
objects based on their key.default GraphTraversal<S,E>
hasKey(P<String> predicate)
FiltersProperty
objects based on their key.default GraphTraversal<S,E>
hasLabel(String label, String... otherLabels)
Filters vertices, edges and vertex properties based on their label.default GraphTraversal<S,E>
hasLabel(P<String> predicate)
Filters vertices, edges and vertex properties based on their label.default GraphTraversal<S,E>
hasNot(String propertyKey)
Filters vertices, edges and vertex properties based on the non-existence of properties.default GraphTraversal<S,E>
hasValue(Object value, Object... otherValues)
FiltersProperty
objects based on their value.default GraphTraversal<S,E>
hasValue(P<Object> predicate)
FiltersProperty
objects based on their value.Note that calling this step withnull
is the same as callinghasValue(Object, Object...)
with a singlenull
.default GraphTraversal<S,Object>
id()
Map theElement
to itsElement.id()
.default GraphTraversal<S,E>
identity()
Map theE
object to itself.default GraphTraversal<S,Vertex>
in(String... edgeLabels)
Map theVertex
to its incoming adjacent vertices given the edge labels.default <E2> GraphTraversal<S,E2>
index()
Indexes all items of the current collection.default GraphTraversal<S,Edge>
inE(String... edgeLabels)
Map theVertex
to its incoming incident edges given the edge labels.default GraphTraversal<S,E>
inject(E... injections)
Provides a way to add arbitrary objects to a traversal stream.default GraphTraversal<S,Set<?>>
intersect(Object values)
Calculates the intersection between the list traverser and list argument.default GraphTraversal<S,Vertex>
inV()
default GraphTraversal<S,E>
is(Object value)
Filter theE
object if it is notP.eq(V)
to the provided value.default GraphTraversal<S,E>
is(P<E> predicate)
FiltersE
object values given the providedpredicate
.default GraphTraversal<S,E>
iterate()
Iterates the traversal presumably for the generation of side-effects.default GraphTraversal<S,String>
key()
Map theProperty
to itsProperty.key()
.default GraphTraversal<S,String>
label()
Map theElement
to itsElement.label()
.default GraphTraversal<S,Integer>
length()
Returns the length incoming string traverser.default GraphTraversal<S,E>
limit(long limit)
Filter the objects in the traversal by the number of them to pass through the stream, where only the firstn
objects are allowed as defined by thelimit
argument.default <E2> GraphTraversal<S,E2>
limit(Scope scope, long limit)
Filter the objects in the traversal by the number of them to pass through the stream given theScope
, where only the firstn
objects are allowed as defined by thelimit
argument.default <E2> GraphTraversal<S,E2>
local(Traversal<?,E2> localTraversal)
Provides a execute a specified traversal on a single element within a stream.default GraphTraversal<S,Integer>
loops()
If theTraverser
supports looping then calling this method will extract the number of loops for that traverser.default GraphTraversal<S,Integer>
loops(String loopName)
If theTraverser
supports looping then calling this method will extract the number of loops for that traverser for the named loop.default GraphTraversal<S,String>
lTrim()
Returns a string with leading whitespace removed.default <E2> GraphTraversal<S,E2>
map(Function<Traverser<E>,E2> function)
default <E2> GraphTraversal<S,E2>
map(Traversal<?,E2> mapTraversal)
default <E2> GraphTraversal<S,Map<String,E2>>
match(Traversal<?,?>... matchTraversals)
default GraphTraversal<S,Double>
math(String expression)
default <E2 extends Comparable>
GraphTraversal<S,E2>max()
Determines the largest value in the stream.default <E2 extends Comparable>
GraphTraversal<S,E2>max(Scope scope)
Determines the largest value in the stream given theScope
.default <E2 extends Number>
GraphTraversal<S,E2>mean()
Determines the mean value in the stream.default <E2 extends Number>
GraphTraversal<S,E2>mean(Scope scope)
Determines the mean value in the stream given theScope
.default GraphTraversal<S,?>
merge(Object values)
Merges the list traverser and list argument.default GraphTraversal<S,Edge>
mergeE()
Spawns aGraphTraversal
by doing a merge (i.e.default GraphTraversal<S,Edge>
mergeE(Map<Object,Object> searchCreate)
Spawns aGraphTraversal
by doing a merge (i.e.default GraphTraversal<S,Edge>
mergeE(Traversal<?,Map<Object,Object>> searchCreate)
Spawns aGraphTraversal
by doing a merge (i.e.default GraphTraversal<S,Vertex>
mergeV()
Performs a merge (i.e.default GraphTraversal<S,Vertex>
mergeV(Map<Object,Object> searchCreate)
Performs a merge (i.e.default GraphTraversal<S,Vertex>
mergeV(Traversal<?,Map<Object,Object>> searchCreate)
Performs a merge (i.e.default <E2 extends Comparable>
GraphTraversal<S,E2>min()
Determines the smallest value in the stream.default <E2 extends Comparable>
GraphTraversal<S,E2>min(Scope scope)
Determines the smallest value in the stream given theScope
.default GraphTraversal<S,E>
none()
Filter all traversers in the traversal.default GraphTraversal<S,E>
not(Traversal<?,?> notTraversal)
Removes objects from the traversal stream when the traversal provided as an argument returns any objects.default <M,E2>
GraphTraversal<S,E>option(M token, Map<Object,Object> m)
This is a step modulator to aTraversalOptionParent
likechoose()
ormergeV()
where the provided argument associated to thetoken
is applied according to the semantics of the step.default <M,E2>
GraphTraversal<S,E>option(M token, Traversal<?,E2> traversalOption)
This is a step modulator to aTraversalOptionParent
likechoose()
ormergeV()
where the provided argument associated to thetoken
is applied according to the semantics of the step.default <M,E2>
GraphTraversal<S,E>option(Merge merge, Map<Object,Object> m, VertexProperty.Cardinality cardinality)
This is a step modulator to aTraversalOptionParent
likechoose()
ormergeV()
where the provided argument associated to thetoken
is applied according to the semantics of the step.default <E2> GraphTraversal<S,E>
option(Traversal<?,E2> traversalOption)
This step modifieschoose(Function)
to specifies the available choices that might be executed.default <E2> GraphTraversal<S,E2>
optional(Traversal<?,E2> optionalTraversal)
Returns the result of the specified traversal if it yields a result, otherwise it returns the calling element.default GraphTraversal<S,E>
or(Traversal<?,?>... orTraversals)
Ensures that at least one of the provided traversals yield a result.default GraphTraversal<S,E>
order()
Order all the objects in the traversal up to this point and then emit them one-by-one in their ordered sequence.default GraphTraversal<S,E>
order(Scope scope)
Order either theScope.local
object (e.g.default GraphTraversal<S,Vertex>
otherV()
Map theEdge
to the incident vertex that was not just traversed from in the path history.default GraphTraversal<S,Vertex>
out(String... edgeLabels)
Map theVertex
to its outgoing adjacent vertices given the edge labels.default GraphTraversal<S,Edge>
outE(String... edgeLabels)
Map theVertex
to its outgoing incident edges given the edge labels.default GraphTraversal<S,Vertex>
outV()
default GraphTraversal<S,E>
pageRank()
Calculates a PageRank over the graph using a 0.85 for thealpha
value.default GraphTraversal<S,E>
pageRank(double alpha)
Calculates a PageRank over the graph.default GraphTraversal<S,Path>
path()
default GraphTraversal<S,E>
peerPressure()
Executes a Peer Pressure community detection algorithm over the graph.default GraphTraversal<S,List<List<?>>>
product(Object values)
Calculates the cartesian product between the list traverser and list argument.default GraphTraversal<S,TraversalMetrics>
profile()
Allows developers to examine statistical information about a traversal providing data like execution times, counts, etc.default GraphTraversal<S,E>
profile(String sideEffectKey)
Allows developers to examine statistical information about a traversal providing data like execution times, counts, etc.default GraphTraversal<S,E>
program(VertexProgram<?> vertexProgram)
Executes an arbitraryVertexProgram
over the graph.default <E2> GraphTraversal<S,Map<String,E2>>
project(String projectKey, String... otherProjectKeys)
Projects the current object in the stream into aMap
that is keyed by the provided labels.default <E2> GraphTraversal<S,? extends Property<E2>>
properties(String... propertyKeys)
Map theElement
to its associated properties given the provide property keys.default GraphTraversal<S,E>
property(Object key, Object value, Object... keyValues)
Sets the key and value of aProperty
.default GraphTraversal<S,E>
property(Map<Object,Object> value)
When aMap
is supplied then each of the key/value pairs in the map will be added as property.default GraphTraversal<S,E>
property(VertexProperty.Cardinality cardinality, Object key, Object value, Object... keyValues)
Sets aProperty
value and related meta properties if supplied, if supported by theGraph
and if theElement
is aVertexProperty
.default <E2> GraphTraversal<S,Map<String,E2>>
propertyMap(String... propertyKeys)
default GraphTraversal<S,E>
range(long low, long high)
Filter the objects in the traversal by the number of them to pass through the stream.default <E2> GraphTraversal<S,E2>
range(Scope scope, long low, long high)
Filter the objects in the traversal by the number of them to pass through the stream as constrained by theScope
.default GraphTraversal<S,E>
read()
This step is technically a step modulator for the theGraphTraversalSource.io(String)
step which instructs the step to perform a read with its given configuration.default GraphTraversal<S,E>
repeat(String loopName, Traversal<?,E> repeatTraversal)
This step is used for looping over a traversal given some break predicate and with a specified loop name.default GraphTraversal<S,E>
repeat(Traversal<?,E> repeatTraversal)
This step is used for looping over a traversal given some break predicate.default GraphTraversal<S,String>
replace(String oldChar, String newChar)
Returns a string with the specified characters in the original string replaced with the new characters.default GraphTraversal<S,?>
reverse()
Returns the reverse of the incoming traverser.default GraphTraversal<S,String>
rTrim()
Returns a string with trailing whitespace removed.default <E2> GraphTraversal<S,E2>
sack()
Map theTraverser
to itsTraverser.sack()
value.default <V,U>
GraphTraversal<S,E>sack(BiFunction<V,U,V> sackOperator)
Map theTraverser
to itsTraverser.sack()
value.default GraphTraversal<S,E>
sample(int amountToSample)
Allow some specified number of objects to pass through the stream.default GraphTraversal<S,E>
sample(Scope scope, int amountToSample)
Allow some specified number of objects to pass through the stream.default <E2> GraphTraversal<S,E2>
select(String selectKey)
Map theTraverser
to the object specified by theselectKey
.default <E2> GraphTraversal<S,Map<String,E2>>
select(String selectKey1, String selectKey2, String... otherSelectKeys)
default <E2> GraphTraversal<S,E2>
select(Pop pop, String selectKey)
default <E2> GraphTraversal<S,Map<String,E2>>
select(Pop pop, String selectKey1, String selectKey2, String... otherSelectKeys)
default <E2> GraphTraversal<S,E2>
select(Pop pop, Traversal<S,E2> keyTraversal)
default <E2> GraphTraversal<S,E2>
select(Traversal<S,E2> keyTraversal)
Map theTraverser
to the object specified by the key returned by thekeyTraversal
.default <E2> GraphTraversal<S,Collection<E2>>
select(Column column)
A version ofselect
that allows for the extraction of aColumn
from objects in the traversal.default GraphTraversal<S,Path>
shortestPath()
Executes a Shortest Path algorithm over the graph.default GraphTraversal<S,E>
sideEffect(Consumer<Traverser<E>> consumer)
Perform some operation on theTraverser
and pass it to the next step unmodified.default GraphTraversal<S,E>
sideEffect(Traversal<?,?> sideEffectTraversal)
Perform some operation on theTraverser
and pass it to the next step unmodified.default GraphTraversal<S,E>
simplePath()
default GraphTraversal<S,E>
skip(long skip)
Filters out the firstn
objects in the traversal.default <E2> GraphTraversal<S,E2>
skip(Scope scope, long skip)
Filters out the firstn
objects in the traversal.default GraphTraversal<S,List<String>>
split(String separator)
Returns a list of strings created by splitting the incoming string traverser around the matches of the given separator.default GraphTraversal<S,E>
store(String sideEffectKey)
Deprecated.As of release 3.4.3, replaced byaggregate(Scope, String)
usingScope.local
.default GraphTraversal<S,Edge>
subgraph(String sideEffectKey)
Extracts a portion of the graph being traversed into aGraph
object held in the specified side-effect key.default GraphTraversal<S,String>
substring(int startIndex)
Returns a substring of the incoming string traverser with a 0-based start index (inclusive) specified, to the end of the string.default GraphTraversal<S,String>
substring(int startIndex, int endIndex)
Returns a substring of the incoming string traverser with a 0-based start index (inclusive) and end index (exclusive).default <E2 extends Number>
GraphTraversal<S,E2>sum()
Map the traversal stream to its reduction as a sum of theTraverser.get()
values multiplied by theirTraverser.bulk()
(i.e.default <E2 extends Number>
GraphTraversal<S,E2>sum(Scope scope)
Map the traversal stream to its reduction as a sum of theTraverser.get()
values multiplied by theirTraverser.bulk()
given the specifiedScope
(i.e.default GraphTraversal<S,E>
tail()
Filters the objects in the traversal emitted as being last objects in the stream.default GraphTraversal<S,E>
tail(long limit)
Filters the objects in the traversal emitted as being last objects in the stream.default <E2> GraphTraversal<S,E2>
tail(Scope scope)
Filters the objects in the traversal emitted as being last objects in the stream given theScope
.default <E2> GraphTraversal<S,E2>
tail(Scope scope, long limit)
Filters the objects in the traversal emitted as being last objects in the stream given theScope
.default GraphTraversal<S,E>
timeLimit(long timeLimit)
Once the firstTraverser
hits this step, a count down is started.default GraphTraversal<S,E>
times(int maxLoops)
Modifies arepeat(Traversal)
to specify how many loops should occur before exiting.default GraphTraversal<S,E>
to(String toStepLabel)
Provideto()
-modulation to respective steps.default GraphTraversal<S,E>
to(Traversal<?,Vertex> toVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the incoming vertex of the newly addedEdge
.default GraphTraversal<S,Vertex>
to(Direction direction, String... edgeLabels)
Map theVertex
to its adjacent vertices given a direction and edge labels.default GraphTraversal<S,E>
to(Vertex toVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the incoming vertex of the newly addedEdge
.default GraphTraversal<S,Edge>
toE(Direction direction, String... edgeLabels)
Map theVertex
to its incident edges given the direction and edge labels.default GraphTraversal<S,String>
toLower()
Returns the lowercase representation of incoming string traverser.default GraphTraversal<S,String>
toUpper()
Returns the uppercase representation of incoming string traverser.default GraphTraversal<S,Vertex>
toV(Direction direction)
Map theEdge
to its incident vertices given the direction.default GraphTraversal<S,Tree>
tree()
Aggregates the emanating paths into aTree
data structure.default GraphTraversal<S,E>
tree(String sideEffectKey)
Aggregates the emanating paths into aTree
data structure.default GraphTraversal<S,String>
trim()
Returns a string with leading and trailing whitespace removed.default <E2> GraphTraversal<S,E2>
unfold()
Unrolls aIterator
,Iterable
orMap
into a linear form or simply emits the object if it is not one of those types.default <E2> GraphTraversal<S,E2>
union(Traversal<?,E2>... unionTraversals)
Merges the results of an arbitrary number of traversals.default GraphTraversal<S,E>
until(Predicate<Traverser<E>> untilPredicate)
Modifies arepeat(Traversal)
to determine when the loop should exit.default GraphTraversal<S,E>
until(Traversal<?,?> untilTraversal)
Modifies arepeat(Traversal)
to determine when the loop should exit.default GraphTraversal<S,Vertex>
V(Object... vertexIdsOrElements)
AV
step is usually used to start a traversal but it may also be used mid-traversal.default <E2> GraphTraversal<S,E2>
value()
Map theProperty
to itsProperty.value()
.default <E2> GraphTraversal<S,Map<Object,E2>>
valueMap(boolean includeTokens, String... propertyKeys)
Deprecated.As of release 3.4.0, deprecated in favor ofvalueMap(String...)
in conjunction withwith(String, Object)
or simple preferelementMap(String...)
.default <E2> GraphTraversal<S,Map<Object,E2>>
valueMap(String... propertyKeys)
default <E2> GraphTraversal<S,E2>
values(String... propertyKeys)
Map theElement
to the values of the associated properties given the provide property keys.default GraphTraversal<S,E>
where(String startKey, P<String> predicate)
Filters the current object based on the object itself or the path history.default GraphTraversal<S,E>
where(P<String> predicate)
Filters the current object based on the object itself or the path history.default GraphTraversal<S,E>
where(Traversal<?,?> whereTraversal)
Filters the current object based on the object itself or the path history.default GraphTraversal<S,E>
with(String key)
Provides a configuration to a step in the form of a key which is the same aswith(key, true)
.default GraphTraversal<S,E>
with(String key, Object value)
Provides a configuration to a step in the form of a key and value pair.default GraphTraversal<S,E>
write()
This step is technically a step modulator for the theGraphTraversalSource.io(String)
step which instructs the step to perform a write with its given configuration.-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal
close, explain, fill, forEachRemaining, forEachRemaining, next, notifyClose, promise, toBulkSet, toList, toSet, toStream, tryNext
-
-
-
-
Method Detail
-
asAdmin
default GraphTraversal.Admin<S,E> asAdmin()
Description copied from interface:Traversal
Get access to administrative methods of the traversal via its accompanyingTraversal.Admin
.
-
map
default <E2> GraphTraversal<S,E2> map(Function<Traverser<E>,E2> function)
- Parameters:
function
- the lambda expression that does the functional mapping- Returns:
- the traversal with an appended
LambdaMapStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
map
default <E2> GraphTraversal<S,E2> map(Traversal<?,E2> mapTraversal)
- Parameters:
mapTraversal
- the traversal expression that does the functional mapping- Returns:
- the traversal with an appended
LambdaMapStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
flatMap
default <E2> GraphTraversal<S,E2> flatMap(Function<Traverser<E>,Iterator<E2>> function)
Map aTraverser
referencing an object of typeE
to an iterator of objects of typeE2
. The resultant iterator is drained one-by-one before a newE
object is pulled in for processing.- Type Parameters:
E2
- the type of the returned iterator objects- Parameters:
function
- the lambda expression that does the functional mapping- Returns:
- the traversal with an appended
LambdaFlatMapStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
flatMap
default <E2> GraphTraversal<S,E2> flatMap(Traversal<?,E2> flatMapTraversal)
Map aTraverser
referencing an object of typeE
to an iterator of objects of typeE2
. The internal traversal is drained one-by-one before a newE
object is pulled in for processing.- Type Parameters:
E2
- the end type of the internal traversal- Parameters:
flatMapTraversal
- the traversal generating objects of typeE2
- Returns:
- the traversal with an appended
TraversalFlatMapStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
id
default GraphTraversal<S,Object> id()
Map theElement
to itsElement.id()
.- Returns:
- the traversal with an appended
IdStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Id Step
-
label
default GraphTraversal<S,String> label()
Map theElement
to itsElement.label()
.- Returns:
- the traversal with an appended
LabelStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Label Step
-
identity
default GraphTraversal<S,E> identity()
Map theE
object to itself. In other words, a "no op."- Returns:
- the traversal with an appended
IdentityStep
. - Since:
- 3.0.0-incubating
-
constant
default <E2> GraphTraversal<S,E2> constant(E2 e)
Map any object to a fixedE
value.- Returns:
- the traversal with an appended
ConstantStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Constant Step
-
V
default GraphTraversal<S,Vertex> V(Object... vertexIdsOrElements)
AV
step is usually used to start a traversal but it may also be used mid-traversal.- Parameters:
vertexIdsOrElements
- vertices to inject into the traversal- Returns:
- the traversal with an appended
GraphStep
- Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - Graph Step
-
E
default GraphTraversal<S,Edge> E(Object... edgeIdsOrElements)
AE
step is usually used to start a traversal but it may also be used mid-traversal.- Parameters:
edgeIdsOrElements
- edges to inject into the traversal- Returns:
- the traversal with an appended
GraphStep
- Since:
- 3.7.0
- See Also:
- Reference Documentation - E Step
-
to
default GraphTraversal<S,Vertex> to(Direction direction, String... edgeLabels)
Map theVertex
to its adjacent vertices given a direction and edge labels.- Parameters:
direction
- the direction to traverse from the current vertexedgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
out
default GraphTraversal<S,Vertex> out(String... edgeLabels)
Map theVertex
to its outgoing adjacent vertices given the edge labels.- Parameters:
edgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
in
default GraphTraversal<S,Vertex> in(String... edgeLabels)
Map theVertex
to its incoming adjacent vertices given the edge labels.- Parameters:
edgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
both
default GraphTraversal<S,Vertex> both(String... edgeLabels)
Map theVertex
to its adjacent vertices given the edge labels.- Parameters:
edgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
toE
default GraphTraversal<S,Edge> toE(Direction direction, String... edgeLabels)
Map theVertex
to its incident edges given the direction and edge labels.- Parameters:
direction
- the direction to traverse from the current vertexedgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
outE
default GraphTraversal<S,Edge> outE(String... edgeLabels)
Map theVertex
to its outgoing incident edges given the edge labels.- Parameters:
edgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
inE
default GraphTraversal<S,Edge> inE(String... edgeLabels)
Map theVertex
to its incoming incident edges given the edge labels.- Parameters:
edgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
bothE
default GraphTraversal<S,Edge> bothE(String... edgeLabels)
Map theVertex
to its incident edges given the edge labels.- Parameters:
edgeLabels
- the edge labels to traverse- Returns:
- the traversal with an appended
VertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
toV
default GraphTraversal<S,Vertex> toV(Direction direction)
Map theEdge
to its incident vertices given the direction.- Parameters:
direction
- the direction to traverser from the current edge- Returns:
- the traversal with an appended
EdgeVertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
inV
default GraphTraversal<S,Vertex> inV()
- Returns:
- the traversal with an appended
EdgeVertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
outV
default GraphTraversal<S,Vertex> outV()
- Returns:
- the traversal with an appended
EdgeVertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
bothV
default GraphTraversal<S,Vertex> bothV()
Map theEdge
to its incident vertices.- Returns:
- the traversal with an appended
EdgeVertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
otherV
default GraphTraversal<S,Vertex> otherV()
Map theEdge
to the incident vertex that was not just traversed from in the path history.- Returns:
- the traversal with an appended
EdgeOtherVertexStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Vertex Step
-
order
default GraphTraversal<S,E> order()
Order all the objects in the traversal up to this point and then emit them one-by-one in their ordered sequence.- Returns:
- the traversal with an appended
OrderGlobalStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Order Step
-
order
default GraphTraversal<S,E> order(Scope scope)
Order either theScope.local
object (e.g. a list, map, etc.) or the entireScope.global
traversal stream.- Parameters:
scope
- whether the ordering is the current local object or the entire global stream.- Returns:
- the traversal with an appended
OrderGlobalStep
orOrderLocalStep
depending on thescope
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Order Step
-
properties
default <E2> GraphTraversal<S,? extends Property<E2>> properties(String... propertyKeys)
Map theElement
to its associated properties given the provide property keys. If no property keys are provided, then all properties are emitted.- Type Parameters:
E2
- the value type of the returned properties- Parameters:
propertyKeys
- the properties to retrieve- Returns:
- the traversal with an appended
PropertiesStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Properties Step
-
values
default <E2> GraphTraversal<S,E2> values(String... propertyKeys)
Map theElement
to the values of the associated properties given the provide property keys. If no property keys are provided, then all property values are emitted.- Type Parameters:
E2
- the value type of the properties- Parameters:
propertyKeys
- the properties to retrieve their value from- Returns:
- the traversal with an appended
PropertiesStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Values Step
-
propertyMap
default <E2> GraphTraversal<S,Map<String,E2>> propertyMap(String... propertyKeys)
Map theElement
to aMap
of the properties key'd according to theirProperty.key()
. If no property keys are provided, then all properties are retrieved.- Type Parameters:
E2
- the value type of the returned properties- Parameters:
propertyKeys
- the properties to retrieve- Returns:
- the traversal with an appended
PropertyMapStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - PropertyMap Step
-
elementMap
default <E2> GraphTraversal<S,Map<Object,E2>> elementMap(String... propertyKeys)
Map theElement
to aMap
of the property values key'd according to theirProperty.key()
. If no property keys are provided, then all property values are retrieved. For vertices, theMap
will be returned with the assumption of single property values along withT.id
andT.label
. PrefervalueMap(String...)
if multi-property processing is required. For edges, keys will include additional related edge structure ofDirection.IN
andDirection.OUT
which themselves areMap
instances of the particularVertex
represented byT.id
andT.label
.- Type Parameters:
E2
- the value type of the returned properties- Parameters:
propertyKeys
- the properties to retrieve- Returns:
- the traversal with an appended
ElementMapStep
. - Since:
- 3.4.4
- See Also:
- Reference Documentation - ElementMap Step
-
valueMap
default <E2> GraphTraversal<S,Map<Object,E2>> valueMap(String... propertyKeys)
Map theElement
to aMap
of the property values key'd according to theirProperty.key()
. If no property keys are provided, then all property values are retrieved.- Type Parameters:
E2
- the value type of the returned properties- Parameters:
propertyKeys
- the properties to retrieve- Returns:
- the traversal with an appended
PropertyMapStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - ValueMap Step
-
valueMap
@Deprecated default <E2> GraphTraversal<S,Map<Object,E2>> valueMap(boolean includeTokens, String... propertyKeys)
Deprecated.As of release 3.4.0, deprecated in favor ofvalueMap(String...)
in conjunction withwith(String, Object)
or simple preferelementMap(String...)
.Map theElement
to aMap
of the property values key'd according to theirProperty.key()
. If no property keys are provided, then all property values are retrieved.- Type Parameters:
E2
- the value type of the returned properties- Parameters:
includeTokens
- whether to includeT
tokens in the emitted map.propertyKeys
- the properties to retrieve- Returns:
- the traversal with an appended
PropertyMapStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - ValueMap Step
-
key
default GraphTraversal<S,String> key()
Map theProperty
to itsProperty.key()
.- Returns:
- the traversal with an appended
PropertyKeyStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Key Step
-
value
default <E2> GraphTraversal<S,E2> value()
Map theProperty
to itsProperty.value()
.- Returns:
- the traversal with an appended
PropertyValueStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Value Step
-
path
default GraphTraversal<S,Path> path()
- Returns:
- the traversal with an appended
PathStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Path Step
-
match
default <E2> GraphTraversal<S,Map<String,E2>> match(Traversal<?,?>... matchTraversals)
- Type Parameters:
E2
- the type of the objects bound in the variables- Parameters:
matchTraversals
- the traversal that maintain variables which must hold for the life of the traverser- Returns:
- the traversal with an appended
MatchStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Match Step
-
sack
default <E2> GraphTraversal<S,E2> sack()
Map theTraverser
to itsTraverser.sack()
value.- Type Parameters:
E2
- the sack value type- Returns:
- the traversal with an appended
SackStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Sack Step
-
loops
default GraphTraversal<S,Integer> loops()
If theTraverser
supports looping then calling this method will extract the number of loops for that traverser.- Returns:
- the traversal with an appended
LoopsStep
- Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - Loops Step
-
loops
default GraphTraversal<S,Integer> loops(String loopName)
If theTraverser
supports looping then calling this method will extract the number of loops for that traverser for the named loop.- Returns:
- the traversal with an appended
LoopsStep
- Since:
- 3.4.0
- See Also:
- Reference Documentation - Loops Step
-
project
default <E2> GraphTraversal<S,Map<String,E2>> project(String projectKey, String... otherProjectKeys)
Projects the current object in the stream into aMap
that is keyed by the provided labels.- Returns:
- the traversal with an appended
ProjectStep
- Since:
- 3.2.0-incubating
- See Also:
- Reference Documentation - Project Step
-
select
default <E2> GraphTraversal<S,Map<String,E2>> select(Pop pop, String selectKey1, String selectKey2, String... otherSelectKeys)
- Type Parameters:
E2
- the type of the objects projected- Parameters:
pop
- if there are multiple objects referenced in the path, thePop
to use.selectKey1
- the first key to projectselectKey2
- the second key to projectotherSelectKeys
- the third+ keys to project- Returns:
- the traversal with an appended
SelectStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Select Step
-
select
default <E2> GraphTraversal<S,Map<String,E2>> select(String selectKey1, String selectKey2, String... otherSelectKeys)
- Type Parameters:
E2
- the type of the objects projected- Parameters:
selectKey1
- the first key to projectselectKey2
- the second key to projectotherSelectKeys
- the third+ keys to project- Returns:
- the traversal with an appended
SelectStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Select Step
-
select
default <E2> GraphTraversal<S,E2> select(Pop pop, String selectKey)
- Parameters:
selectKey
- the key to project- Returns:
- the traversal with an appended
SelectStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Select Step
-
select
default <E2> GraphTraversal<S,E2> select(String selectKey)
Map theTraverser
to the object specified by theselectKey
. Note that unlike other uses ofselect
where there are multiple keys, this use ofselect
with a single key does not produce aMap
.- Parameters:
selectKey
- the key to project- Returns:
- the traversal with an appended
SelectStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Select Step
-
select
default <E2> GraphTraversal<S,E2> select(Pop pop, Traversal<S,E2> keyTraversal)
Map theTraverser
to the object specified by the key returned by thekeyTraversal
and apply thePop
operation to it.- Parameters:
keyTraversal
- the traversal expression that selects the key to project- Returns:
- the traversal with an appended
SelectStep
. - Since:
- 3.3.3
- See Also:
- Reference Documentation - Select Step
-
select
default <E2> GraphTraversal<S,E2> select(Traversal<S,E2> keyTraversal)
Map theTraverser
to the object specified by the key returned by thekeyTraversal
. Note that unlike other uses ofselect
where there are multiple keys, this use ofselect
with a traversal does not produce aMap
.- Parameters:
keyTraversal
- the traversal expression that selects the key to project- Returns:
- the traversal with an appended
TraversalSelectStep
. - Since:
- 3.3.3
- See Also:
- Reference Documentation - Select Step
-
select
default <E2> GraphTraversal<S,Collection<E2>> select(Column column)
A version ofselect
that allows for the extraction of aColumn
from objects in the traversal.- Parameters:
column
- the column to extract- Returns:
- the traversal with an appended
TraversalMapStep
- Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - Select Step
-
unfold
default <E2> GraphTraversal<S,E2> unfold()
Unrolls aIterator
,Iterable
orMap
into a linear form or simply emits the object if it is not one of those types.- Returns:
- the traversal with an appended
UnfoldStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Unfold Step
-
fold
default GraphTraversal<S,List<E>> fold()
Rolls up objects in the stream into an aggregate list.- Returns:
- the traversal with an appended
FoldStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Fold Step
-
fold
default <E2> GraphTraversal<S,E2> fold(E2 seed, BiFunction<E2,E,E2> foldFunction)
Rolls up objects in the stream into an aggregate value as defined by aseed
andBiFunction
.- Parameters:
seed
- the value to provide as the first argument to thefoldFunction
foldFunction
- the function to fold by where the first argument is theseed
or the value returned from subsequent class and the second argument is the value from the stream- Returns:
- the traversal with an appended
FoldStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Fold Step
-
count
default GraphTraversal<S,Long> count()
Map the traversal stream to its reduction as a sum of theTraverser.bulk()
values (i.e. count the number of traversers up to this point).- Returns:
- the traversal with an appended
CountGlobalStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Count Step
-
count
default GraphTraversal<S,Long> count(Scope scope)
Map the traversal stream to its reduction as a sum of theTraverser.bulk()
values given the specifiedScope
(i.e. count the number of traversers up to this point).- Returns:
- the traversal with an appended
CountGlobalStep
orCountLocalStep
depending on theScope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Count Step
-
sum
default <E2 extends Number> GraphTraversal<S,E2> sum()
Map the traversal stream to its reduction as a sum of theTraverser.get()
values multiplied by theirTraverser.bulk()
(i.e. sum the traverser values up to this point).- Returns:
- the traversal with an appended
SumGlobalStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Sum Step
-
sum
default <E2 extends Number> GraphTraversal<S,E2> sum(Scope scope)
Map the traversal stream to its reduction as a sum of theTraverser.get()
values multiplied by theirTraverser.bulk()
given the specifiedScope
(i.e. sum the traverser values up to this point).- Returns:
- the traversal with an appended
SumGlobalStep
orSumLocalStep
depending on theScope
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Sum Step
-
max
default <E2 extends Comparable> GraphTraversal<S,E2> max()
Determines the largest value in the stream.- Returns:
- the traversal with an appended
MaxGlobalStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Max Step
-
max
default <E2 extends Comparable> GraphTraversal<S,E2> max(Scope scope)
Determines the largest value in the stream given theScope
.- Returns:
- the traversal with an appended
MaxGlobalStep
orMaxLocalStep
depending on theScope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Max Step
-
min
default <E2 extends Comparable> GraphTraversal<S,E2> min()
Determines the smallest value in the stream.- Returns:
- the traversal with an appended
MinGlobalStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Min Step
-
min
default <E2 extends Comparable> GraphTraversal<S,E2> min(Scope scope)
Determines the smallest value in the stream given theScope
.- Returns:
- the traversal with an appended
MinGlobalStep
orMinLocalStep
depending on theScope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Min Step
-
mean
default <E2 extends Number> GraphTraversal<S,E2> mean()
Determines the mean value in the stream.- Returns:
- the traversal with an appended
MeanGlobalStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Mean Step
-
mean
default <E2 extends Number> GraphTraversal<S,E2> mean(Scope scope)
Determines the mean value in the stream given theScope
.- Returns:
- the traversal with an appended
MeanGlobalStep
orMeanLocalStep
depending on theScope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Mean Step
-
group
default <K,V> GraphTraversal<S,Map<K,V>> group()
Organize objects in the stream into aMap
. Calls togroup()
are typically accompanied withby()
modulators which help specify how the grouping should occur.- Returns:
- the traversal with an appended
GroupStep
. - Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - Group Step
-
groupCount
default <K> GraphTraversal<S,Map<K,Long>> groupCount()
Counts the number of times a particular objects has been part of a traversal, returning aMap
where the object is the key and the value is the count.- Returns:
- the traversal with an appended
GroupCountStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - GroupCount Step
-
tree
default GraphTraversal<S,Tree> tree()
Aggregates the emanating paths into aTree
data structure.- Returns:
- the traversal with an appended
TreeStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Tree Step
-
addV
default GraphTraversal<S,Vertex> addV(String vertexLabel)
Adds aVertex
.- Parameters:
vertexLabel
- the label of theVertex
to add- Returns:
- the traversal with the
AddVertexStep
added - Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - AddVertex Step
-
addV
default GraphTraversal<S,Vertex> addV(Traversal<?,String> vertexLabelTraversal)
- Returns:
- the traversal with the
AddVertexStep
added - Since:
- 3.3.1
- See Also:
- Reference Documentation - AddVertex Step
-
addV
default GraphTraversal<S,Vertex> addV()
Adds aVertex
with a default vertex label.- Returns:
- the traversal with the
AddVertexStep
added - Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - AddVertex Step
-
mergeV
default GraphTraversal<S,Vertex> mergeV()
Performs a merge (i.e. upsert) style operation for anVertex
using the incomingMap
traverser as an argument. TheMap
represents search criteria and will match each of the supplied key/value pairs where the keys may beString
property values or a value ofT
. If a match is not made it will use that search criteria to create the newVertex
.- Since:
- 3.6.0
-
mergeV
default GraphTraversal<S,Vertex> mergeV(Map<Object,Object> searchCreate)
Performs a merge (i.e. upsert) style operation for anVertex
using aMap
as an argument. TheMap
represents search criteria and will match each of the supplied key/value pairs where the keys may beString
property values or a value ofT
. If a match is not made it will use that search criteria to create the newVertex
.- Parameters:
searchCreate
- ThisMap
can have a key ofT
or aString
.- Since:
- 3.6.0
-
mergeV
default GraphTraversal<S,Vertex> mergeV(Traversal<?,Map<Object,Object>> searchCreate)
Performs a merge (i.e. upsert) style operation for anVertex
using aMap
as an argument. TheMap
represents search criteria and will match each of the supplied key/value pairs where the keys may beString
property values or a value ofT
. If a match is not made it will use that search criteria to create the newVertex
.
-
mergeE
default GraphTraversal<S,Edge> mergeE()
Spawns aGraphTraversal
by doing a merge (i.e. upsert) style operation for anEdge
using an incomingMap
as an argument.- Since:
- 3.6.0
-
mergeE
default GraphTraversal<S,Edge> mergeE(Map<Object,Object> searchCreate)
Spawns aGraphTraversal
by doing a merge (i.e. upsert) style operation for anEdge
using aMap
as an argument.
-
mergeE
default GraphTraversal<S,Edge> mergeE(Traversal<?,Map<Object,Object>> searchCreate)
Spawns aGraphTraversal
by doing a merge (i.e. upsert) style operation for anEdge
using aMap
as an argument.
-
addE
default GraphTraversal<S,Edge> addE(String edgeLabel)
Adds anEdge
with the specified edge label.- Parameters:
edgeLabel
- the label of the newly added edge- Returns:
- the traversal with the
AddEdgeStep
added - Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - AddEdge Step
-
addE
default GraphTraversal<S,Edge> addE(Traversal<?,String> edgeLabelTraversal)
- Returns:
- the traversal with the
AddEdgeStep
added - Since:
- 3.3.1
- See Also:
- Reference Documentation - AddEdge Step
-
to
default GraphTraversal<S,E> to(String toStepLabel)
Provideto()
-modulation to respective steps.- Parameters:
toStepLabel
- the step label to modulate to.- Returns:
- the traversal with the modified
FromToModulating
step. - Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - To Step
-
from
default GraphTraversal<S,E> from(String fromStepLabel)
Providefrom()
-modulation to respective steps.- Parameters:
fromStepLabel
- the step label to modulate to.- Returns:
- the traversal with the modified
FromToModulating
step. - Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - From Step
-
to
default GraphTraversal<S,E> to(Traversal<?,Vertex> toVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the incoming vertex of the newly addedEdge
.- Parameters:
toVertex
- the traversal for selecting the incoming vertex- Returns:
- the traversal with the modified
AddEdgeStep
- Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - From Step
-
from
default GraphTraversal<S,E> from(Traversal<?,Vertex> fromVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the outgoing vertex of the newly addedEdge
.- Parameters:
fromVertex
- the traversal for selecting the outgoing vertex- Returns:
- the traversal with the modified
AddEdgeStep
- Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - From Step
-
to
default GraphTraversal<S,E> to(Vertex toVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the incoming vertex of the newly addedEdge
.- Parameters:
toVertex
- the vertex for selecting the incoming vertex- Returns:
- the traversal with the modified
AddEdgeStep
- Since:
- 3.3.0
- See Also:
- Reference Documentation - From Step
-
from
default GraphTraversal<S,E> from(Vertex fromVertex)
When used as a modifier toaddE(String)
this method specifies the traversal to use for selecting the outgoing vertex of the newly addedEdge
.- Parameters:
fromVertex
- the vertex for selecting the outgoing vertex- Returns:
- the traversal with the modified
AddEdgeStep
- Since:
- 3.3.0
- See Also:
- Reference Documentation - From Step
-
math
default GraphTraversal<S,Double> math(String expression)
- Parameters:
expression
- the mathematical expression with variables refering to scope variables.- Returns:
- the traversal with the
MathStep
added. - Since:
- 3.3.1
-
element
default GraphTraversal<S,Element> element()
- Returns:
- the traversal with an appended
ElementStep
. - Since:
- 3.6.0
- See Also:
- Reference Documentation - Element Step
-
call
default <E> GraphTraversal<S,E> call(String service)
Perform the specified service call with no parameters.- Parameters:
service
- the name of the service call- Returns:
- the traversal with an appended
CallStep
. - Since:
- 3.6.0
- See Also:
- Reference Documentation - Call Step
-
call
default <E> GraphTraversal<S,E> call(String service, Map params)
Perform the specified service call with the specified static parameters.- Parameters:
service
- the name of the service callparams
- static parameter map (no nested traversals)- Returns:
- the traversal with an appended
CallStep
. - Since:
- 3.6.0
- See Also:
- Reference Documentation - Call Step
-
call
default <E> GraphTraversal<S,E> call(String service, Traversal<?,Map<?,?>> childTraversal)
Perform the specified service call with dynamic parameters produced by the specified child traversal.- Parameters:
service
- the name of the service callchildTraversal
- a traversal that will produce a Map of parameters for the service call when invoked.- Returns:
- the traversal with an appended
CallStep
. - Since:
- 3.6.0
- See Also:
- Reference Documentation - Call Step
-
call
default <E> GraphTraversal<S,E> call(String service, Map params, Traversal<?,Map<?,?>> childTraversal)
Perform the specified service call with both static and dynamic parameters produced by the specified child traversal. These parameters will be merged at execution time per the provider implementation. Reference implementation merges dynamic into static (dynamic will overwrite static).- Parameters:
service
- the name of the service callparams
- static parameter map (no nested traversals)childTraversal
- a traversal that will produce a Map of parameters for the service call when invoked.- Returns:
- the traversal with an appended
CallStep
. - Since:
- 3.6.0
- See Also:
- Reference Documentation - Call Step
-
concat
default GraphTraversal<S,String> concat(Traversal<?,String> concatTraversal, Traversal<?,String>... otherConcatTraversals)
Concatenate values of an arbitrary number of string traversals to the incoming traverser.- Parameters:
concatTraversal
- the traversal to concatenate.otherConcatTraversals
- additional traversals to concatenate.- Returns:
- the traversal with an appended
ConcatStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Concat Step
-
concat
default GraphTraversal<S,String> concat(String... concatStrings)
Concatenate an arbitrary number of strings to the incoming traverser.- Parameters:
concatStrings
- the String values to concatenate.- Returns:
- the traversal with an appended
ConcatStep
. - Since:
- 3.7.0
- See Also:
- Reference Documentation - Concat Step
-
asString
default GraphTraversal<S,String> asString()
Returns the value of incoming traverser as strings. Null values are returned as a string value "null".- Returns:
- the traversal with an appended
AsStringStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - AsString Step
-
length
default GraphTraversal<S,Integer> length()
Returns the length incoming string traverser. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
LengthStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Length Step
-
toLower
default GraphTraversal<S,String> toLower()
Returns the lowercase representation of incoming string traverser. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
ToLowerStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - ToLower Step
-
toUpper
default GraphTraversal<S,String> toUpper()
Returns the uppercase representation of incoming string traverser. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
ToUpperStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - ToUpper Step
-
trim
default GraphTraversal<S,String> trim()
Returns a string with leading and trailing whitespace removed. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
TrimStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Trim Step
-
lTrim
default GraphTraversal<S,String> lTrim()
Returns a string with leading whitespace removed. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
LTrimStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - LTrim Step
-
rTrim
default GraphTraversal<S,String> rTrim()
Returns a string with trailing whitespace removed. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
RTrimStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - RTrim Step
-
reverse
default GraphTraversal<S,?> reverse()
Returns the reverse of the incoming traverser. Null values are not processed and remain as null when returned.- Returns:
- the traversal with an appended
ReverseStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Reverse Step
-
replace
default GraphTraversal<S,String> replace(String oldChar, String newChar)
Returns a string with the specified characters in the original string replaced with the new characters. Any null arguments will be a no-op and the original string is returned. Null values from incoming traversers are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
ReplaceStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Replace Step
-
split
default GraphTraversal<S,List<String>> split(String separator)
Returns a list of strings created by splitting the incoming string traverser around the matches of the given separator. A null separator will split the string by whitespaces. Null values from incoming traversers are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
SplitStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Split Step
-
substring
default GraphTraversal<S,String> substring(int startIndex)
Returns a substring of the incoming string traverser with a 0-based start index (inclusive) specified, to the end of the string. If the start index is negative then it will begin at the specified index counted from the end of the string, or 0 if exceeding the string length. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
SubstringStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Substring Step
-
substring
default GraphTraversal<S,String> substring(int startIndex, int endIndex)
Returns a substring of the incoming string traverser with a 0-based start index (inclusive) and end index (exclusive). If the start index is negative then it will begin at the specified index counted from the end of the string, or 0 if exceeding the string length. If the end index is negative then it will end at the specified index counted from the end, or at the end of the string if exceeding the string length. End index <= start index will return the empty string. Null values are not processed and remain as null when returned. If the incoming traverser is a non-String value then anIllegalArgumentException
will be thrown.- Returns:
- the traversal with an appended
SubstringStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Substring Step
-
asDate
default GraphTraversal<S,Date> asDate()
Parse value of the incoming traverser as an ISO-8601Date
.- Returns:
- the traversal with an appended
AsDateStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - asDate Step
-
dateAdd
default GraphTraversal<S,Date> dateAdd(DT dateToken, int value)
Increase value of inputDate
.- Returns:
- the traversal with an appended
DateAddStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - dateAdd Step
-
dateDiff
default GraphTraversal<S,Long> dateDiff(Date value)
Returns the difference between twoDate
in epoch time.- Returns:
- the traversal with an appended
DateDiffStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - dateDiff Step
-
dateDiff
default GraphTraversal<S,Long> dateDiff(Traversal<?,Date> dateTraversal)
Returns the difference between twoDate
in epoch time.- Returns:
- the traversal with an appended
DateDiffStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Concat Step
-
difference
default GraphTraversal<S,Set<?>> difference(Object values)
Calculates the difference between the list traverser and list argument.- Returns:
- the traversal with an appended
DifferenceStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Difference Step
-
disjunct
default GraphTraversal<S,Set<?>> disjunct(Object values)
Calculates the disjunction between the list traverser and list argument.- Returns:
- the traversal with an appended
DisjunctStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Disjunct Step
-
intersect
default GraphTraversal<S,Set<?>> intersect(Object values)
Calculates the intersection between the list traverser and list argument.- Returns:
- the traversal with an appended
IntersectStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Intersect Step
-
conjoin
default GraphTraversal<S,String> conjoin(String delimiter)
Joins together the elements of the incoming list traverser together with the provided delimiter.- Returns:
- the traversal with an appended
ConjoinStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Conjoin Step
-
merge
default GraphTraversal<S,?> merge(Object values)
Merges the list traverser and list argument. Also known as union.- Returns:
- the traversal with an appended
TraversalMergeStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Merge Step
-
combine
default GraphTraversal<S,List<?>> combine(Object values)
Combines the list traverser and list argument. Also known as concatenation or append.- Returns:
- the traversal with an appended
CombineStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Combine Step
-
product
default GraphTraversal<S,List<List<?>>> product(Object values)
Calculates the cartesian product between the list traverser and list argument.- Returns:
- the traversal with an appended
ProductStep
. - Since:
- 3.7.1
- See Also:
- Reference Documentation - Product Step
-
filter
default GraphTraversal<S,E> filter(Predicate<Traverser<E>> predicate)
Map theTraverser
to eithertrue
orfalse
, wherefalse
will not pass the traverser to the next step.- Parameters:
predicate
- the filter function to apply- Returns:
- the traversal with the
LambdaFilterStep
added - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
filter
default GraphTraversal<S,E> filter(Traversal<?,?> filterTraversal)
Map theTraverser
to eithertrue
orfalse
, wherefalse
will not pass the traverser to the next step.- Parameters:
filterTraversal
- the filter traversal to apply- Returns:
- the traversal with the
TraversalFilterStep
added - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
none
default GraphTraversal<S,E> none()
Filter all traversers in the traversal. This step has narrow use cases and is primarily intended for use as a signal to remote servers thatiterate()
was called. While it may be directly used, it is often a sign that a traversal should be re-written in another form.
-
or
default GraphTraversal<S,E> or(Traversal<?,?>... orTraversals)
Ensures that at least one of the provided traversals yield a result.- Parameters:
orTraversals
- filter traversals where at least one must be satisfied- Returns:
- the traversal with an appended
OrStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Or Step
-
and
default GraphTraversal<S,E> and(Traversal<?,?>... andTraversals)
Ensures that all of the provided traversals yield a result.- Parameters:
andTraversals
- filter traversals that must be satisfied- Returns:
- the traversal with an appended
AndStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - And Step
-
inject
default GraphTraversal<S,E> inject(E... injections)
Provides a way to add arbitrary objects to a traversal stream.- Parameters:
injections
- the objects to add to the stream- Returns:
- the traversal with an appended
InjectStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Inject Step
-
dedup
default GraphTraversal<S,E> dedup(Scope scope, String... dedupLabels)
Remove all duplicates in the traversal stream up to this point.- Parameters:
scope
- whether the deduplication is on the stream (global) or the current object (local).dedupLabels
- if labels are provided, then the scope labels determine de-duplication. No labels implies current object.- Returns:
- the traversal with an appended
DedupGlobalStep
orDedupLocalStep
depending onscope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Dedup Step
-
dedup
default GraphTraversal<S,E> dedup(String... dedupLabels)
Remove all duplicates in the traversal stream up to this point.- Parameters:
dedupLabels
- if labels are provided, then the scoped object's labels determine de-duplication. No labels implies current object.- Returns:
- the traversal with an appended
DedupGlobalStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Dedup Step
-
where
default GraphTraversal<S,E> where(String startKey, P<String> predicate)
Filters the current object based on the object itself or the path history.- Parameters:
startKey
- the key containing the object to filterpredicate
- the filter to apply- Returns:
- the traversal with an appended
WherePredicateStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Where Step, Reference Documentation - Where with Match, Reference Documentation - Where with Select
-
where
default GraphTraversal<S,E> where(P<String> predicate)
Filters the current object based on the object itself or the path history.- Parameters:
predicate
- the filter to apply- Returns:
- the traversal with an appended
WherePredicateStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Where Step, Reference Documentation - Where with Match, Reference Documentation - Where with Select
-
where
default GraphTraversal<S,E> where(Traversal<?,?> whereTraversal)
Filters the current object based on the object itself or the path history.- Parameters:
whereTraversal
- the filter to apply- Returns:
- the traversal with an appended
WherePredicateStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Where Step, Reference Documentation - Where with Match, Reference Documentation - Where with Select
-
has
default GraphTraversal<S,E> has(String propertyKey, P<?> predicate)
Filters vertices, edges and vertex properties based on their properties.- Parameters:
propertyKey
- the key of the property to filter onpredicate
- the filter to apply to the key's value- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(T accessor, P<?> predicate)
Filters vertices, edges and vertex properties based on their properties.- Parameters:
accessor
- theT
accessor of the property to filter onpredicate
- the filter to apply to the key's value- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(String propertyKey, Object value)
Filters vertices, edges and vertex properties based on their properties.- Parameters:
propertyKey
- the key of the property to filter onvalue
- the value to compare the property value to for equality- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(T accessor, Object value)
Filters vertices, edges and vertex properties based on their properties.- Parameters:
accessor
- theT
accessor of the property to filter onvalue
- the value to compare the accessor value to for equality- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(String label, String propertyKey, P<?> predicate)
Filters vertices, edges and vertex properties based on their properties.- Parameters:
label
- the label of theElement
propertyKey
- the key of the property to filter onpredicate
- the filter to apply to the key's value- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(String label, String propertyKey, Object value)
Filters vertices, edges and vertex properties based on their properties.- Parameters:
label
- the label of theElement
propertyKey
- the key of the property to filter onvalue
- the value to compare the accessor value to for equality- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(T accessor, Traversal<?,?> propertyTraversal)
Filters vertices, edges and vertex properties based on their value ofT
where onlyT.id
andT.label
are supported.- Parameters:
accessor
- theT
accessor of the property to filter onpropertyTraversal
- the traversal to filter the accessor value by- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.1.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(String propertyKey, Traversal<?,?> propertyTraversal)
Filters vertices, edges and vertex properties based on the value of the specified property key.- Parameters:
propertyKey
- the key of the property to filter onpropertyTraversal
- the traversal to filter the property value by- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
has
default GraphTraversal<S,E> has(String propertyKey)
Filters vertices, edges and vertex properties based on the existence of properties.- Parameters:
propertyKey
- the key of the property to filter on for existence- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
hasNot
default GraphTraversal<S,E> hasNot(String propertyKey)
Filters vertices, edges and vertex properties based on the non-existence of properties.- Parameters:
propertyKey
- the key of the property to filter on for existence- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Has Step
-
hasLabel
default GraphTraversal<S,E> hasLabel(String label, String... otherLabels)
Filters vertices, edges and vertex properties based on their label.- Parameters:
label
- the label of theElement
otherLabels
- additional labels of theElement
- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.2.2
- See Also:
- Reference Documentation - Has Step
-
hasLabel
default GraphTraversal<S,E> hasLabel(P<String> predicate)
Filters vertices, edges and vertex properties based on their label. Note that calling this step withnull
is the same as callinghasLabel(String, String...)
with a singlenull
.- Parameters:
predicate
- the filter to apply to the label of theElement
- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.2.4
- See Also:
- Reference Documentation - Has Step
-
hasId
default GraphTraversal<S,E> hasId(Object id, Object... otherIds)
Filters vertices, edges and vertex properties based on their identifier.- Parameters:
id
- the identifier of theElement
otherIds
- additional identifiers of theElement
- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.2.2
- See Also:
- Reference Documentation - Has Step
-
hasId
default GraphTraversal<S,E> hasId(P<Object> predicate)
Filters vertices, edges and vertex properties based on their identifier. Calling this step with anull
value will result in effectively callinghasId(Object, Object...)
wit a singlenull
identifier and therefore filter all results since aT.id
cannot benull
.- Parameters:
predicate
- the filter to apply to the identifier of theElement
- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.2.4
- See Also:
- Reference Documentation - Has Step
-
hasKey
default GraphTraversal<S,E> hasKey(String label, String... otherLabels)
FiltersProperty
objects based on their key. It is not meant to test key existence on anEdge
or aVertex
. In that case, preferhas(String)
.- Parameters:
label
- the key of theProperty
otherLabels
- additional key of theProperty
- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.2.2
- See Also:
- Reference Documentation - Has Step
-
hasKey
default GraphTraversal<S,E> hasKey(P<String> predicate)
FiltersProperty
objects based on their key. It is not meant to test key existence on anEdge
or aVertex
. In that case, preferhas(String)
. Note that calling this step withnull
is the same as callinghasKey(String, String...)
with a singlenull
.- Parameters:
predicate
- the filter to apply to the key of theProperty
- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.2.4
- See Also:
- Reference Documentation - Has Step
-
hasValue
default GraphTraversal<S,E> hasValue(Object value, Object... otherValues)
FiltersProperty
objects based on their value.- Parameters:
value
- the value of theElement
otherValues
- additional values of theElement
- Returns:
- the traversal with an appended
HasStep
- See Also:
- Reference Documentation - Has Step
-
hasValue
default GraphTraversal<S,E> hasValue(P<Object> predicate)
FiltersProperty
objects based on their value.Note that calling this step withnull
is the same as callinghasValue(Object, Object...)
with a singlenull
.- Parameters:
predicate
- the filter to apply to the value of theElement
- Returns:
- the traversal with an appended
HasStep
- Since:
- 3.2.4
- See Also:
- Reference Documentation - Has Step
-
is
default GraphTraversal<S,E> is(P<E> predicate)
FiltersE
object values given the providedpredicate
.- Parameters:
predicate
- the filter to apply- Returns:
- the traversal with an appended
IsStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Is Step
-
is
default GraphTraversal<S,E> is(Object value)
Filter theE
object if it is notP.eq(V)
to the provided value.- Parameters:
value
- the value that the object must equal.- Returns:
- the traversal with an appended
IsStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Is Step
-
not
default GraphTraversal<S,E> not(Traversal<?,?> notTraversal)
Removes objects from the traversal stream when the traversal provided as an argument returns any objects.- Parameters:
notTraversal
- the traversal to filter by.- Returns:
- the traversal with an appended
NotStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Not Step
-
coin
default GraphTraversal<S,E> coin(double probability)
Filter theE
object given a biased coin toss.- Parameters:
probability
- the probability that the object will pass through- Returns:
- the traversal with an appended
CoinStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Coin Step
-
range
default GraphTraversal<S,E> range(long low, long high)
Filter the objects in the traversal by the number of them to pass through the stream. Those before the value oflow
do not pass through and those that exceed the value ofhigh
will end the iteration.- Parameters:
low
- the number at which to start allowing objects through the streamhigh
- the number at which to end the stream - use-1
to emit all remaining objects- Returns:
- the traversal with an appended
RangeGlobalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Range Step
-
range
default <E2> GraphTraversal<S,E2> range(Scope scope, long low, long high)
Filter the objects in the traversal by the number of them to pass through the stream as constrained by theScope
. Those before the value oflow
do not pass through and those that exceed the value ofhigh
will end the iteration.- Parameters:
scope
- the scope of how to apply therange
low
- the number at which to start allowing objects through the streamhigh
- the number at which to end the stream - use-1
to emit all remaining objects- Returns:
- the traversal with an appended
RangeGlobalStep
orRangeLocalStep
depending onscope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Range Step
-
limit
default GraphTraversal<S,E> limit(long limit)
Filter the objects in the traversal by the number of them to pass through the stream, where only the firstn
objects are allowed as defined by thelimit
argument.- Parameters:
limit
- the number at which to end the stream- Returns:
- the traversal with an appended
RangeGlobalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Limit Step
-
limit
default <E2> GraphTraversal<S,E2> limit(Scope scope, long limit)
Filter the objects in the traversal by the number of them to pass through the stream given theScope
, where only the firstn
objects are allowed as defined by thelimit
argument.- Parameters:
scope
- the scope of how to apply thelimit
limit
- the number at which to end the stream- Returns:
- the traversal with an appended
RangeGlobalStep
orRangeLocalStep
depending onscope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Limit Step
-
tail
default GraphTraversal<S,E> tail()
Filters the objects in the traversal emitted as being last objects in the stream. In this case, only the last object will be returned.- Returns:
- the traversal with an appended
TailGlobalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Tail Step
-
tail
default GraphTraversal<S,E> tail(long limit)
Filters the objects in the traversal emitted as being last objects in the stream. In this case, only the lastn
objects will be returned as defined by thelimit
.- Parameters:
limit
- the number at which to end the stream- Returns:
- the traversal with an appended
TailGlobalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Tail Step
-
tail
default <E2> GraphTraversal<S,E2> tail(Scope scope)
Filters the objects in the traversal emitted as being last objects in the stream given theScope
. In this case, only the last object in the stream will be returned.- Parameters:
scope
- the scope of how to apply thetail
- Returns:
- the traversal with an appended
TailGlobalStep
orTailLocalStep
depending onscope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Tail Step
-
tail
default <E2> GraphTraversal<S,E2> tail(Scope scope, long limit)
Filters the objects in the traversal emitted as being last objects in the stream given theScope
. In this case, only the lastn
objects will be returned as defined by thelimit
.- Parameters:
scope
- the scope of how to apply thetail
limit
- the number at which to end the stream- Returns:
- the traversal with an appended
TailGlobalStep
orTailLocalStep
depending onscope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Tail Step
-
skip
default GraphTraversal<S,E> skip(long skip)
Filters out the firstn
objects in the traversal.- Parameters:
skip
- the number of objects to skip- Returns:
- the traversal with an appended
RangeGlobalStep
- Since:
- 3.3.0
- See Also:
- Reference Documentation - Skip Step
-
skip
default <E2> GraphTraversal<S,E2> skip(Scope scope, long skip)
Filters out the firstn
objects in the traversal.- Parameters:
scope
- the scope of how to apply thetail
skip
- the number of objects to skip- Returns:
- the traversal with an appended
RangeGlobalStep
orRangeLocalStep
depending onscope
- Since:
- 3.3.0
- See Also:
- Reference Documentation - Skip Step
-
timeLimit
default GraphTraversal<S,E> timeLimit(long timeLimit)
Once the firstTraverser
hits this step, a count down is started. Once the time limit is up, all remaining traversers are filtered out.- Parameters:
timeLimit
- the count down time- Returns:
- the traversal with an appended
TimeLimitStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - TimeLimit Step
-
simplePath
default GraphTraversal<S,E> simplePath()
- Returns:
- the traversal with an appended
PathFilterStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - SimplePath Step
-
cyclicPath
default GraphTraversal<S,E> cyclicPath()
- Returns:
- the traversal with an appended
PathFilterStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - CyclicPath Step
-
sample
default GraphTraversal<S,E> sample(int amountToSample)
Allow some specified number of objects to pass through the stream.- Parameters:
amountToSample
- the number of objects to allow- Returns:
- the traversal with an appended
SampleGlobalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Sample Step
-
sample
default GraphTraversal<S,E> sample(Scope scope, int amountToSample)
Allow some specified number of objects to pass through the stream.- Parameters:
scope
- the scope of how to apply thesample
amountToSample
- the number of objects to allow- Returns:
- the traversal with an appended
SampleGlobalStep
orSampleLocalStep
depending on thescope
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Sample Step
-
drop
default GraphTraversal<S,E> drop()
Removes elements and properties from the graph. This step is not a terminating, in the sense that it does not automatically iterate the traversal. It is therefore necessary to do some form of iteration for the removal to actually take place. In most cases, iteration is best accomplished withg.V().drop().iterate()
.- Returns:
- the traversal with the
DropStep
added - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Drop Step
-
all
default <S2> GraphTraversal<S,E> all(P<S2> predicate)
FiltersE
lists given the providedpredicate
.- Parameters:
predicate
- the filter to apply- Returns:
- the traversal with an appended
AllStep
- Since:
- 3.7.1
- See Also:
- Reference Documentation - All Step
-
any
default <S2> GraphTraversal<S,E> any(P<S2> predicate)
FiltersE
lists given the providedpredicate
.- Parameters:
predicate
- the filter to apply- Returns:
- the traversal with an appended
AnyStep
- Since:
- 3.7.1
- See Also:
- Reference Documentation - Any Step
-
sideEffect
default GraphTraversal<S,E> sideEffect(Consumer<Traverser<E>> consumer)
Perform some operation on theTraverser
and pass it to the next step unmodified.- Parameters:
consumer
- the operation to perform at this step in relation to theTraverser
- Returns:
- the traversal with an appended
LambdaSideEffectStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
sideEffect
default GraphTraversal<S,E> sideEffect(Traversal<?,?> sideEffectTraversal)
Perform some operation on theTraverser
and pass it to the next step unmodified.- Parameters:
sideEffectTraversal
- the operation to perform at this step in relation to theTraverser
- Returns:
- the traversal with an appended
TraversalSideEffectStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
cap
default <E2> GraphTraversal<S,E2> cap(String sideEffectKey, String... sideEffectKeys)
Iterates the traversal up to the itself and emits the side-effect referenced by the key. If multiple keys are supplied then the side-effects are emitted as aMap
.- Parameters:
sideEffectKey
- the side-effect to emitsideEffectKeys
- other side-effects to emit- Returns:
- the traversal with an appended
SideEffectCapStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Cap Step
-
subgraph
default GraphTraversal<S,Edge> subgraph(String sideEffectKey)
Extracts a portion of the graph being traversed into aGraph
object held in the specified side-effect key.- Parameters:
sideEffectKey
- the name of the side-effect key that will hold the subgraph- Returns:
- the traversal with an appended
SubgraphStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Subgraph Step
-
aggregate
default GraphTraversal<S,E> aggregate(String sideEffectKey)
Eagerly collects objects up to this step into a side-effect. Same as callingaggregate(Scope, String)
with aScope.global
.- Parameters:
sideEffectKey
- the name of the side-effect key that will hold the aggregated objects- Returns:
- the traversal with an appended
AggregateGlobalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Aggregate Step
-
aggregate
default GraphTraversal<S,E> aggregate(Scope scope, String sideEffectKey)
Collects objects in a list using theScope
argument to determine whether it should be lazyScope.local
or eager (Scope.global
while gathering those objects.- Parameters:
sideEffectKey
- the name of the side-effect key that will hold the aggregated objects- Returns:
- the traversal with an appended
AggregateGlobalStep
- Since:
- 3.4.3
- See Also:
- Reference Documentation - Aggregate Step
-
group
default GraphTraversal<S,E> group(String sideEffectKey)
Organize objects in the stream into aMap
. Calls togroup()
are typically accompanied withby()
modulators which help specify how the grouping should occur.- Parameters:
sideEffectKey
- the name of the side-effect key that will hold the aggregated grouping- Returns:
- the traversal with an appended
GroupStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Group Step
-
groupCount
default GraphTraversal<S,E> groupCount(String sideEffectKey)
Counts the number of times a particular objects has been part of a traversal, returning aMap
where the object is the key and the value is the count.- Parameters:
sideEffectKey
- the name of the side-effect key that will hold the aggregated grouping- Returns:
- the traversal with an appended
GroupCountStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - GroupCount Step
-
fail
default GraphTraversal<S,E> fail()
When triggered, immediately throws aRuntimeException
which implements theFailure
interface. The traversal will be terminated as a result.- Returns:
- the traversal with an appended
FailStep
. - Since:
- 3.6.0
- See Also:
- Reference Documentation - Fail Step
-
fail
default GraphTraversal<S,E> fail(String message)
When triggered, immediately throws aRuntimeException
which implements theFailure
interface. The traversal will be terminated as a result.- Parameters:
message
- the error message to include in the exception- Returns:
- the traversal with an appended
FailStep
. - Since:
- 3.6.0
- See Also:
- Reference Documentation - Fail Step
-
tree
default GraphTraversal<S,E> tree(String sideEffectKey)
Aggregates the emanating paths into aTree
data structure.- Parameters:
sideEffectKey
- the name of the side-effect key that will hold the tree- Returns:
- the traversal with an appended
TreeStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Tree Step
-
sack
default <V,U> GraphTraversal<S,E> sack(BiFunction<V,U,V> sackOperator)
Map theTraverser
to itsTraverser.sack()
value.- Parameters:
sackOperator
- the operator to apply to the sack value- Returns:
- the traversal with an appended
SackStep
. - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Sack Step
-
store
@Deprecated default GraphTraversal<S,E> store(String sideEffectKey)
Deprecated.As of release 3.4.3, replaced byaggregate(Scope, String)
usingScope.local
.Lazily aggregates objects in the stream into a side-effect collection.- Parameters:
sideEffectKey
- the name of the side-effect key that will hold the aggregate- Returns:
- the traversal with an appended
AggregateLocalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Store Step
-
profile
default GraphTraversal<S,E> profile(String sideEffectKey)
Allows developers to examine statistical information about a traversal providing data like execution times, counts, etc.- Parameters:
sideEffectKey
- the name of the side-effect key within which to hold the profile object- Returns:
- the traversal with an appended
ProfileSideEffectStep
- Since:
- 3.2.0-incubating
- See Also:
- Reference Documentation - Profile Step
-
profile
default GraphTraversal<S,TraversalMetrics> profile()
Allows developers to examine statistical information about a traversal providing data like execution times, counts, etc.- Specified by:
profile
in interfaceTraversal<S,E>
- Returns:
- the traversal with an appended
ProfileSideEffectStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Profile Step
-
property
default GraphTraversal<S,E> property(VertexProperty.Cardinality cardinality, Object key, Object value, Object... keyValues)
Sets aProperty
value and related meta properties if supplied, if supported by theGraph
and if theElement
is aVertexProperty
. This method is the long-hand version ofproperty(Object, Object, Object...)
with the difference that theVertexProperty.Cardinality
can be supplied. * Generally speaking, this method will append anAddPropertyStep
to theTraversal
but when possible, this method will attempt to fold key/value pairs into anAddVertexStep
,AddEdgeStep
orAddVertexStartStep
. This potential optimization can only happen if cardinality is not supplied and when meta-properties are not included.- Parameters:
cardinality
- the specified cardinality of the property wherenull
will allow theGraph
to use its default settingskey
- the key for the propertyvalue
- the value for the property which may not be null if thekey
is of typeT
keyValues
- any meta properties to be assigned to this property- Returns:
- the traversal with the last step modified to add a property
- Since:
- 3.0.0-incubating
- See Also:
- AddProperty Step
-
property
default GraphTraversal<S,E> property(Object key, Object value, Object... keyValues)
Sets the key and value of aProperty
. If theElement
is aVertexProperty
and theGraph
supports it, meta properties can be set. Use of this method assumes that theVertexProperty.Cardinality
is defaulted tonull
which means that the default cardinality for theGraph
will be used. If aMap
is supplied then each of the key/value pairs in the map will be added as property. This method is the long-hand version of looping through theproperty(Object, Object, Object...)
method for each key/value pair supplied. If aCardinalityValueTraversal
is specified as a value then it will override anyVertexProperty.Cardinality
specified for thekey
. This method is effectively callsproperty(VertexProperty.Cardinality, Object, Object, Object...)
asproperty(null, key, value, keyValues
.- Parameters:
key
- the key for the propertyvalue
- the value for the propertykeyValues
- any meta properties to be assigned to this property- Returns:
- the traversal with the last step modified to add a property
- Since:
- 3.0.0-incubating
- See Also:
- AddProperty Step
-
property
default GraphTraversal<S,E> property(Map<Object,Object> value)
When aMap
is supplied then each of the key/value pairs in the map will be added as property. This method is the long-hand version of looping through theproperty(Object, Object, Object...)
method for each key/value pair supplied. A value may use aCardinalityValueTraversal
to allow specification of theVertexProperty.Cardinality
along with the property value itself. If aMap
is not supplied then an exception is thrown. This method is effectively callsproperty(VertexProperty.Cardinality, Object, Object, Object...)
asproperty(null, key, value, keyValues
.- Parameters:
value
- the value for the property- Returns:
- the traversal with the last step modified to add a property
- Since:
- 3.0.0-incubating
- See Also:
- AddProperty Step
-
branch
default <M,E2> GraphTraversal<S,E2> branch(Traversal<?,M> branchTraversal)
Split theTraverser
to all the specified traversals.- Parameters:
branchTraversal
- the traversal to branch theTraverser
to- Returns:
- the
Traversal
with theBranchStep
added - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
branch
default <M,E2> GraphTraversal<S,E2> branch(Function<Traverser<E>,M> function)
Split theTraverser
to all the specified functions.- Parameters:
function
- the traversal to branch theTraverser
to- Returns:
- the
Traversal
with theBranchStep
added - Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - General Steps
-
choose
default <M,E2> GraphTraversal<S,E2> choose(Traversal<?,M> choiceTraversal)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal. Achoose
is modified byoption(M, org.apache.tinkerpop.gremlin.process.traversal.Traversal<?, E2>)
which provides the various branch choices.- Parameters:
choiceTraversal
- the traversal used to determine the value for the branch- Returns:
- the traversal with the appended
ChooseStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Choose Step
-
choose
default <E2> GraphTraversal<S,E2> choose(Traversal<?,?> traversalPredicate, Traversal<?,E2> trueChoice, Traversal<?,E2> falseChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal.- Parameters:
traversalPredicate
- the traversal used to determine the "if" portion of the if-then-elsetrueChoice
- the traversal to execute in the event thetraversalPredicate
returns truefalseChoice
- the traversal to execute in the event thetraversalPredicate
returns false- Returns:
- the traversal with the appended
ChooseStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Choose Step
-
choose
default <E2> GraphTraversal<S,E2> choose(Traversal<?,?> traversalPredicate, Traversal<?,E2> trueChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then like semantics within a traversal.- Parameters:
traversalPredicate
- the traversal used to determine the "if" portion of the if-then-elsetrueChoice
- the traversal to execute in the event thetraversalPredicate
returns true- Returns:
- the traversal with the appended
ChooseStep
- Since:
- 3.2.4
- See Also:
- Reference Documentation - Choose Step
-
choose
default <M,E2> GraphTraversal<S,E2> choose(Function<E,M> choiceFunction)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal. Achoose
is modified byoption(M, org.apache.tinkerpop.gremlin.process.traversal.Traversal<?, E2>)
which provides the various branch choices.- Parameters:
choiceFunction
- the function used to determine the value for the branch- Returns:
- the traversal with the appended
ChooseStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Choose Step
-
choose
default <E2> GraphTraversal<S,E2> choose(Predicate<E> choosePredicate, Traversal<?,E2> trueChoice, Traversal<?,E2> falseChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal.- Parameters:
choosePredicate
- the function used to determine the "if" portion of the if-then-elsetrueChoice
- the traversal to execute in the event thetraversalPredicate
returns truefalseChoice
- the traversal to execute in the event thetraversalPredicate
returns false- Returns:
- the traversal with the appended
ChooseStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Choose Step
-
choose
default <E2> GraphTraversal<S,E2> choose(Predicate<E> choosePredicate, Traversal<?,E2> trueChoice)
Routes the current traverser to a particular traversal branch option which allows the creation of if-then like semantics within a traversal.- Parameters:
choosePredicate
- the function used to determine the "if" portion of the if-then-elsetrueChoice
- the traversal to execute in the event thetraversalPredicate
returns true- Returns:
- the traversal with the appended
ChooseStep
- Since:
- 3.2.4
- See Also:
- Reference Documentation - Choose Step
-
optional
default <E2> GraphTraversal<S,E2> optional(Traversal<?,E2> optionalTraversal)
Returns the result of the specified traversal if it yields a result, otherwise it returns the calling element.- Parameters:
optionalTraversal
- the traversal to execute for a potential result- Returns:
- the traversal with the appended
ChooseStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Optional Step
-
union
default <E2> GraphTraversal<S,E2> union(Traversal<?,E2>... unionTraversals)
Merges the results of an arbitrary number of traversals.- Parameters:
unionTraversals
- the traversals to merge- Returns:
- the traversal with the appended
UnionStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Union Step
-
coalesce
default <E2> GraphTraversal<S,E2> coalesce(Traversal<?,E2>... coalesceTraversals)
Evaluates the provided traversals and returns the result of the first traversal to emit at least one object.- Parameters:
coalesceTraversals
- the traversals to coalesce- Returns:
- the traversal with the appended
CoalesceStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Coalesce Step
-
repeat
default GraphTraversal<S,E> repeat(Traversal<?,E> repeatTraversal)
This step is used for looping over a traversal given some break predicate.- Parameters:
repeatTraversal
- the traversal to repeat over- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Repeat Step
-
repeat
default GraphTraversal<S,E> repeat(String loopName, Traversal<?,E> repeatTraversal)
This step is used for looping over a traversal given some break predicate and with a specified loop name.- Parameters:
repeatTraversal
- the traversal to repeat overloopName
- The name given to the loop- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.4.0
- See Also:
- Reference Documentation - Repeat Step
-
emit
default GraphTraversal<S,E> emit(Traversal<?,?> emitTraversal)
Emit is used in conjunction withrepeat(Traversal)
to determine what objects get emit from the loop.- Parameters:
emitTraversal
- the emit predicate defined as a traversal- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Repeat Step
-
emit
default GraphTraversal<S,E> emit(Predicate<Traverser<E>> emitPredicate)
Emit is used in conjunction withrepeat(Traversal)
to determine what objects get emit from the loop.- Parameters:
emitPredicate
- the emit predicate- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Repeat Step
-
emit
default GraphTraversal<S,E> emit()
Emit is used in conjunction withrepeat(Traversal)
to emit all objects from the loop.- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Repeat Step
-
until
default GraphTraversal<S,E> until(Traversal<?,?> untilTraversal)
Modifies arepeat(Traversal)
to determine when the loop should exit.- Parameters:
untilTraversal
- the traversal that determines when the loop exits- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Repeat Step
-
until
default GraphTraversal<S,E> until(Predicate<Traverser<E>> untilPredicate)
Modifies arepeat(Traversal)
to determine when the loop should exit.- Parameters:
untilPredicate
- the predicate that determines when the loop exits- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Repeat Step
-
times
default GraphTraversal<S,E> times(int maxLoops)
Modifies arepeat(Traversal)
to specify how many loops should occur before exiting.- Parameters:
maxLoops
- the number of loops to execute prior to exiting- Returns:
- the traversal with the appended
RepeatStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Repeat Step
-
local
default <E2> GraphTraversal<S,E2> local(Traversal<?,E2> localTraversal)
Provides a execute a specified traversal on a single element within a stream.- Parameters:
localTraversal
- the traversal to execute locally- Returns:
- the traversal with the appended
LocalStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Local Step
-
pageRank
default GraphTraversal<S,E> pageRank()
Calculates a PageRank over the graph using a 0.85 for thealpha
value.- Returns:
- the traversal with the appended
PageRankVertexProgramStep
- Since:
- 3.2.0-incubating
- See Also:
- Reference Documentation - PageRank Step
-
pageRank
default GraphTraversal<S,E> pageRank(double alpha)
Calculates a PageRank over the graph.- Returns:
- the traversal with the appended
PageRankVertexProgramStep
- Since:
- 3.2.0-incubating
- See Also:
- Reference Documentation - PageRank Step
-
peerPressure
default GraphTraversal<S,E> peerPressure()
Executes a Peer Pressure community detection algorithm over the graph.- Returns:
- the traversal with the appended
PeerPressureVertexProgramStep
- Since:
- 3.2.0-incubating
- See Also:
- Reference Documentation - PeerPressure Step
-
connectedComponent
default GraphTraversal<S,E> connectedComponent()
Executes a Connected Component algorithm over the graph.- Returns:
- the traversal with the appended
ConnectedComponentVertexProgram
- Since:
- 3.4.0
- See Also:
- Reference Documentation - ConnectedComponent Step
-
shortestPath
default GraphTraversal<S,Path> shortestPath()
Executes a Shortest Path algorithm over the graph.- Returns:
- the traversal with the appended
ShortestPathVertexProgramStep
- See Also:
- Reference Documentation - ShortestPath Step
-
program
default GraphTraversal<S,E> program(VertexProgram<?> vertexProgram)
Executes an arbitraryVertexProgram
over the graph.- Returns:
- the traversal with the appended
ProgramVertexProgramStep
- Since:
- 3.2.0-incubating
- See Also:
- Reference Documentation - Program Step
-
as
default GraphTraversal<S,E> as(String stepLabel, String... stepLabels)
A step modulator that provides a label to the step that can be accessed later in the traversal by other steps.- Parameters:
stepLabel
- the name of the stepstepLabels
- additional names for the label- Returns:
- the traversal with the modified end step
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - As Step
-
barrier
default GraphTraversal<S,E> barrier()
Turns the lazy traversal pipeline into a bulk-synchronous pipeline which basically iterates that traversal to the size of the barrier. In this case, it iterates the entire thing as the default barrier size is set toInteger.MAX_VALUE
.- Returns:
- the traversal with an appended
NoOpBarrierStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Barrier Step
-
barrier
default GraphTraversal<S,E> barrier(int maxBarrierSize)
Turns the lazy traversal pipeline into a bulk-synchronous pipeline which basically iterates that traversal to the size of the barrier.- Parameters:
maxBarrierSize
- the size of the barrier- Returns:
- the traversal with an appended
NoOpBarrierStep
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Barrier Step
-
index
default <E2> GraphTraversal<S,E2> index()
Indexes all items of the current collection. The indexing format can be configured using thewith(String, Object)
andWithOptions.indexer
. Indexed as list: ["a","b","c"] => [["a",0],["b",1],["c",2]] Indexed as map: ["a","b","c"] => {0:"a",1:"b",2:"c"} If the current object is not a collection, this step will map the object to a single item collection/map: Indexed as list: "a" => ["a",0] Indexed as map: "a" => {0:"a"}- Returns:
- the traversal with an appended
IndexStep
- Since:
- 3.4.0
- See Also:
- Reference Documentation - Index Step
-
barrier
default GraphTraversal<S,E> barrier(Consumer<TraverserSet<Object>> barrierConsumer)
Turns the lazy traversal pipeline into a bulk-synchronous pipeline which basically iterates that traversal to the size of the barrier. In this case, it iterates the entire thing as the default barrier size is set toInteger.MAX_VALUE
.- Parameters:
barrierConsumer
- a consumer function that is applied to the objects aggregated to the barrier- Returns:
- the traversal with an appended
NoOpBarrierStep
- Since:
- 3.2.0-incubating
- See Also:
- Reference Documentation - Barrier Step
-
with
default GraphTraversal<S,E> with(String key)
Provides a configuration to a step in the form of a key which is the same aswith(key, true)
. The key of the configuration must be step specific and therefore a configuration could be supplied that is not known to be valid until execution.- Parameters:
key
- the key of the configuration to apply to a step- Returns:
- the traversal with a modulated step
- Since:
- 3.4.0
- See Also:
- Reference Documentation - With Step
-
with
default GraphTraversal<S,E> with(String key, Object value)
Provides a configuration to a step in the form of a key and value pair. The key of the configuration must be step specific and therefore a configuration could be supplied that is not known to be valid until execution.- Parameters:
key
- the key of the configuration to apply to a stepvalue
- the value of the configuration to apply to a step- Returns:
- the traversal with a modulated step
- Since:
- 3.4.0
- See Also:
- Reference Documentation - With Step
-
by
default GraphTraversal<S,E> by()
Theby()
can be applied to a number of different step to alter their behaviors. This form is essentially anidentity()
modulation.- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default GraphTraversal<S,E> by(Traversal<?,?> traversal)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified traversal.- Parameters:
traversal
- the traversal to apply- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default GraphTraversal<S,E> by(T token)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified token ofT
.- Parameters:
token
- the token to apply- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default GraphTraversal<S,E> by(String key)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified key.- Parameters:
key
- the key to apply- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default <V> GraphTraversal<S,E> by(Function<V,Object> function)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified function.- Parameters:
function
- the function to apply- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default <V> GraphTraversal<S,E> by(Traversal<?,?> traversal, Comparator<V> comparator)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified function.- Parameters:
traversal
- the traversal to applycomparator
- the comparator to apply typically for someorder()
- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default GraphTraversal<S,E> by(Comparator<E> comparator)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified function.- Parameters:
comparator
- the comparator to apply typically for someorder()
- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default GraphTraversal<S,E> by(Order order)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified function.- Parameters:
order
- the comparator to apply typically for someorder()
- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default <V> GraphTraversal<S,E> by(String key, Comparator<V> comparator)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified function.- Parameters:
key
- the key to apply traversalcomparator
- the comparator to apply typically for someorder()
- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
by
default <U> GraphTraversal<S,E> by(Function<U,Object> function, Comparator comparator)
Theby()
can be applied to a number of different step to alter their behaviors. Modifies the previous step with the specified function.- Parameters:
function
- the function to applycomparator
- the comparator to apply typically for someorder()
- Returns:
- the traversal with a modulated step.
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - By Step
-
option
default <M,E2> GraphTraversal<S,E> option(M token, Traversal<?,E2> traversalOption)
This is a step modulator to aTraversalOptionParent
likechoose()
ormergeV()
where the provided argument associated to thetoken
is applied according to the semantics of the step. Please see the documentation of such steps to understand the usage context.- Parameters:
token
- the token that would trigger this option which may be aPick
,Merge
, aTraversal
,Predicate
, or object depending on the step being modulated.traversalOption
- the option as a traversal- Returns:
- the traversal with the modulated step
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Choose Step, Reference Documentation - MergeV Step, Reference Documentation - MergeE Step
-
option
default <M,E2> GraphTraversal<S,E> option(M token, Map<Object,Object> m)
This is a step modulator to aTraversalOptionParent
likechoose()
ormergeV()
where the provided argument associated to thetoken
is applied according to the semantics of the step. Please see the documentation of such steps to understand the usage context.- Parameters:
m
- Provides aMap
as the option which is the same as doingconstant(m)
.- Returns:
- the traversal with the modulated step
- Since:
- 3.6.0
- See Also:
- Reference Documentation - MergeV Step, Reference Documentation - MergeE Step
-
option
default <M,E2> GraphTraversal<S,E> option(Merge merge, Map<Object,Object> m, VertexProperty.Cardinality cardinality)
This is a step modulator to aTraversalOptionParent
likechoose()
ormergeV()
where the provided argument associated to thetoken
is applied according to the semantics of the step. Please see the documentation of such steps to understand the usage context.- Parameters:
m
- Provides aMap
as the option which is the same as doingconstant(m)
.- Returns:
- the traversal with the modulated step
- Since:
- 3.7.0
- See Also:
- Reference Documentation - MergeV Step, Reference Documentation - MergeE Step
-
option
default <E2> GraphTraversal<S,E> option(Traversal<?,E2> traversalOption)
This step modifieschoose(Function)
to specifies the available choices that might be executed.- Parameters:
traversalOption
- the option as a traversal- Returns:
- the traversal with the modulated step
- Since:
- 3.0.0-incubating
- See Also:
- Reference Documentation - Choose Step
-
read
default GraphTraversal<S,E> read()
This step is technically a step modulator for the theGraphTraversalSource.io(String)
step which instructs the step to perform a read with its given configuration.- Returns:
- the traversal with the
IoStep
modulated to read - Since:
- 3.4.0
- See Also:
- Reference Documentation - IO Step, Reference Documentation - Read Step
-
write
default GraphTraversal<S,E> write()
This step is technically a step modulator for the theGraphTraversalSource.io(String)
step which instructs the step to perform a write with its given configuration.- Returns:
- the traversal with the
IoStep
modulated to write - Since:
- 3.4.0
- See Also:
- Reference Documentation - IO Step, Reference Documentation - Write Step
-
-