select T.id + optional properties
I am trying to work out how to select vertex id and some optional properties.
select().by
does not work as it filters out not productive
properties.
Here is the sample graph I am testing this on.
The first gremlin produces one row as it filters out the 'B' with no 'prop2'
The second gremlin crashes with
I am looking to retrieve A.id, prop1, B.id, prop2 where prop1 and prop2 to are optional fields.2 Replies
there's a number of ways you might try to solve that. how about just using
coalesce()
in the by()
:
the second one fails because you did select(...).elementMap(...)
which isn't possible because elementMap()
can't work on the Map
that select()
produces.Thanks, I'll try
coalesce
.
This is what I ended up going with,
Thanks