graph databases - Gremlin - select a vertex, create new vertices and edges in single query -


i have user vertex created.

g.v().has('user','username','vipul').as('user') 

i want create new 'group' vertex properties , new 'options' vertex other properties.

g.addv(label,'group','group_name','dc11').as('group') g.addv(label,'options','command_line_arguments','-d -n').as('options') 

now want create edge user group , edge group options.

user ---> group,   group ---> options 

can these queries combined, selecting vertex, creating new vertices , creating new edges?

you can chain steps together:

g.v().has('user','username','vipul').as('user').   addv('group').property('group_name','dc11').as('group').   adde('memberofgroup').from('user').   addv('options').property('command_line_arguments','-d -n').   adde('hasoptions').from('group') 

note set properties property step prefer form, can add them directly addv step.

see in action in gremlinbin.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -