#
# * `"nodes"`: An array with all nodes. Each node is an object with the
# following properties:
-# * `"labels"`: An array of all applied labels.
-# * `"properties"`: An object mapping each defined property to its value.
+# * `"labels"`: An array of all applied labels.
+# * `"properties"`: An object mapping each defined property to its value.
# * `"edges"`: An array with all relationships. Each relationship is an object
# with the following properties:
-# * `"type"`: The type (`String`) of the relationship.
-# * `"properties"`: An object mapping each defined property to its value.
-# * `"from"`: The local ID of the source node.
-# * `"to"`: The local ID of the destination node.
+# * `"type"`: The type (`String`) of the relationship.
+# * `"properties"`: An object mapping each defined property to its value.
+# * `"from"`: The local ID of the source node.
+# * `"to"`: The local ID of the destination node.
#
# ~~~nit
# import neo4j::graph::sequential_id
# a.labels.add "Foo"
# a["answer"] = 42
# a["Ultimate question of"] = new JsonArray.from(["life",
-# "the Universe", "and Everything."])
+# "the Universe", "and Everything."])
# graph.nodes.register a
# var b = graph.create_node
# b.labels.add "Foo"
# store.load
# 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]
+# 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
# ~~~
# a.labels.add "Foo"
# a["answer"] = 42
# a["Ultimate question of"] = new JsonArray.from(["life",
- # "the Universe", "and Everything."])
+ # "the Universe", "and Everything."])
# graph.nodes.register a
# var b = graph.create_node
# b.labels.add "Foo"
# graph.edges.add new NeoEdge(a, "BAZ", b)
#
# graph = new NeoGraph.from_json(
- # new SequentialNodeCollection("node_id"), graph.to_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]
+ # 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
# ~~~
#
# var node = new NeoNode.from_json("""
# {
- # "labels": ["foo", "Bar"],
- # "properties": {
- # "baz": 42
- # }
+ # "labels": ["foo", "Bar"],
+ # "properties": {
+ # "baz": 42
+ # }
# }
# """)
# assert ["foo", "Bar"] == node.labels
redef fun to_s do return to_json
# Append the JSON representation of the node to the specified buffer.
- redef fun append_json_for(graph: NeoGraph, buffer: Buffer) do
+ redef fun append_json_for(graph, buffer) do
append_json(buffer)
end
end
# Append the JSON representation of the relationship to the specified buffer.
#
# Use the IDs specfied by `graph.nodes`.
- redef fun append_json_for(graph: NeoGraph, buffer: Buffer) do
+ redef fun append_json_for(graph, buffer) do
buffer.append "\{\"type\":"
rel_type.append_json(buffer)
buffer.append ",\"properties\":"