【问题标题】:Updating node on Orientdb with gremlin query使用 gremlin 查询更新 Orientdb 上的节点
【发布时间】:2018-02-26 15:45:42
【问题描述】:

我在使用带有以下代码的 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 查询而不是全部?

【问题讨论】:

  • 您使用的是哪个版本的 tinkerpop?
  • 我使用的是使用 Tinkerpop 2.x 的 Orientdb 2.2 版

标签: graph orientdb gremlin


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-31
    相关资源
    最近更新 更多