Azure cosmos support Serializers.GRAPHSON_V2D0
. List<Result> resultList = client.submit("g.V().limit(1)").all().get()
returns all the properties with the vertex and the format is completely different. Result
looks like
{
"resultObject": {
"id": "63073513-1e86-49e6-a949-07f1e16c782b",
"label": "TYPE-1",
"type": "vertex",
"properties": {
"prop1": [
{
"id": "63073513-1e86-49e6-a949-07f1e16c782b",
"value": "value1"
}
],
}
}
}
But if I use Traversal with TinkerGraph, the default result uses Serializers.GRAPHSON
where the result looks like
[
{
"id": "63073513-1e86-49e6-a949-07f1e16c782b",
"label": "TYPE-1"
}
]
For small result we can put a layer to covert the result but won't be straight forward thing for complex Path
and other queries. I tried GraphSONMapper
but didn't work.
Is there any way to convert Serializers.GRAPHSON_V2D0
to Serializers.GRAPHSON
? Or can we get GraphSON
result from Cosmos?
This is not actually due to the serializers. It is due to the fact that, by default, Gremlin Server only returns a "Reference Element" for a vertex. It will just contain its ID and label. You can disable that by editing the script file in the
<gremlin-server-root>/scripts
folder. In there, the default file used is calledempty-sample.groovy
. At the bottom of that file you will find this line:All you need to do is to replace it with just
Having done that, restart the server and you should see all properties as well as the ID and label.