Gremlin-go cannot bring out props when querying Vertex with Neptune

g := gremlingo.Traversal_().WithRemote(driverRemoteConnection)
traversal := g.GetGraphTraversal()

result, err := traversal.V("v-1").Next()
vertex, err := result.GetVertex()
fmt.Println(vertex)
g := gremlingo.Traversal_().WithRemote(driverRemoteConnection)
traversal := g.GetGraphTraversal()

result, err := traversal.V("v-1").Next()
vertex, err := result.GetVertex()
fmt.Println(vertex)
when i execute this code, it gots result as picture shows. In fact, when i use https execute same query, its returns props.
curl --location --request POST 'https://xxx.neptune.amazonaws.com:8182/gremlin' \
--header 'Content-Type: text/plain' \
--data-raw '{"gremlin":"g.V('\''v-1'\'')"}'
curl --location --request POST 'https://xxx.neptune.amazonaws.com:8182/gremlin' \
--header 'Content-Type: text/plain' \
--data-raw '{"gremlin":"g.V('\''v-1'\'')"}'
response is
{

"result": {
"data": {
"@type": "g:List",
"@value": [
{
"@type": "g:Vertex",
"@value": {
"id": "v-1",
"label": "PERSON",
"properties": {
"email": [
{
"@type": "g:VertexProperty",
"@value": {
"value": "[email protected]",
"label": "email"
}
}
],
}
]
}
}
}
]
},
"meta": {
"@type": "g:Map",
"@value": []
}
}
}
{

"result": {
"data": {
"@type": "g:List",
"@value": [
{
"@type": "g:Vertex",
"@value": {
"id": "v-1",
"label": "PERSON",
"properties": {
"email": [
{
"@type": "g:VertexProperty",
"@value": {
"value": "[email protected]",
"label": "email"
}
}
],
}
]
}
}
}
]
},
"meta": {
"@type": "g:Map",
"@value": []
}
}
}
No description
Solution:
The short answer is that you can get properties on your returned elements after 3.7.0 - https://tinkerpop.apache.org/docs/current/upgrade/#_properties_on_elements (note that the graph database that you are using must also support 3.7.x). If you care about the long answer then you should read this: https://lists.apache.org/thread.html/e959e85d4f8b3d46d281f2742a6e574c7d27c54bfc52f802f7c04af3%40%3Cdev.tinkerpop.apache.org%3E
Jump to solution
13 Replies
Reverie
Reverie12mo ago
Why does this happen
Solution
spmallette
spmallette12mo ago
The short answer is that you can get properties on your returned elements after 3.7.0 - https://tinkerpop.apache.org/docs/current/upgrade/#_properties_on_elements (note that the graph database that you are using must also support 3.7.x). If you care about the long answer then you should read this: https://lists.apache.org/thread.html/e959e85d4f8b3d46d281f2742a6e574c7d27c54bfc52f802f7c04af3%40%3Cdev.tinkerpop.apache.org%3E
Reverie
Reverie12mo ago
Thank you very much!
spmallette
spmallette12mo ago
Neptune is working on bringing 3.7.x support. There is no projected date for its release yet.
Reverie
Reverie12mo ago
yes, Neptune currently supports up to 3.6.2. What I am confused about is when I use other gremlin go client such as github.com/northwesternmutual/grammes. g.V() can obtain all information including prop. Is this because of the MIME type?
spmallette
spmallette12mo ago
i'm not really sure. i don't know the internals of grammes, but they could be just doing some magic to make it happen. i'd guess they are making two requests (or more) to get the properties (i.e. g.V() gets the reference vertices with just id/label and then when you access properties it sends a second query to retrieve those...but again, just a guess). not sure if there is a serializer combination that can deliver properties over bytecode based requests but if there is it wouldn't matter for TinkerPop's gremlin-go because the vertex/edge objects don't have properties members to deserialize those into even if they were there.
Reverie
Reverie12mo ago
Thank you again, your reply is very helpful to me:) <:gremlin_smile:1091719089807958067> I know what's going on, grammes add on the mimetype"application/vnd.gremlin-v2.0+json" to the header of the websocket request, so the gremlin server return the json response including properties, and gremlin-go serilazer only support MimeType
const graphBinaryMimeType = "application/vnd.graphbinary-v1.0"
const graphBinaryMimeType = "application/vnd.graphbinary-v1.0"
Are there any plans to implement a json serializer/deserializer? If so, I would like to participate and make some contributions.
spmallette
spmallette12mo ago
oh, right you're using Neptune. I forgot Neptune has some slightly diffrent behavior there compared to Gremlin Server. Gremlin Server will automatically detach graph elements and convert them to references. Neptune never followed that pattern.
Reverie
Reverie12mo ago
Oh, so that’s it
spmallette
spmallette12mo ago
Are there any plans to implement a json serializer/deserializer?
no, i don't think so. it wouldn't help too much especially since 3.7.0 puts properties on elements. GraphBinary will be a more efficient format so adding GraphSON too wouldn't bring much new to the table. that said, we'd love to have you contribute in other ways if you'd like to for futher clarity, Neptune and GraphBinary would never return properties because GraphBinary didn't serialize them prior to 3.7.0. Neptune does return properties for GraphSON because it doesn't follow the auto-detachment model that Gremlin Server did prior to 3.7.0.
Reverie
Reverie12mo ago
Tricky problem, we are currently investigating to replace the original go client and use the official gremlin go client ok, i got you, I will wait for Neptune support 3.7.0
spmallette
spmallette12mo ago
i think waiting would be the best course of action. hopefully it won't be too long a wait
Reverie
Reverie12mo ago
thank you so much ❤️
Want results from more Discord servers?
Add your server