JanusGraph 3.x graphson导入在经过预处理的json上失败



是否有其他人在将经过预处理的json/graphson导入JanusGraph时遇到此问题?

完全相同但未经过预处理的文件(没有回车、制表符、空白(将完美导入,但如果经过预处理,则会失败,并出现以下错误:

graph.io(graphson()).readGraph("data/tgraph2.json")

Could not deserialize the JSON value as required. Nested exception: java.lang.InstantiationException: Cannot deserialize the value with the detected type contained in the JSON ('tinker:graph') to the type specified in parameter to the object mapper (class java.util.LinkedHashMap). Those types are incompatible. at [Source: (ByteArrayInputStream); line: 1, column: 3]

请注意,手动编辑文件以删除第一个换行符,错误消息将更改为... at [Source: (ByteArrayInputStream); line: 1, column: 12]等,因此文件中的空白肯定是个问题。

3.x版

这当然不是我们所期望的行为。json的工作原理应该是一样的,无论是用空格修饰还是缩小。

需要注意的是GraphSON有两种形式。在一种形式中,整个文件不是一个JSON文档,而是每一行都是。每一行表示顶点的邻接列表。

这是默认的GraphSON格式,它是为流式传输而设计的,因此可以很容易地将文件分解为多线程操作。另一种形式是包含所有顶点和所有边的单个JSON文档。

此处记录了格式

http://tinkerpop.apache.org/docs/3.4.1/dev/io/#graphson

最新更新