I'm testing and studying Neptune with Gremlin.
I have created a few nodes of type User that simply have an id
and an email
.
If I make a raw query for them I get:
// 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"
}
}
]
}
}
}
]
}
I wan't to represent this graph using visjs. So I would like to return basically 3 properties for each node:
id - mail
)To do so, I'm executing the following query:
g.V()
.hasLabel('User')
.project('id', 'label', 'group')
.by(T.id)
.by(
union(id(), values('email'))
.fold()
)
.by(T.label)
But the result is not as expected. I get the projection for label
right only for the first node and empty for the others:
"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
]
}
]
}
]
}
Any ideas why this happens or how could I execute a similar task?
Adding an answer so that the solution proposed in the comments can be accepted if the new version mentioned did resolve the issue.
Upgrading the Neptune instance to https://docs.aws.amazon.com/neptune/latest/userguide/engine-releases-1.0.2.1.R4.html should resolve the issue.