获取边的开始节​​点和结束节点 id,没有 map step() gremline for neptune

Get start node and end node id of the edge without map step() gremline for neptune

我正在 Neptune AWS 上工作,并试图找出边缘的起始节点 ID 和结束节点 ID。地图步骤适用于 Neo4j,但同样的查询不适用于 Neptune。

数据示例:enter link description here

查询:

   query = """g.V().hasLabel('Person').has("name", "marko").as("from", "to")
        .repeat(bothE().as("e").otherV().as("to").as("to")).times(2).emit(hasLabel("Person")).hasLabel("Person").has("name", "josh")
        .project("name",  "Label","start", "end")
        .by(select(all, "to").unfold().values("title").fold())
        .by(select(all, "to").unfold().label().fold())
        .by(select(all, "e").unfold().id().map{g.E(it.get()).next()}.outV().id().fold())
        .by(select(all, "e").unfold().id().map{g.E(it.get()).next()}.inV().id().fold())
    """

这在 Neptune 中出错,但它在 Neo4j 上有效。是否有任何其他方法来获取开始和结束节点 ID。

我不确定我是否了解您需要这样做的原因:

.by(select(all, "e").unfold().id().map{g.E(it.get()).next()}.outV().id().fold())

这不是简化为:

.by(select(all, "e").unfold().outV().id().fold())

这将摆脱 lambda,我认为这是你的 Neptune 问题。