testing data:
vertex A has property 'a' value '1'
vertex B has outEdge 'e' to A
vertex B had property 'b' value '2'
how do I update 'a' to be value from 'b' in this case '2'?
I have tried this but not working
g.V().hasLabel('A').property('a', inE('e').outV().project('b').by('b').unfold())
Building the graph using...
gremlin> g.addV('A').property('a','1').as('a').
......1> addV('B').property('b','2').as('b').
......2> addE('e').from('b').to('a')
gremlin> g.V().valueMap()
==>[a:[1]]
==>[b:[2]]
You can use values from A to update B as follows (this is one way to write the query, there are alternative ways)
gremlin> g.V().hasLabel('B').as('b').V().hasLabel('A').property('a',select('b').values('b'))
==>v[42790]
gremlin> g.V().valueMap()
==>[a:[2]]
==>[b:[2]]
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.