Assume that we already have a Gremlin query which finds all components in the organization:
g.V()
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')
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')
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')