我正在使用 json 文件将节点和边加载到 faunus gremlin,但它给了我这样的错误......
java.io.IOException: A JSONObject text must end with '}' at character 1 of {
at com.thinkaurelius.faunus.formats.graphson.FaunusGraphSONUtility.fromJSON(FaunusGraphSONUtility.java:76)
at com.thinkaurelius.faunus.formats.graphson.GraphSONRecordReader.nextKeyValue(GraphSONRecordReader.java:41)
我有这种格式的 json 文件(实际文件)...
{
"mode": "NORMAL",
"vertices": [
{
"_id": "5",
"PostId": "5",
"Vtype": "Post",
"_type": "vertex"
},
{
"_id": "definitions",
"_type": "vertex",
"Count": "9",
"TagId": "definitions"
}
]
}
{
"mode": "NORMAL",
"edges": [
{
"_outV": "definitions",
"_type": "edge",
"_id": 0,
"_inV": "5",
"_label": "totalAuthorIs"
}
]
}
看看我在 gremlin 做了什么: /image/PptIt.png
基本上只是在加载 faunus.properties 后运行 g.V
格式是否正确,或者应该执行其他操作来解决错误。无法理解问题从何而来。
提前致谢
最佳答案
您的示例显示的格式不是 Faunus(又名 titan-hadoop)可读的有效 JSON 格式。该示例显示了 Blueprints GraphSON writer 生成的边列表格式。 Faunus 需要一个邻接列表格式,如文档中所示(康斯坦丁在原始问题的评论中正确提到):
http://s3.thinkaurelius.com/docs/titan/0.5.4/graphson-io-format.html
当 Faunus 读取该文件时,邻接列表允许在 hadoop 节点之间分割该文件。
关于java - Faunus json 读取器在 json 文件格式中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30832394/