gremlin - Janus Graph 使用 GraphJson 导出和导入
问题描述
我正在使用 Gremlin I/O 库(GraphSONMapper + GraphSONWriter)将现有的 Janus 图导出到 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"
}
]
}
}
我想直接将此 json 数据导入到新图形中。我尝试使用以下命令导入,但在反序列化中遇到以下错误。
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"])
有人可以帮我将上面的 GraphJson 导入到具有相同顶点和边集的新 Janus 图中吗?