All Collections
Data Analysis
Gremlin training
Gremlin Training 10: Basic traversal - out()
Gremlin Training 10: Basic traversal - out()

Learn to use the out()-step to find Ardoq components which are reachable through outgoing references.

Kristine Marhilevica avatar
Written by Kristine Marhilevica
Updated over a week ago

Assume that we already have a Gremlin query which finds all components of type Application, with the name Ardoq:

g.V().has('Application', 'name', 'Ardoq')

gremlin query

If we wish to find the components which are reachable from our Ardoq component(s) following outgoing references, we can use the out()-step. When used with no arguments, it changes the current selection to all components which can be reached by following outgoing references. The following query returns all components to which our Ardoq component(s) have a reference:

g.V().
has('Application', 'name', 'Ardoq').
out()

reference

If we want our search to only return components reachable from our Ardoq component(s) following outgoing references of a specific type, this can be accomplished by passing the reference type we want to follow as an argument to the out()-step. The following query finds all components which can be reached from our Ardoq-component(s) by following references of type "Is Integrated WIth":

g.V().
has('Application', 'name', 'Ardoq').
out('Is Integrated With')

In the simple dataset visualized here, all outgoing references are of type "Is Integrated With", so the result is the same as in the previous query.

is integrated with

It is also possible to pass multiple reference types to the out()-step if we want the search to traverse a specific set of outgoing references. The following query finds all components which can be reached from our Ardoq component(s) through an outgoing reference of type "Is Integrated With" or "Has Two-way Integration":

g.V().
has('Application', 'name', 'Ardoq').
out('Is Integrated With', 'Has Two-way Integration')

In the data set visualized here, there are no references of type "Has Two-way integration", so the result is the same as in the previous query.

has two-way integration

Did this answer your question?