Skip to main content
All CollectionsData AnalysisGremlin training
Gremlin Training 9: Basic traversals - in()
Gremlin Training 9: Basic traversals - in()

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

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

Let us again assume that we have a Gremlin query which finds all components of type "Application", with the name "Ardoq":

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

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

g.V().
has('Application', 'name', 'Ardoq').
in()
ardoq components

If we want our search to only return components which have a reference of a specific type to our Ardoq component(s), we can pass the reference type we want to traverse as an argument to the in()-step. The following query finds all components which have a reference of type "Is Realized By" to our Ardoq component(s):

g.V().
has('Application', 'name', 'Ardoq').
in('Is Realized By')

is realised by

It is also possible to pass multiple reference types to the in()-step if we want the search to only traverse a specific set of incoming references. The following query finds all components which have a reference of type "Is Expert In" or "Owns" to our Ardoq component(s):

g.V().
has('Application', 'name', 'Ardoq').
in('Is Expert In', 'Owns')

is expert in or owns

Did this answer your question?