0

I want to know whether I can get data from Gremlin query in the form of HashMap(One vertex as key and another as value).

g.V().has('familyName','Smith').as('familyName').out().as('name').select('familyName','name').by('property1').by('property2')

The above queries retrieves the result as :

{
'familyName:Smith'
'name:John'
}

I want the result to be

{
'Smith:John'
}
vurmux
  • 9,420
  • 3
  • 25
  • 45

1 Answers1

1

When the keys of the Map you want to produce must be dynamically determined then you typically use group().

g.V().has('familyName','Smith').
  group().
    by('familyName').
    by(out().values('name'))
stephen mallette
  • 45,298
  • 5
  • 67
  • 135