查询返回错误值

Query returning wrong values

我正在使用 Gremlin 测试和研究 Neptune。 我创建了一些类型为 User 的节点,它们只有一个 id 和一个 email。 如果我对他们进行原始查询,我会得到:

// http://my-neptune/?gremlin=g.V().hasLabel('User')

  "result": {
    "data": {
      "@type": "g:List",
      "@value": [
        {
          "@type": "g:Vertex",
          "@value": {
            "id": "u01",
            "label": "User",
            "properties": {
              "email": [
                {
                  "@type": "g:VertexProperty",
                  "@value": {
                    "id": {
                      "@type": "g:Int32",
                      "@value": 2051025270
                    },
                    "value": "User01@email.com",
                    "label": "email"
                  }
                }
              ]
            }
          }
        },
        {
          "@type": "g:Vertex",
          "@value": {
            "id": "u02",
            "label": "User",
            "properties": {
              "email": [
                {
                  "@type": "g:VertexProperty",
                  "@value": {
                    "id": {
                      "@type": "g:Int32",
                      "@value": -374298315
                    },
                    "value": "user02@mail.com",
                    "label": "email"
                  }
                }
              ]
            }
          }
        }
      ]
    }

我不想使用 visjs 表示此图。所以我想 return 每个节点基本上有 3 个属性:

为此,我正在执行以下查询:

g.V()
    .hasLabel('User')
    .project('id', 'label', 'group')
    .by(T.id)
    .by(
        union(id(), values('email'))
        .fold()
    )
    .by(T.label)

但结果并不如预期。我得到 label 的投影只对第一个节点正确,对其他节点为空:

  "result": {
    "data": {
      "@type": "g:List",
      "@value": [
        {
          "@type": "g:Map",
          "@value": [
            "id",
            "u01",
            "label",
            {
              "@type": "g:List",
              "@value": [
                "u01",
                "User01@email.com"
              ]
            },
            "group",
            "User"
          ]
        },
        {
          "@type": "g:Map",
          "@value": [
            "id",
            "u02",
            "group",
            "User",
            "label",
            {
              "@type": "g:List",
              "@value": [
                // This list should not be empty 
              ]
            }
          ]
        }
      ]
    }

知道为什么会发生这种情况,或者我该如何执行类似的任务?

添加一个答案,以便如果提到的新版本确实解决了问题,可以接受评论中提出的解决方案。

将 Neptune 实例升级到 https://docs.aws.amazon.com/neptune/latest/userguide/engine-releases-1.0.2.1.R4.html 应该可以解决问题。