I am trying write a gremlin query on how to display IBM graph with n number of child edges and vertex . if user has provided some index word , for example "acquisition" is index search word, the following query return a good result
def g = graph.traversal();g.V().has('entityString', 'acquisition').bothE().otherV().path()
But I would like to traversal through all its linked nodes and then its child nodes and its edges. The output result of the above query is following:
[
{
"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"
}
]
}
}
]
}
]