使用gremlin查询更新Orientdb上的节点

时间:2018-02-26 15:45:43

标签: graph orientdb gremlin

我无法使用gremlin使用以下代码更新Orientdb中节点的属性。 property和setProperty似乎都不适用于OrientDB。

g.V('@rid','#100').property('text','new updated text'))
g.V('@rid','#100').setProperty('text','new updated text'))

但是,我能够使用OrientDB支持的类似SQL的查询来更新节点。

update classname set text = 'new updated text' where @rid = #100

但我需要在OrientDB中使用gremlin查询来更新节点。我查看了gremlin查询教程,大多数建议.property('text','new updated text')应该可以工作。

OrientDB是否仅支持有限的gremlin查询而不是全部?

1 个答案:

答案 0 :(得分:1)

您似乎在TinkerPop 2.x和3.x语法之间有一点混合。我的内存对TinkerPop 2.x非常模糊,但我认为你只需要遍历遍历并使用第二种语法。因此,假设g.V('@rid','#100')返回一个顶点你应该这样做:

g.V('@rid','#100').next().setProperty('text','new updated text'))
相关问题