Query
g.V().
has('id', 1).
out('follows').
as('x').
out('knows').
as('y').
project('Name').
by(select('x').by('name'))
Here I want to use coalesce in the projection because there are vertices where name property does not exist.
I tried this but it doesn't work,
by(coalesce(select('x').by('name'), constant('null'))
Change the by
to values
and it should work:
g.V().
has('id', 1).
out('follows').
as('x').
out('knows').
as('y').
project('Name').
by(coalesce(select('x').values('name'), constant('null')))