Class: NeoScout::GDB_Neo4j::ElementIterator
- Inherits:
-
ElementIterator
- Object
- ElementIterator
- NeoScout::GDB_Neo4j::ElementIterator
- Defined in:
- lib/neoscout/gdb_neo4j.rb
Instance Method Summary collapse
Instance Method Details
#iter_edges(args) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/neoscout/gdb_neo4j.rb', line 90 def iter_edges(args) if args[:report_progress] then report = args[:report_progress] else report = lambda { |mode, what, num| } end glops = org.neo4j.tooling.GlobalGraphOperations.at(Neo4j.db.graph) iter = glops.getAllRelationships.iterator num = 0 while iter.hasNext do num = num + 1 report.call(:progress, :edges, num) yield iter.next end report.call(:finish, :edges, num) num end |
#iter_nodes(args) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/neoscout/gdb_neo4j.rb', line 72 def iter_nodes(args) if args[:report_progress] then report = args[:report_progress] else report = lambda { |mode, what, num| } end glops = org.neo4j.tooling.GlobalGraphOperations.at(Neo4j.db.graph) iter = glops.getAllNodes.iterator num = 0 while iter.hasNext do node = iter.next num = num + 1 report.call(:progress, :nodes, num) yield node unless node.getId == 0 end report.call(:finish, :nodes, num) num end |