简体   繁体   中英

How to update several vertices with same property in Gremlin

I have a set of vertices which have the same property 'TYPE'. How to update this property for all the given set of vertices.

You can iterate through all your vertices and update their type property using a sideEffect. For example:

g.V.sideEffect{it.setProperty('TYPE',newTypeValue)}.iterate()

If you have a predefined set of vertices, you can do this:

mySetOfVertices._().sideEffect{it.setProperty('TYPE',newTypeValue)}.iterate()

Or...in pure Groovy:

mySetOfVertices.each{ it.setProperty('TYPE',newTypeValue) }

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