neo4j-core 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -12
- data/README.md +7 -7
- data/lib/neo4j-core.rb +3 -2
- data/lib/neo4j-core/active_entity.rb +8 -10
- data/lib/neo4j-core/cypher_translator.rb +61 -59
- data/lib/neo4j-core/hash_with_indifferent_access.rb +31 -22
- data/lib/neo4j-core/helpers.rb +15 -17
- data/lib/neo4j-core/label.rb +7 -6
- data/lib/neo4j-core/query.rb +271 -268
- data/lib/neo4j-core/query_clauses.rb +371 -355
- data/lib/neo4j-core/query_find_in_batches.rb +26 -26
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-embedded.rb +2 -2
- data/lib/neo4j-embedded/cypher_response.rb +40 -41
- data/lib/neo4j-embedded/embedded_database.rb +21 -22
- data/lib/neo4j-embedded/embedded_ha_session.rb +13 -11
- data/lib/neo4j-embedded/embedded_impermanent_session.rb +9 -8
- data/lib/neo4j-embedded/embedded_label.rb +64 -70
- data/lib/neo4j-embedded/embedded_node.rb +68 -73
- data/lib/neo4j-embedded/embedded_relationship.rb +6 -13
- data/lib/neo4j-embedded/embedded_session.rb +128 -132
- data/lib/neo4j-embedded/embedded_transaction.rb +34 -33
- data/lib/neo4j-embedded/property.rb +84 -77
- data/lib/neo4j-embedded/to_java.rb +24 -23
- data/lib/neo4j-server.rb +1 -1
- data/lib/neo4j-server/cypher_authentication.rb +105 -103
- data/lib/neo4j-server/cypher_label.rb +25 -23
- data/lib/neo4j-server/cypher_node.rb +180 -177
- data/lib/neo4j-server/cypher_node_uncommited.rb +11 -9
- data/lib/neo4j-server/cypher_relationship.rb +101 -102
- data/lib/neo4j-server/cypher_response.rb +171 -170
- data/lib/neo4j-server/cypher_session.rb +209 -205
- data/lib/neo4j-server/cypher_transaction.rb +66 -48
- data/lib/neo4j-server/resource.rb +17 -22
- data/lib/neo4j/entity_equality.rb +3 -4
- data/lib/neo4j/label.rb +13 -16
- data/lib/neo4j/node.rb +30 -34
- data/lib/neo4j/property_container.rb +3 -3
- data/lib/neo4j/property_validator.rb +4 -5
- data/lib/neo4j/relationship.rb +17 -22
- data/lib/neo4j/session.rb +19 -21
- data/lib/neo4j/tasks/config_server.rb +2 -3
- data/lib/neo4j/tasks/neo4j_server.rake +82 -74
- data/lib/neo4j/transaction.rb +23 -22
- data/neo4j-core.gemspec +21 -16
- metadata +72 -2
data/lib/neo4j/transaction.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Neo4j
|
2
2
|
module Transaction
|
3
|
-
|
4
3
|
extend self
|
5
4
|
|
6
5
|
module Instance
|
@@ -10,16 +9,26 @@ module Neo4j
|
|
10
9
|
Neo4j::Transaction.register(self)
|
11
10
|
end
|
12
11
|
|
13
|
-
# Marks this transaction as failed, which means that it will unconditionally be rolled back when close() is called.
|
14
|
-
def
|
12
|
+
# Marks this transaction as failed, which means that it will unconditionally be rolled back when close() is called. Aliased for legacy purposes.
|
13
|
+
def mark_failed
|
15
14
|
@failure = true
|
16
15
|
end
|
17
|
-
alias_method :
|
16
|
+
alias_method :failure, :mark_failed
|
18
17
|
|
19
|
-
# If it has been marked as failed
|
20
|
-
def
|
18
|
+
# If it has been marked as failed. Aliased for legacy purposes.
|
19
|
+
def failed?
|
21
20
|
!!@failure
|
22
21
|
end
|
22
|
+
alias_method :failure?, :failed?
|
23
|
+
|
24
|
+
def mark_expired
|
25
|
+
@expired = true
|
26
|
+
end
|
27
|
+
alias_method :expired, :mark_expired
|
28
|
+
|
29
|
+
def expired?
|
30
|
+
!!@expired
|
31
|
+
end
|
23
32
|
|
24
33
|
# @private
|
25
34
|
def push_nested!
|
@@ -51,19 +60,12 @@ module Neo4j
|
|
51
60
|
def close
|
52
61
|
pop_nested!
|
53
62
|
return if @pushed_nested >= 0
|
54
|
-
|
63
|
+
fail "Can't commit transaction, already committed" if @pushed_nested < -1
|
55
64
|
Neo4j::Transaction.unregister(self)
|
56
|
-
|
57
|
-
_delete_tx
|
58
|
-
else
|
59
|
-
_commit_tx
|
60
|
-
end
|
65
|
+
failed? ? _delete_tx : _commit_tx
|
61
66
|
end
|
62
|
-
|
63
67
|
end
|
64
68
|
|
65
|
-
|
66
|
-
|
67
69
|
# @return [Neo4j::Transaction::Instance]
|
68
70
|
def new(current = Session.current!)
|
69
71
|
current.begin_tx
|
@@ -72,20 +74,20 @@ module Neo4j
|
|
72
74
|
# Runs the given block in a new transaction.
|
73
75
|
# @param [Boolean] run_in_tx if true a new transaction will not be created, instead if will simply yield to the given block
|
74
76
|
# @@yield [Neo4j::Transaction::Instance]
|
75
|
-
def run(run_in_tx=true)
|
76
|
-
|
77
|
+
def run(run_in_tx = true)
|
78
|
+
fail ArgumentError, 'Expected a block to run in Transaction.run' unless block_given?
|
77
79
|
|
78
80
|
return yield(nil) unless run_in_tx
|
79
81
|
|
80
82
|
begin
|
81
83
|
tx = Neo4j::Transaction.new
|
82
84
|
ret = yield tx
|
83
|
-
rescue Exception => e
|
84
|
-
if e.respond_to?(:cause) && e.cause
|
85
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
86
|
+
if e.respond_to?(:cause) && e.cause.respond_to?(:print_stack_trace)
|
85
87
|
puts "Java Exception in a transaction, cause: #{e.cause}"
|
86
88
|
e.cause.print_stack_trace
|
87
89
|
end
|
88
|
-
tx.
|
90
|
+
tx.mark_failed unless tx.nil?
|
89
91
|
raise
|
90
92
|
ensure
|
91
93
|
tx.close unless tx.nil?
|
@@ -106,7 +108,7 @@ module Neo4j
|
|
106
108
|
# @private
|
107
109
|
def register(tx)
|
108
110
|
# we don't support running more then one transaction per thread
|
109
|
-
|
111
|
+
fail 'Already running a transaction' if current
|
110
112
|
Thread.current[:neo4j_curr_tx] = tx
|
111
113
|
end
|
112
114
|
|
@@ -114,6 +116,5 @@ module Neo4j
|
|
114
116
|
def unregister_current
|
115
117
|
Thread.current[:neo4j_curr_tx] = nil
|
116
118
|
end
|
117
|
-
|
118
119
|
end
|
119
120
|
end
|
data/neo4j-core.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
lib = File.expand_path('../lib/', __FILE__)
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
4
|
require 'neo4j-core/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
7
|
+
s.name = 'neo4j-core'
|
8
8
|
s.version = Neo4j::Core::VERSION
|
9
|
-
s.required_ruby_version =
|
9
|
+
s.required_ruby_version = '>= 1.9.3'
|
10
10
|
|
11
|
-
s.authors =
|
11
|
+
s.authors = 'Andreas Ronge, Chris Grigg, Brian Underwood'
|
12
12
|
s.email = 'andreas.ronge@gmail.com, chris@subvertallmedia.com, brian@brian-underwood.codes'
|
13
|
-
s.homepage =
|
14
|
-
s.summary =
|
13
|
+
s.homepage = 'https://github.com/neo4jrb/neo4j-core'
|
14
|
+
s.summary = 'A basic library to work with the graph database Neo4j.'
|
15
15
|
s.license = 'MIT'
|
16
16
|
|
17
17
|
s.description = <<-EOF
|
@@ -19,24 +19,29 @@ Neo4j-core provides classes and methods to work with the graph database Neo4j.
|
|
19
19
|
EOF
|
20
20
|
|
21
21
|
s.require_path = 'lib'
|
22
|
-
s.files = Dir.glob(
|
22
|
+
s.files = Dir.glob('{bin,lib,config}/**/*') + %w(README.md Gemfile neo4j-core.gemspec)
|
23
23
|
s.has_rdoc = true
|
24
24
|
s.extra_rdoc_files = %w( README.md )
|
25
|
-
s.rdoc_options = [
|
25
|
+
s.rdoc_options = ['--quiet', '--title', 'Neo4j::Core', '--line-numbers', '--main', 'README.rdoc', '--inline-source']
|
26
26
|
|
27
|
-
|
28
|
-
s.add_dependency(
|
29
|
-
s.add_dependency("faraday", '~> 0.9.0')
|
27
|
+
s.add_dependency('httparty')
|
28
|
+
s.add_dependency('faraday', '~> 0.9.0')
|
30
29
|
s.add_dependency('net-http-persistent')
|
31
30
|
s.add_dependency('httpclient')
|
32
31
|
s.add_dependency('faraday_middleware', '~> 0.9.1')
|
33
|
-
s.add_dependency(
|
34
|
-
s.add_dependency(
|
35
|
-
s.add_dependency(
|
36
|
-
s.add_dependency(
|
32
|
+
s.add_dependency('json')
|
33
|
+
s.add_dependency('os') # for Rake task
|
34
|
+
s.add_dependency('zip') # for Rake task
|
35
|
+
s.add_dependency('activesupport') # For ActiveSupport::Notifications
|
36
|
+
|
37
|
+
s.add_development_dependency('pry')
|
38
|
+
s.add_development_dependency('yard')
|
39
|
+
s.add_development_dependency('simplecov')
|
40
|
+
s.add_development_dependency('guard')
|
41
|
+
s.add_development_dependency('guard-rubocop')
|
37
42
|
|
38
43
|
if RUBY_PLATFORM == 'java'
|
39
|
-
s.add_dependency(
|
44
|
+
s.add_dependency('neo4j-community', '~> 2.1.1')
|
40
45
|
s.add_development_dependency 'ruby-debug'
|
41
46
|
end
|
42
47
|
end
|
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:
|
4
|
+
version: 4.0.0
|
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:
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -136,6 +136,76 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
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'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: yard
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: simplecov
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: guard
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: guard-rubocop
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
139
209
|
description: |
|
140
210
|
Neo4j-core provides classes and methods to work with the graph database Neo4j.
|
141
211
|
email: andreas.ronge@gmail.com, chris@subvertallmedia.com, brian@brian-underwood.codes
|