bricaud / graphexp

Interactive visualization of the Gremlin graph database with D3.js
Apache License 2.0
780 stars 215 forks source link

Trouble parsing returned json from Gremlin Server 3.3 #4

Closed cmar81 closed 6 years ago

cmar81 commented 6 years ago

I am having problems running graphexp locally against the latest gremlin server (3.3) as linked to in your introduction. The server runs locally using the gremlin-server-rest-modern.yaml configuration.

The chrome console says: Uncaught TypeError: Cannot read property '0' of undefined at Object.display_graph_info (infobox.js:63) at handle_server_answer (graphioGremlin.js:201)

the line is var data_to_display = data[0][0];

data is currently: {@type: "g:List", @value: Array(4)}

The network tab shows a POST against localhost:8182 with form data: {"gremlin":"nodes : g.V().groupCount().by(label);nodesprop = g.V().valueMap().select(keys).groupCount();edges = g.E().groupCount().by(label);edgesprop = g.E().valueMap().select(keys).groupCount();[nodes.toList(),nodesprop.toList(),edges.toList(),edgesprop.toList()]"}

and the full data variable at the time of data[0][0]

JSON.stringify(Data) "{"@type":"g:List","@value":[{"@type":"g:List","@value":[{"@type":"g:Map","@value":["software",{"@type":"g:Int64","@value":2},"person",{"@type":"g:Int64","@value":4}]}]},{"@type":"g:List","@value":[{"@type":"g:Map","@value":[{"@type":"g:Set","@value":["name","age"]},{"@type":"g:Int64","@value":4},{"@type":"g:Set","@value":["name","lang"]},{"@type":"g:Int64","@value":2}]}]},{"@type":"g:List","@value":[{"@type":"g:Map","@value":["created",{"@type":"g:Int64","@value":4},"knows",{"@type":"g:Int64","@value":2}]}]},{"@type":"g:List","@value":[{"@type":"g:Map","@value":[{"@type":"g:Set","@value":["weight"]},{"@type":"g:Int64","@value":6}]}]}]}"

bricaud commented 6 years ago

Right. I got the same error using Gremlin server 3.3. I try to fix it as soon as possible, that will force me to update to version 3.3. Thanks.

bricaud commented 6 years ago

The communication format has changed. Gremlin 3.3 use GraphSON 3.0 by default: http://tinkerpop.apache.org/docs/3.3.0/upgrade/#_changes_to_io Graphexp uses GraphSON 2.0. You may change back to GraphSON 2.0 by following the instructions in the link, or wait until Graphexp is updated (it should not take too long).

bricaud commented 6 years ago

Graphexp now handles GraphSON 3.0