import neo4j
import console
-import flush_stdout
# A storage medium for a graph.
#
#
# This method must be called before the first call to `show_progress` or
# `show_done`.
- protected fun prepare_display do
- printn "{term_save_cursor} "
- flush_stdout
- end
+ protected fun prepare_display do printn "{term_save_cursor} "
# Show the progress, in percentage.
#
# For use in the implementation of `save_all` only.
protected fun show_progress(progress: Int) do
printn "{term_rewind} {progress}% "
- flush_stdout
end
# Show a message to indicate that the task finished with success.
# For use in the implementation of `save_all` only.
protected fun show_done do
print "{term_rewind} Done."
- flush_stdout
end
end
# The Neo4j client to use.
var client: Neo4jClient
- redef fun has_node_label(name: String): Bool do
+ redef fun has_node_label(name) do
var query = new CypherQuery.from_string(
"match n where \{name\} in labels(n) return count(n)")
query.params["name"] = name
return result > 0
end
- redef fun save_all(neo_entities: Collection[NeoEntity]) do
+ redef fun save_all(neo_entities) do
var batch = new NeoBatch(client)
var len = neo_entities.length
var sum = 0