繁体   English   中英

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

[英]Updating node on Orientdb with gremlin query

我在使用gremlin和以下代码来更新Orientdb节点中的属性时遇到问题。 属性和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 new text')应该起作用。

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

您似乎在TinkerPop 2.x和3.x语法之间有些混淆。 我对TinkerPop 2.x的记忆真的很朦胧,但是我认为您只需要遍历遍历并使用第二种语法即可。 因此,假设gV('@rid','#100')返回一个顶点,您应该这样做:

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

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM