graph-databases - Gremlin - 更新多条边的值

标签 graph-databases gremlin gremlin-server amazon-neptune

我正在使用 AWS Neptune,我必须修改一组具有特定值的 EDGE 的某个属性。我还需要在单个事务中完成此操作。在 AWS Neptune 中,manual transaction logic using tx.commit() and tx.rollback() is not supported .这意味着我必须在一次遍历中执行此操作。

如果我要修改顶点而不是边的属性,我可以使用类似于以下查询的查询来完成它:

g.V(<id 1>).property('name', 'Marko').V(<id 2>).property('name', 'Stephen');

这是因为可以在中间遍历中通过 id 选择顶点,即 GraphTraversal类(class)有V(String ... vertexIds)作为成员函数。

但是对于边的情况,情况就不一样了。我无法以这种方式选择边,因为 E(String ... edgeIds)不是 GraphTraversal 的成员函数类(class)。

有人可以建议我解决这个问题的正确方法吗?

谢谢你。

最佳答案

添加了 Amazon Neptune 引擎 1.0.1.0.200463.0 Support for Gremlin Sessions启用在单个事务中执行多个 Gremlin 遍历。

但是,您也可以使用这样的单个查询来执行此操作:

g.E('id1', 'id2', 'id3').coalesce(
    has(id, 'id1').property('name','marko'),
    has(id, 'id2').property('name','stephan'),
    has(id, 'id3').property('name','vadas'))

关于graph-databases - Gremlin - 更新多条边的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58923446/

相关文章:

titan - 如何在同一个 gremlin 查询中检索计数和范围

amazon-web-services - AWS Neptune 图形数据库中的遍历顺序保证

graph-databases - Gremlin 在遍历时查询深度信息

triplestore - 图数据库与三重存储

graph - 如何在TinkerPop图中增加顶点属性值

azure-cosmosdb - Gremlin 查询 Edge inVLabel、outVLabel

scala - Janusgraph - 检查和获取两个顶点之间的边缘的有效方法

azure - Cosmos DB : Gremlin API Request too large exception. 如何重试调用

gremlin - 如何在 Gremlin 中使用 UUID 作为 id?