neo4j-core 8.1.4 → 9.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +71 -8
  3. data/lib/neo4j-core.rb +3 -49
  4. data/lib/neo4j/core.rb +4 -0
  5. data/lib/neo4j/core/config.rb +13 -0
  6. data/lib/neo4j/core/cypher_session/adaptors.rb +15 -15
  7. data/lib/neo4j/core/cypher_session/adaptors/bolt.rb +39 -48
  8. data/lib/neo4j/core/cypher_session/adaptors/bolt/chunk_writer_io.rb +0 -4
  9. data/lib/neo4j/core/cypher_session/adaptors/bolt/pack_stream.rb +7 -3
  10. data/lib/neo4j/core/cypher_session/adaptors/embedded.rb +1 -2
  11. data/lib/neo4j/core/cypher_session/adaptors/has_uri.rb +4 -0
  12. data/lib/neo4j/core/cypher_session/adaptors/http.rb +1 -3
  13. data/lib/neo4j/core/cypher_session/responses.rb +1 -1
  14. data/lib/neo4j/core/cypher_session/responses/bolt.rb +0 -17
  15. data/lib/neo4j/core/cypher_session/responses/embedded.rb +9 -7
  16. data/lib/neo4j/core/cypher_session/responses/http.rb +3 -4
  17. data/lib/neo4j/core/cypher_session/transactions.rb +2 -0
  18. data/lib/{neo4j-core → neo4j/core}/helpers.rb +1 -14
  19. data/lib/neo4j/core/logging.rb +44 -0
  20. data/lib/{neo4j-core → neo4j/core}/query.rb +7 -6
  21. data/lib/{neo4j-core → neo4j/core}/query_clauses.rb +9 -16
  22. data/lib/{neo4j-core → neo4j/core}/query_find_in_batches.rb +3 -5
  23. data/lib/{neo4j-core → neo4j/core}/version.rb +1 -1
  24. data/lib/neo4j/transaction.rb +6 -8
  25. data/neo4j-core.gemspec +13 -11
  26. metadata +46 -50
  27. data/lib/ext/kernel.rb +0 -9
  28. data/lib/neo4j-core/active_entity.rb +0 -11
  29. data/lib/neo4j-core/label.rb +0 -9
  30. data/lib/neo4j-embedded.rb +0 -16
  31. data/lib/neo4j-embedded/cypher_response.rb +0 -71
  32. data/lib/neo4j-embedded/embedded_database.rb +0 -26
  33. data/lib/neo4j-embedded/embedded_ha_session.rb +0 -30
  34. data/lib/neo4j-embedded/embedded_impermanent_session.rb +0 -17
  35. data/lib/neo4j-embedded/embedded_label.rb +0 -88
  36. data/lib/neo4j-embedded/embedded_node.rb +0 -206
  37. data/lib/neo4j-embedded/embedded_relationship.rb +0 -77
  38. data/lib/neo4j-embedded/embedded_session.rb +0 -203
  39. data/lib/neo4j-embedded/embedded_transaction.rb +0 -30
  40. data/lib/neo4j-embedded/label.rb +0 -66
  41. data/lib/neo4j-embedded/property.rb +0 -106
  42. data/lib/neo4j-embedded/to_java.rb +0 -44
  43. data/lib/neo4j-server.rb +0 -12
  44. data/lib/neo4j-server/cypher_label.rb +0 -35
  45. data/lib/neo4j-server/cypher_node.rb +0 -221
  46. data/lib/neo4j-server/cypher_relationship.rb +0 -142
  47. data/lib/neo4j-server/cypher_response.rb +0 -248
  48. data/lib/neo4j-server/cypher_session.rb +0 -263
  49. data/lib/neo4j-server/cypher_transaction.rb +0 -100
  50. data/lib/neo4j-server/label.rb +0 -40
  51. data/lib/neo4j-server/resource.rb +0 -57
  52. data/lib/neo4j/entity_equality.rb +0 -8
  53. data/lib/neo4j/entity_marshal.rb +0 -20
  54. data/lib/neo4j/label.rb +0 -90
  55. data/lib/neo4j/node.rb +0 -216
  56. data/lib/neo4j/property_container.rb +0 -17
  57. data/lib/neo4j/property_validator.rb +0 -22
  58. data/lib/neo4j/relationship.rb +0 -161
  59. data/lib/neo4j/session.rb +0 -222
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.4
4
+ version: 9.0.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Chris Grigg, Brian Underwood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-11 00:00:00.000000000 Z
11
+ date: 2018-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: net_tcp_client
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 2.0.1
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 2.0.1
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: typhoeus
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +136,20 @@ dependencies:
122
136
  - - ">="
123
137
  - !ruby/object:Gem::Version
124
138
  version: 1.1.2
139
+ - !ruby/object:Gem::Dependency
140
+ name: dryspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
154
  name: neo4j-rake_tasks
127
155
  requirement: !ruby/object:Gem::Requirement
@@ -212,18 +240,16 @@ dependencies:
212
240
  requirements:
213
241
  - - "~>"
214
242
  - !ruby/object:Gem::Version
215
- version: 0.49.1
243
+ version: 0.56.0
216
244
  type: :development
217
245
  prerelease: false
218
246
  version_requirements: !ruby/object:Gem::Requirement
219
247
  requirements:
220
248
  - - "~>"
221
249
  - !ruby/object:Gem::Version
222
- version: 0.49.1
223
- description: 'Neo4j-core provides classes and methods to work with the graph database
224
- Neo4j.
225
-
226
- '
250
+ version: 0.56.0
251
+ description: " Neo4j-core provides classes and methods to work with the graph database
252
+ Neo4j.\n"
227
253
  email: andreas.ronge@gmail.com, chris@subvertallmedia.com, brian@brian-underwood.codes
228
254
  executables: []
229
255
  extensions: []
@@ -233,38 +259,10 @@ files:
233
259
  - Gemfile
234
260
  - README.md
235
261
  - bin/rake
236
- - lib/ext/kernel.rb
237
262
  - lib/neo4j-core.rb
238
- - lib/neo4j-core/active_entity.rb
239
- - lib/neo4j-core/helpers.rb
240
- - lib/neo4j-core/label.rb
241
- - lib/neo4j-core/query.rb
242
- - lib/neo4j-core/query_clauses.rb
243
- - lib/neo4j-core/query_find_in_batches.rb
244
- - lib/neo4j-core/version.rb
245
- - lib/neo4j-embedded.rb
246
- - lib/neo4j-embedded/cypher_response.rb
247
- - lib/neo4j-embedded/embedded_database.rb
248
- - lib/neo4j-embedded/embedded_ha_session.rb
249
- - lib/neo4j-embedded/embedded_impermanent_session.rb
250
- - lib/neo4j-embedded/embedded_label.rb
251
- - lib/neo4j-embedded/embedded_node.rb
252
- - lib/neo4j-embedded/embedded_relationship.rb
253
- - lib/neo4j-embedded/embedded_session.rb
254
- - lib/neo4j-embedded/embedded_transaction.rb
255
- - lib/neo4j-embedded/label.rb
256
- - lib/neo4j-embedded/property.rb
257
- - lib/neo4j-embedded/to_java.rb
258
- - lib/neo4j-server.rb
259
- - lib/neo4j-server/cypher_label.rb
260
- - lib/neo4j-server/cypher_node.rb
261
- - lib/neo4j-server/cypher_relationship.rb
262
- - lib/neo4j-server/cypher_response.rb
263
- - lib/neo4j-server/cypher_session.rb
264
- - lib/neo4j-server/cypher_transaction.rb
265
- - lib/neo4j-server/label.rb
266
- - lib/neo4j-server/resource.rb
267
263
  - lib/neo4j/ansi.rb
264
+ - lib/neo4j/core.rb
265
+ - lib/neo4j/core/config.rb
268
266
  - lib/neo4j/core/cypher_session.rb
269
267
  - lib/neo4j/core/cypher_session/adaptors.rb
270
268
  - lib/neo4j/core/cypher_session/adaptors/bolt.rb
@@ -282,21 +280,19 @@ files:
282
280
  - lib/neo4j/core/cypher_session/transactions/bolt.rb
283
281
  - lib/neo4j/core/cypher_session/transactions/embedded.rb
284
282
  - lib/neo4j/core/cypher_session/transactions/http.rb
283
+ - lib/neo4j/core/helpers.rb
285
284
  - lib/neo4j/core/instrumentable.rb
286
285
  - lib/neo4j/core/label.rb
286
+ - lib/neo4j/core/logging.rb
287
287
  - lib/neo4j/core/node.rb
288
288
  - lib/neo4j/core/path.rb
289
+ - lib/neo4j/core/query.rb
290
+ - lib/neo4j/core/query_clauses.rb
291
+ - lib/neo4j/core/query_find_in_batches.rb
289
292
  - lib/neo4j/core/rake_tasks_deprecation.rake
290
293
  - lib/neo4j/core/relationship.rb
294
+ - lib/neo4j/core/version.rb
291
295
  - lib/neo4j/core/wrappable.rb
292
- - lib/neo4j/entity_equality.rb
293
- - lib/neo4j/entity_marshal.rb
294
- - lib/neo4j/label.rb
295
- - lib/neo4j/node.rb
296
- - lib/neo4j/property_container.rb
297
- - lib/neo4j/property_validator.rb
298
- - lib/neo4j/relationship.rb
299
- - lib/neo4j/session.rb
300
296
  - lib/neo4j/transaction.rb
301
297
  - neo4j-core.gemspec
302
298
  homepage: https://github.com/neo4jrb/neo4j-core
@@ -322,15 +318,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
322
318
  requirements:
323
319
  - - ">="
324
320
  - !ruby/object:Gem::Version
325
- version: 1.9.3
321
+ version: 2.1.0
326
322
  required_rubygems_version: !ruby/object:Gem::Requirement
327
323
  requirements:
328
- - - ">="
324
+ - - ">"
329
325
  - !ruby/object:Gem::Version
330
- version: '0'
326
+ version: 1.3.1
331
327
  requirements: []
332
328
  rubyforge_project:
333
- rubygems_version: 2.6.13
329
+ rubygems_version: 2.7.7
334
330
  signing_key:
335
331
  specification_version: 4
336
332
  summary: A basic library to work with the graph database Neo4j.
@@ -1,9 +0,0 @@
1
- module Kernel
2
- def ergo(&b)
3
- if block_given?
4
- b.arity == 1 ? yield(self) : instance_eval(&b)
5
- else
6
- self
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- module Neo4j
2
- module Core
3
- # A module to make Neo4j::Node and Neo4j::Relationship work better together with neo4j.rb's Neo4j::ActiveNode and Neo4j::ActiveRel
4
- module ActiveEntity
5
- # @return true
6
- def persisted?
7
- true
8
- end
9
- end
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- module Neo4j
2
- module Core
3
- class Label
4
- def labels
5
- get_labels.map { |x| Label.new(x.name) }
6
- end
7
- end
8
- end
9
- end
@@ -1,16 +0,0 @@
1
- require 'java'
2
-
3
- require 'neo4j-community'
4
- require 'neo4j-embedded/to_java'
5
- require 'neo4j-embedded/property'
6
- require 'neo4j-embedded/embedded_session'
7
- require 'neo4j-embedded/embedded_label'
8
- require 'neo4j-embedded/embedded_node'
9
- require 'neo4j-embedded/embedded_relationship'
10
- require 'neo4j-embedded/embedded_label'
11
- require 'neo4j-embedded/label'
12
- require 'neo4j-embedded/embedded_transaction'
13
- require 'neo4j-embedded/cypher_response'
14
-
15
- # TODO: replace this with https://github.com/intridea/hashie gem
16
- require 'active_support/hash_with_indifferent_access'
@@ -1,71 +0,0 @@
1
- module Neo4j
2
- module Embedded
3
- # Wraps the Cypher query result.
4
- # Loads the node and relationships wrapper if possible and use symbol as column keys.
5
- # This is typically used in the native neo4j bindings since result does is not a Ruby enumerable with symbols as keys.
6
- # @note The result is a once forward read only Enumerable, work if you need to read the result twice - use #to_a
7
- #
8
- class ResultWrapper
9
- class ResultsAlreadyConsumedException < Exception
10
- end
11
-
12
- include Enumerable
13
-
14
- # @return the original result from the Neo4j Cypher Engine, once forward read only !
15
- attr_reader :source, :unwrapped
16
-
17
- def initialize(source, query, unwrapped = nil)
18
- @source = source
19
- @struct = Struct.new(*source.columns.to_a.map!(&:to_sym)) unless source.columns.empty?
20
- @unread = true
21
- @query = query
22
- @unwrapped = unwrapped
23
- end
24
-
25
- def to_s
26
- @query
27
- end
28
-
29
- def unwrapped?
30
- !!unwrapped
31
- end
32
-
33
- def inspect
34
- "Enumerable query: '#{@query}'"
35
- end
36
-
37
- # @return [Array<Symbol>] the columns in the query result
38
- def columns
39
- @source.columns.map!(&:to_sym)
40
- end
41
-
42
- def error?
43
- false
44
- end
45
-
46
- def each
47
- fail ResultsAlreadyConsumedException unless @unread
48
-
49
- if block_given?
50
- @source.each do |row|
51
- yield(row.each_with_object(@struct.new) do |(column, value), result|
52
- result[column.to_sym] = unwrap(value)
53
- end)
54
- end
55
- else
56
- Enumerator.new(self)
57
- end
58
- end
59
-
60
- private
61
-
62
- def unwrap(value)
63
- if !value.nil? && value.respond_to?(:to_a)
64
- value.respond_to?(:to_hash) ? value.to_hash : value.map { |v| unwrap(v) }
65
- else
66
- (!value.respond_to?(:wrapper) || unwrapped?) ? value : value.wrapper
67
- end
68
- end
69
- end
70
- end
71
- end
@@ -1,26 +0,0 @@
1
- module Neo4j
2
- module Embedded
3
- class EmbeddedDatabase
4
- class Error < StandardError
5
- end
6
-
7
- class << self
8
- def connect(db_location, config = {})
9
- return Neo4j::Session.current if Neo4j::Session.current.respond_to?(:db_location) && Neo4j::Session.current.db_location == db_location
10
-
11
- EmbeddedSession.new(db_location, config)
12
- end
13
-
14
- def create_db(db_location)
15
- puts "Start embedded Neo4j db at #{db_location}"
16
- factory = Java::OrgNeo4jGraphdbFactory::GraphDatabaseFactory.new
17
- factory.newEmbeddedDatabase(db_location)
18
- end
19
-
20
- def factory_class
21
- Java::OrgNeo4jTest::ImpermanentGraphDatabase
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,30 +0,0 @@
1
- require 'neo4j-enterprise'
2
-
3
- Neo4j::Session.register_db(:ha_db) do |*args|
4
- Neo4j::Embedded::EmbeddedHaSession.new(*args)
5
- end
6
-
7
- module Neo4j
8
- module Embedded
9
- class EmbeddedHaSession < EmbeddedSession
10
- def start
11
- fail Error, 'Embedded HA Neo4j db is already running' if running?
12
- puts "Start embedded HA Neo4j db at #{db_location}"
13
- factory = Java::OrgNeo4jGraphdbFactory::HighlyAvailableGraphDatabaseFactory.new
14
- db_service = factory.newHighlyAvailableDatabaseBuilder(db_location)
15
-
16
- case
17
- when properties_file
18
- db_service.loadPropertiesFromFile(properties_file)
19
- when properties_map
20
- db_service.setConfig(properties_map)
21
- else
22
- fail Error, 'Need properties for HA configuration'
23
- end
24
-
25
- @graph_db = db_service.newGraphDatabase
26
- Neo4j::Session._notify_listeners(:session_available, self)
27
- end
28
- end
29
- end
30
- end
@@ -1,17 +0,0 @@
1
- Neo4j::Community.load_test_jars!
2
-
3
- Neo4j::Session.register_db(:impermanent_db) do |*args|
4
- Neo4j::Embedded::EmbeddedImpermanentSession.new(*args)
5
- end
6
-
7
- module Neo4j
8
- module Embedded
9
- class EmbeddedImpermanentSession < EmbeddedSession
10
- def start
11
- fail Error, 'Embedded Neo4j db is already running' if running?
12
- @graph_db = Java::OrgNeo4jTest::TestGraphDatabaseFactory.new.newImpermanentDatabase
13
- Neo4j::Session._notify_listeners(:session_available, self)
14
- end
15
- end
16
- end
17
- end
@@ -1,88 +0,0 @@
1
- module Neo4j
2
- module Embedded
3
- class EmbeddedLabel < Neo4j::Label
4
- extend Neo4j::Core::TxMethods
5
- attr_reader :name
6
- JAVA_CLASS = Java::OrgNeo4jGraphdb::DynamicLabel
7
-
8
- def initialize(session, name)
9
- @name = name.to_sym
10
- @session = session
11
- end
12
-
13
- def to_s
14
- @name
15
- end
16
-
17
- def find_nodes(key = nil, value = nil)
18
- iterator = if key
19
- @session.graph_db.find_nodes_by_label_and_property(as_java, key, value).iterator
20
- else
21
- ggo = Java::OrgNeo4jTooling::GlobalGraphOperations.at(@session.graph_db)
22
- ggo.getAllNodesWithLabel(as_java).iterator
23
- end
24
-
25
- iterator.to_a.map(&:wrapper)
26
- ensure
27
- iterator && iterator.close
28
- end
29
- tx_methods :find_nodes
30
-
31
- def as_java
32
- self.class.as_java(@name.to_s)
33
- end
34
-
35
- def create_index(property, options = {}, session = Neo4j::Session.current)
36
- validate_index_options!(options)
37
- index_creator = session.graph_db.schema.index_for(as_java)
38
- # we can also use the PropertyConstraintCreator here
39
- properties = property.is_a?(Array) ? property : [property]
40
- properties.inject(index_creator) { |creator, key| creator.on(key.to_s) }.create
41
- end
42
- tx_methods :create_index
43
-
44
- def indexes
45
- {
46
- property_keys: @session.graph_db.schema.indexes(as_java).map do |index_def|
47
- index_def.property_keys.map(&:to_sym)
48
- end
49
- }
50
- end
51
- tx_methods :indexes
52
-
53
- def uniqueness_constraints
54
- definitions = @session.graph_db.schema.constraints(as_java).select do |index_def|
55
- index_def.is_a?(Java::OrgNeo4jKernelImplCoreapiSchema::PropertyUniqueConstraintDefinition)
56
- end
57
- {
58
- property_keys: definitions.map { |index_def| index_def.property_keys.map(&:to_sym) }
59
- }
60
- end
61
- tx_methods :uniqueness_constraints
62
-
63
-
64
- def drop_index(property, options = {}, session = Neo4j::Session.current)
65
- validate_index_options!(options)
66
- properties = property.is_a?(Array) ? property : [property]
67
- session.graph_db.schema.indexes(as_java).each do |index_def|
68
- # at least one match, TODO
69
- keys = index_def.property_keys.map(&:to_sym)
70
- index_def.drop if (properties - keys).count < properties.count
71
- end
72
- end
73
- tx_methods :drop_index
74
-
75
- class << self
76
- def as_java(labels)
77
- if labels.is_a?(Array)
78
- return nil if labels.empty?
79
-
80
- labels.inject([]) { |result, label| result << JAVA_CLASS.label(label.to_s) }.to_java(JAVA_CLASS)
81
- else
82
- JAVA_CLASS.label(labels.to_s)
83
- end
84
- end
85
- end
86
- end
87
- end
88
- end