简体   繁体   English

如何在Gremlin中更新具有相同属性的几个顶点

[英]How to update several vertices with same property in Gremlin

I have a set of vertices which have the same property 'TYPE'. 我有一组具有相同属性'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. 您可以使用sideEffect迭代所有顶点并更新其type属性。 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: 或者......在纯Groovy中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更新 Gremlin 中所有顶点的属性 - Update a property in all Vertices in Gremlin 在 Gremlin 中,如何在一个属性上查询两个或多个具有相同值的顶点? - In Gremlin, how to query two or more vertices with same value on one property? Gremlin - 如何使用'null'属性查找顶点? - Gremlin - How do find vertices with 'null' property? 如何在 Gremlin 中将相邻顶点作为属性返回 - How to return adjacent vertices as a property in Gremlin 如何在JanusGraph或Gremlin中“连接”顶点及其边数作为这些顶点的“属性”? - How to “join” vertices and the count of their edges as a 'property' of those vertices in JanusGraph or Gremlin? 如何通过Java访问Gremlin中几个路径的顶点? - How to access the vertices of several paths in Gremlin through Java? Gremlin-如何为多个顶点将值列表分配给新属性 - Gremlin - how to assign a list of values to a new property, for multiple vertices Gremlin-如何计算具有特定属性的顶点百分比 - Gremlin- How to compute percentage of vertices with a certain property Gremlin - 更新或插入多个顶点 - Gremlin - Update or insert multiple vertices 使用 Gremlin,如何像从外顶点返回属性一样从内顶点返回属性? (不是数组) - How, with Gremlin, to return properties from in-vertices the same as I do from out-vertices? (Not as arrays)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM