Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update several vertices with same property in Gremlin

Tags:

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.

like image 356
Shireesh Avatar asked Feb 22 '12 14:02

Shireesh


1 Answers

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) }
like image 176
Marko A. Rodriguez Avatar answered Sep 22 '22 01:09

Marko A. Rodriguez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!