Assume that we already have a Gremlin query which finds all components in the organization:

g.V()
gremlin

If we wish to limit the search to components of a specific type, we can use the hasLabel()-step. The following query limits the search to include all components of type Instrument:

g.V().hasLabel('Instrument')
component

It is also possible to pass multiple component types to the hasLabel()-step. The following query finds all components whose type is either "Person" or "Instrument":

g.V().hasLabel('Person', 'Instrument')
2 component types

The hasLabel()-step can also be used to filter references based on their type. The following query finds all references whose type is "Likes".

g.E().hasLabel('Likes')
reference
Did this answer your question?