1

我正在尝试编写一个关于如何显示具有 n 个子边和顶点的 IBM 图形的 gremlin 查询。如果用户提供了一些索引词,例如“acquisition”是索引搜索词,下面的查询返回一个好的结果

 def g = graph.traversal();g.V().has('entityString', 'acquisition').bothE().otherV().path()

但是我想遍历它的所有链接节点,然后遍历它的子节点和边缘。上述查询的输出结果如下:

[
  {
    "labels": [
      [],
      [],
      []
    ],
    "objects": [
      {
        "id": 40964248,
        "label": "EventBusiness",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "ody4z-oe07s-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "odyj7-oe07s-sl",
              "value": "acquisition"
            }
          ]
        }
      },
      {
        "id": "oe1ar-oe07s-153p-6cw",
        "label": "affectedBy",
        "type": "edge",
        "inVLabel": "Organization",
        "outVLabel": "EventBusiness",
        "inV": 8240,
        "outV": 40964248
      },
      {
        "id": 8240,
        "label": "Organization",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "2rq-6cw-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "35y-6cw-sl",
              "value": "agencies"
            }
          ]
        }
      }
    ]
  },
  {
    "labels": [
      [],
      [],
      []
    ],
    "objects": [
      {
        "id": 40964248,
        "label": "EventBusiness",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "ody4z-oe07s-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "odyj7-oe07s-sl",
              "value": "acquisition"
            }
          ]
        }
      },
      {
        "id": "odyxf-oe07s-17h1-37s",
        "label": "agentOf",
        "type": "edge",
        "inVLabel": "Organization",
        "outVLabel": "EventBusiness",
        "inV": 4168,
        "outV": 40964248
      },
      {
        "id": 4168,
        "label": "Organization",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "16x-37s-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "1l5-37s-sl",
              "value": "DoD"
            }
          ]
        }
      }
    ]
  },
  {
    "labels": [
      [],
      [],
      []
    ],
    "objects": [
      {
        "id": 40964248,
        "label": "EventBusiness",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "ody4z-oe07s-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "odyj7-oe07s-sl",
              "value": "acquisition"
            }
          ]
        }
      },
      {
        "id": "odzbn-oe07s-17h1-37s",
        "label": "agentOf",
        "type": "edge",
        "inVLabel": "Organization",
        "outVLabel": "EventBusiness",
        "inV": 4168,
        "outV": 40964248
      },
      {
        "id": 4168,
        "label": "Organization",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "16x-37s-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "1l5-37s-sl",
              "value": "DoD"
            }
          ]
        }
      }
    ]
  },
  {
    "labels": [
      [],
      [],
      []
    ],
    "objects": [
      {
        "id": 40964248,
        "label": "EventBusiness",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "ody4z-oe07s-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "odyj7-oe07s-sl",
              "value": "acquisition"
            }
          ]
        }
      },
      {
        "id": "2dv-oe07s-17h1-3bs",
        "label": "agentOf",
        "type": "edge",
        "inVLabel": "Organization",
        "outVLabel": "EventBusiness",
        "inV": 4312,
        "outV": 40964248
      },
      {
        "id": 4312,
        "label": "Organization",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "17f-3bs-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "1ln-3bs-sl",
              "value": "AT&L"
            }
          ]
        }
      }
    ]
  },
  {
    "labels": [
      [],
      [],
      []
    ],
    "objects": [
      {
        "id": 40964248,
        "label": "EventBusiness",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "ody4z-oe07s-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "odyj7-oe07s-sl",
              "value": "acquisition"
            }
          ]
        }
      },
      {
        "id": "1cruab-oe07s-17h1-6i0",
        "label": "agentOf",
        "type": "edge",
        "inVLabel": "Organization",
        "outVLabel": "EventBusiness",
        "inV": 8424,
        "outV": 40964248
      },
      {
        "id": 8424,
        "label": "Organization",
        "type": "vertex",
        "properties": {
          "verified": [
            {
              "id": "2sd-6i0-4eth",
              "value": true
            }
          ],
          "entityString": [
            {
              "id": "36l-6i0-sl",
              "value": "DoD Component TSN"
            }
          ]
        }
      }
    ]
  }
]
4

0 回答 0