nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: Nitg-g new NativeArray fix
[nit.git]
/
lib
/
neo4j
/
graph
/
json_graph_store.nit
diff --git
a/lib/neo4j/graph/json_graph_store.nit
b/lib/neo4j/graph/json_graph_store.nit
index
9c97216
..
898c059
100644
(file)
--- a/
lib/neo4j/graph/json_graph_store.nit
+++ b/
lib/neo4j/graph/json_graph_store.nit
@@
-44,7
+44,7
@@
import graph
# b.labels.add "Bar"
# graph.edges.add new NeoEdge(a, "BAZ", b)
#
# b.labels.add "Bar"
# graph.edges.add new NeoEdge(a, "BAZ", b)
#
-# var ostream = new StringOStream
+# var ostream = new StringWriter
# var store = new JsonGraphStore(graph)
# store.ostream = ostream
# store.save
# var store = new JsonGraphStore(graph)
# store.ostream = ostream
# store.save
@@
-57,7
+57,7
@@
import graph
#
# graph.nodes.clear
# graph.edges.clear
#
# graph.nodes.clear
# graph.edges.clear
-# store.istream = new StringIStream(ostream.to_s)
+# store.istream = new StringReader(ostream.to_s)
# store.load
# assert 1 == graph.edges.length
# for edge in graph.edges do
# store.load
# assert 1 == graph.edges.length
# for edge in graph.edges do
@@
-73,13
+73,13
@@
class JsonGraphStore
super GraphStore
# The stream to use for `load`.
super GraphStore
# The stream to use for `load`.
- var istream: nullable IStream = null is writable
+ var istream: nullable Reader = null is writable
# The stream to use for `save` and `save_part`.
# The stream to use for `save` and `save_part`.
- var ostream: nullable OStream = null is writable
+ var ostream: nullable Writer = null is writable
- # Use the specified `IOStream`.
- init from_io(graph: NeoGraph, iostream: IOStream) do
+ # Use the specified `Duplex`.
+ init from_io(graph: NeoGraph, iostream: Duplex) do
init(graph)
istream = iostream
ostream = iostream
init(graph)
istream = iostream
ostream = iostream
@@
-88,14
+88,14
@@
class JsonGraphStore
# Use the specified string to load the graph.
init from_string(graph: NeoGraph, string: String) do
init(graph)
# Use the specified string to load the graph.
init from_string(graph: NeoGraph, string: String) do
init(graph)
- istream = new StringIStream(string)
+ istream = new StringReader(string)
end
redef fun isolated_save do return true
redef fun load do
var istream = self.istream
end
redef fun isolated_save do return true
redef fun load do
var istream = self.istream
- assert istream isa IStream
+ assert istream isa Reader
fire_started
graph.load_json(istream.read_all)
fire_done
fire_started
graph.load_json(istream.read_all)
fire_done
@@
-103,7
+103,7
@@
class JsonGraphStore
redef fun save_part(nodes, edges) do
var ostream = self.ostream
redef fun save_part(nodes, edges) do
var ostream = self.ostream
- assert ostream isa OStream
+ assert ostream isa Writer
fire_started
ostream.write(graph.to_json)
fire_done
fire_started
ostream.write(graph.to_json)
fire_done
@@
-297,7
+297,7
@@
redef class NeoNode
redef fun to_s do return to_json
# Append the JSON representation of the node to the specified buffer.
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_json(buffer)
end
end
@@
-307,7
+307,7
@@
redef class NeoEdge
# Append the JSON representation of the relationship to the specified buffer.
#
# Use the IDs specfied by `graph.nodes`.
# 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\":"
buffer.append "\{\"type\":"
rel_type.append_json(buffer)
buffer.append ",\"properties\":"