Retrieve the graph from the specified JSON document.

For the expected format, see JsonGraphStore.

import neo4j::graph::sequential_id

var graph = new NeoGraph(new SequentialNodeCollection("node_id"))
var a = new NeoNode
a.labels.add "Foo"
a["answer"] = 42
a["Ultimate question of"] = new JsonArray.from(["life",
        "the Universe", "and Everything."])
graph.nodes.register a
var b = graph.create_node
b.labels.add "Foo"
b.labels.add "Bar"
graph.edges.add new NeoEdge(a, "BAZ", b)

graph = new NeoGraph.from_json(
        new SequentialNodeCollection("node_id"), graph.to_json)
assert 1 == graph.edges.length
for edge in graph.edges do
    assert "BAZ" == edge.rel_type
    assert a.labels == edge.from.labels
    for k, v in a.properties do assert v == edge.from.properties[k]
    assert b.labels == edge.to.labels
    for k, v in b.properties do assert v == edge.to.properties[k]
end
assert 2 == graph.nodes.length

Property definitions

neo4j :: json_graph_store $ NeoGraph :: from_json
	# Retrieve the graph from the specified JSON document.
	#
	# For the expected format, see `JsonGraphStore`.
	#
	# ~~~nit
	# import neo4j::graph::sequential_id
	#
	# var graph = new NeoGraph(new SequentialNodeCollection("node_id"))
	# var a = new NeoNode
	# a.labels.add "Foo"
	# a["answer"] = 42
	# a["Ultimate question of"] = new JsonArray.from(["life",
	#		"the Universe", "and Everything."])
	# graph.nodes.register a
	# var b = graph.create_node
	# b.labels.add "Foo"
	# b.labels.add "Bar"
	# graph.edges.add new NeoEdge(a, "BAZ", b)
	#
	# graph = new NeoGraph.from_json(
	#		new SequentialNodeCollection("node_id"), graph.to_json)
	# assert 1 == graph.edges.length
	# for edge in graph.edges do
	#	assert "BAZ" == edge.rel_type
	#	assert a.labels == edge.from.labels
	#	for k, v in a.properties do assert v == edge.from.properties[k]
	#	assert b.labels == edge.to.labels
	#	for k, v in b.properties do assert v == edge.to.properties[k]
	# end
	# assert 2 == graph.nodes.length
	# ~~~
	init from_json(nodes: NeoNodeCollection, t: Text) do
		from_json_object(nodes, t.parse_json.as(JsonObject))
	end
lib/neo4j/graph/json_graph_store.nit:116,2--149,4