I am trying to retrieve the edge properties as values as well as the target and source node IDs.
My current database looks like that:
Edge:
_id _label _outV _inV name ID
0 edge 0 1 E 0
Nodes:
_id _label _name ID
0 node A 0
1 node B 1
I have tried this query:
>g.V().as('a').outE('edge').as('b').inV().values('ID').as('to').
select('b').valueMap().as('edge').
select('a').values('ID').as('from').
select('to','edge','from')
==>[to:0,edge:[ID:0,name:E],from:1]
What I am trying to get is
[to:0,ID:0,name:E,from:1]
Also the Edge elements could contain an arbitrary number of properties.
Is there a way to achieve that?
Thanks!
EDIT: Final query:
gremlin> g.V().outE('edge').limit(1).
......1> project('weight','id','from','to').
......2> by(coalesce(values('weight'),constant(''))).
......3> by(id).
......4> by(outV().id()).
......5> by(inV().id())
==>[weight:,id:0,from:0,to:1]
Use
project()
: