I have a user vertex already created.
g.V().has('user','username','vipul').as('user')
I want to create a new 'group' vertex with some properties and also a new 'options' vertex with some other properties.
g.addV(label,'group','group_name','DC11').as('group')
g.addV(label,'options','command_line_arguments','-D -n').as('options')
Now I want to create an edge from user to group and another edge from group to options.
user ---> group, group ---> options
Can these queries be combined, selecting a vertex, creating new vertices and then creating new edges?
You can simply chain the 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 that I set the properties with the property
step as I prefer that form, but you can also add them directly with the addV
step.
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.