Sorry for posting another query question, bamboozled with all the language features. I'm struggling with 'collecting stuff as I go along a traversal'
I want the details of a vertex along with details of vertices that are joined to it.
I have a group vertex, incoming 'member' edges to user vertices. I want the details of the vertices.
g.V(1).as('a').in('member').valueMap().as('b').select('a','b').unfold().dedup()
==>a=v[1]
==>b={image=[images/profile/friend9.jpg], name=[Thomas Thompson], email=[me@thomasthompson.co.uk]}
==>b={image=[images/profile/friend13.jpg], name=[Laura Tostevin], email=[me@lauratostevin.co.uk]}
==>b={image=[images/profile/friend5.jpg], name=[Alan Thompson], email=[me@alanthompson.co.uk]}
==>b={image=[images/profile/friend10.jpg], name=[Laura Bourne], email=[me@laurabourne.co.uk]}
Ideally what I'd want is:
{label: 'group', id=1, name='A Group', users=[{id=2, label="user",name=".."}, ... }]}
When I tried a project, it didn't like me using 'in'
gremlin> g.V('1').project('name','users').by('name').by(in('member').select())
groovysh_parse: 1: unexpected token: in @ line 1, column 83.
'name','users').by('name').by(in('member
^