Skip to main content
All CollectionsData AnalysisGremlin training
Gremlin Training 11: Basic value access - label()
Gremlin Training 11: Basic value access - label()

Learn to use the label()-step to get access the types of components or references, and remove duplicate results.

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

To get the types of a selection of components or references, the label()-step can be used.

The following query finds all the components in the organization, accesses its type, and then removes duplicate results. In other words, the query returns the component types which exist in the organization.

g.V().label().dedup()
component type

The following query finds all components of type Person, and then returns the type of those components. As such, the result is a collection of the string "Person".

g.V().hasLabel('Person').label()

label

Did this answer your question?