Module: Neo4j::Spatial::Database
- Included in:
- ImageExporter, Layer, OSMImporter, SHPExporter, SHPImporter
- Defined in:
- lib/neo4j/spatial/database.rb
Overview
This module is to be included in classes that wish to have instance level access to the database and spatial database extensions
Instance Method Summary collapse
- #batch_inserter ⇒ Object
- #database(options = {}) ⇒ Object
- #list_all ⇒ Object
- #normal_database ⇒ Object
- #spatial ⇒ Object
Instance Method Details
#batch_inserter ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/neo4j/spatial/database.rb', line 63 def batch_inserter unless @bi puts "Getting batch inserter database API access" @spatial = nil @bi = @db.restart_batch_inserter end @bi end |
#database(options = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/neo4j/spatial/database.rb', line 48 def database(={}) [:dbpath] ||= Neo4j::Config[:storage_path] if Neo4j.running? && Neo4j::Config[:storage_path] != [:dbpath] raise "Database already running at different location: #{Neo4j::Config[:storage_path]} != #{[:dbpath]}" end Neo4j::Config[:storage_path] = [:dbpath] @commit = [:commit] || 1000 normal_database end |
#list_all ⇒ Object
60 61 62 |
# File 'lib/neo4j/spatial/database.rb', line 60 def list_all spatial.layer_names end |
#normal_database ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/neo4j/spatial/database.rb', line 71 def normal_database if @db && @db.is_batch? puts "Switch off BatchInserter access" @db.restart_normal_database @spatial = nil @bi = nil end @db ||= Neo4j.started_db @db.graph end |
#spatial ⇒ Object
57 58 59 |
# File 'lib/neo4j/spatial/database.rb', line 57 def spatial @spatial ||= @db.spatial end |