valueMap() is a really convenient step:

gremlin> g.V().has('person','name','marko').valueMap()
==>[name:[marko],age:[29]]

or perhaps more preferably:

gremlin> g.V().has('person','name','marko').valueMap('name','age')
==>[name:[marko],age:[29]]

but argh - multiproperties ruin everything. so then we're forced into
Gremlin acrobatics:

gremlin> g.V().has('name','marko').
......1>        valueMap('name','age').
......2>        unfold().
......3>        group().
......4>          by(keys).
......5>          by(select(values).unfold())
==>[name:marko,age:29]

or as I usually recommend, use project():

gremlin>
g.V().has('person','name','marko').project('name','age').by('name').by('age')
==>[name:marko,age:29]

which is fine, but you pretty much have to type a lot more especially if
there are a lot of properties to contend with. What if we were to modulate
valueMap() with by(Traversal) so that:

g.V().has('person','name','marko').
  valueMap('name','age').
    by(unfold())

and the by() are just applied round-robin on the keys? Thoughts?

Reply via email to