【发布时间】:2020-08-15 21:28:55
【问题描述】:
我是 gremlin 的新手,有一个非常简单的案例需要检查:
- 如果顶点存在
- 更新属性
- 其他
- 使用属性添加顶点
我为此使用 Java API。
我的代码:
g.V().hasLabel("Entity").has("identifier", "123").fold()
.coalesce(
__.unfold(),
__.addV("Entity")
.property("identifier", "123")
.property("value", "A")
.property("action", "add")
)
.property("value", "A")
.property("action", "update")
.iterate();
我知道这是一个非常简单的案例,我参考了 [CosmosDB Graph : "upsert" query pattern
中给出的示例但它不起作用。如果顶点不存在,则添加属性,但属性也会更新。
【问题讨论】:
标签: gremlin upsert amazon-neptune