【发布时间】:2021-05-04 15:34:54
【问题描述】:
我正在尝试在 coalesce() 内的第二次遍历中使用 .as() 访问之前保存的遍历,如下所示:
查询更新边缘(更新边缘如果存在/创建)
Java 代码:
g.V('x').as('start')
.V('y').as('stop')
.inE('label').where(outV().as('edge'))
.select('start','stop','edge').fold()
.coalesce(unfold(),
addE('label').from(select('start')).to(select('stop')))
.property('key','value')
.promise(Traversal::Next);
抛出如下错误:(为简洁起见)
gremlin.driver.exception.ResponseException: 提供的遍历器没有映射到值 [stop]
当我替换最后一步时,它的工作正常(而不是再次查询顶点的别名)
替换为addE('label').from(select('start')).to(select('stop'))
addE('label').from(V('x')).to(V('y'))
在coalesce 的第二次遍历中是否有引用别名?
注意:我正在收集与在合并之前查找边相关的所有数据以便在创建边时在缺少任何顶点/顶点时使 gremlin 抛出错误
预期行为:交易成功时为真,创建边时任何顶点丢失时出错。
这在不使用 as() 别名的情况下按预期工作。但是,我正在尝试使用 as()。我做不到。
希望这很清楚。如果需要更多信息,请发表评论。谢谢。
【问题讨论】:
标签: gremlin coalesce tinkerpop amazon-neptune graph-traversal