How to get the properties (ids) of two vertices in one Gremlin query?
g.addV('user').property(T.id, 'US001').property('name', 'Thirumal')
g.addV('role').property(T.id, 'EMP001').property('role_name', 'Developer')
g.V('US001').addE('employee').to(g.V('EMP001')).property('from', '2021/04/01')
How to get the following fields in one query like SQL joins?
1. id of the user node
2. name
3. id of employee node
4. role_name
5. from - Employee edge
I suppose that if you wanted it all flattened in a "row" like the result of a SQL query you might do:
gremlin> g.V('US001').as('uid','name').outE().as('from').inV().as('eid','role').
......1> select('uid','name','from','eid','role').
......2> by(id).
......3> by('name').
......4> by('from').
......5> by(id).
......6> by('role_name')
==>[uid:US001,name:Thirumal,from:2021/04/01,eid:EMP001,role:Developer]