简体   繁体   中英

Gremlin select multiple vertices gives an output without the properties with null values

In order to get all data from two vertices a and bi used the following

 g.V('xxx').out('hasA')..as('X').out('hasB').as('Y').select('X','Y').

I get values of X where the value of Y isnt null.I wanted to get all X where the value of Y can be or may not be null.

Any ideas as to how i can tweak the above query?

I'm not sure that this matters to you any more but to directly answer your question you need to deal with the chance that there are no "hasB" edges. You might do that with coalesce() in the following fashion:

g.V('xxx').out('hasA').as('X').
  coalesce(out('hasB'),constant('n/a')).as('Y').
  select('X','Y')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM