Faunus json reader error in json file format

85 views Asked by At

I'm using a json file to load nodes and edges to faunus gremlin but it gives me error like this...

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)

I have this format for the json file (actual file)...

{
            "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"
        } 
         ]  
          }

Here's look at what I did at gremlin: https://i.stack.imgur.com/PptIt.png

Basically just ran g.V after loading faunus.properties

Is the format correct or should do something else to resolve the error. Can't understand where the problem is creeping from.

Thanks in advance

1

There are 1 answers

2
stephen mallette On BEST ANSWER

Your example shows a format that is not a valid JSON format readable by Faunus (aka titan-hadoop). That example shows an edge list format produced from the Blueprints GraphSON writer. Faunus requires an adjacency list format as shown in the documentation (correctly mentioned in the comment by Konstantin on the original question):

http://s3.thinkaurelius.com/docs/titan/0.5.4/graphson-io-format.html

The adjacency list allows such a file to be split among hadoop nodes when Faunus goes to read it.