I am using the Gremlin I/O library ( GraphSONMapper + GraphSONWriter ) to export already existing Janus graph to a GraphJson.
The json file content after export is (export.json)
{
"id": {
"@type": "g:Int64",
"@value": 2289864
},
"label": "user",
"outE": {
"user_group": [
{
"id": {
"@type": "janusgraph:RelationIdentifier",
"@value": {
"relationId": "5po9l-1d2vc-1ij9-9mw"
}
},
"inV": {
"@type": "g:Int64",
"@value": 12488
},
"properties": {
"access_type": "E"
}
}
]
},
"properties": {
"username": [
{
"id": {
"@type": "janusgraph:RelationIdentifier",
"@value": {
"relationId": "5pnvd-1d2vc-2txh"
}
},
"value": "tester"
}
]
}
}
I want to import this json data to a new graph directly.I tried importing with the below command but facing below error in deserialization.
graph = TinkerGraph.open();
graph.io(graphson()).readGraph('/tmp/export.json');
Exception : org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException: Could not deserialize the JSON value as required. Nested exception:org.apache.tinkerpop.shaded.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (ByteArrayInputStream); line: 1, column: 137]
at [Source: (ByteArrayInputStream); line: 1, column: 137] (through reference chain: java.util.LinkedHashMap["outE"]>java.util.LinkedHashMap["user_group"]>java.util.ArrayList[0]>java.util.LinkedHashMap["id"])
Can someone please help me to import the above GraphJson to a new Janus graph with the same set of vertices and edges?