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

Learn to use the values()-step to take one or more property names as arguments and get the property values of components or references.

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

To present property values of a selection of components or references, the values()-step can be used.

The values-step takes one or more property names as arguments. The result will be the values of the provided properties if they exist. Missing values will result in fewer results and passing multiple property names to the values()-step will result in more results.

The following query finds all the components in the organization and returns their names.

g.V().values('name')
property values

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

g.V().has('name', 'Ardoq').values('name')
collection

Accessing multiple values at once can be useful when aggregating multiple different values. The following query finds all applications, accesses both their "business_fit" and "technical_fit" values and then calculates the average of all those values.

g.V().values('business_fit', 'technical_fit').mean()

technical fit

Did this answer your question?