java - Faunus json 读取器在 json 文件格式中出现错误

标签 java json gremlin faunus

我正在使用 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/

相关文章:

c# - 如何将 JSON 反序列化到这个 POCO 类中?

python - 在 Python 中过滤 json 字符串的最快方法

javascript - 如何在 javascript/typescript 中使用新的 Gremlin 3.x 语法编写旧查询

gremlin - 使用 Gremlin 递归查询更简单的树状结构

java - 计算循环执行次数

javascript - 如何通过路由值将 JSON 数组发送到操作方法 (MVC 4)

使用java读取json文件时出现java.lang.ClassCastException

azure-cosmosdb - Gremlin 查询 Edge inVLabel、outVLabel

java - Spring数据分页和排序存储库,具有多个字段和日期

java - 使用 fop 1.1 打印时出现空白页