neo4j-core 2.2.3-java → 2.2.4-java
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -3
- data/config/neo4j/config.yml +3 -1
- data/lib/neo4j-core/database.rb +25 -21
- data/lib/neo4j-core/event_handler.rb +1 -1
- data/lib/neo4j-core/index/lucene_query.rb +2 -2
- data/lib/neo4j-core/property/property.rb +2 -2
- data/lib/neo4j-core/relationship/relationship.rb +6 -0
- data/lib/neo4j-core/rels/traverser.rb +1 -1
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j/neo4j.rb +9 -9
- metadata +9 -12
data/Gemfile
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
|
-
|
5
|
-
gem 'neo4j-advanced', '>= 1.8.1', '< 2.0', :require => false
|
4
|
+
gem 'neo4j-advanced', '>= 1.8.1', '< 2.0', :require => false
|
6
5
|
gem 'neo4j-enterprise', '>= 1.8.1', '< 2.0', :require => false
|
7
6
|
|
8
7
|
group 'development' do
|
data/config/neo4j/config.yml
CHANGED
@@ -30,7 +30,9 @@ migration_thread: false
|
|
30
30
|
|
31
31
|
# If online backup should be available, if it is the Online JAR file will be loaded,
|
32
32
|
# Notice it must be either 'true' or 'false' as string
|
33
|
-
|
33
|
+
# To set a different port than the default port of 9999 use online_backup_port
|
34
|
+
online_backup_enabled: 'false'
|
35
|
+
#online_backup_port: '9999'
|
34
36
|
|
35
37
|
#use the clustered Neo4j GraphDatabase (org.neo4j.kernel.ha.HighlyAvailableGraphDatabase)
|
36
38
|
#enable_ha: true
|
data/lib/neo4j-core/database.rb
CHANGED
@@ -46,31 +46,32 @@ module Neo4j
|
|
46
46
|
!!Neo4j::Config[:enable_ha]
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
SEMAPHORE = Mutex.new
|
50
50
|
# Private start method, use Neo4j.start instead
|
51
51
|
# @see Neo4j#start
|
52
52
|
def start
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
53
|
+
SEMAPHORE.synchronize do
|
54
|
+
return if running?
|
55
|
+
@storage_path = Config.storage_path
|
56
|
+
Java::JavaLang::System.setProperty("neo4j.ext.udc.source", "neo4rb")
|
57
|
+
|
58
|
+
begin
|
59
|
+
if self.class.locked?
|
60
|
+
start_readonly_graph_db
|
61
|
+
elsif self.class.ha_enabled?
|
62
|
+
start_ha_graph_db
|
63
|
+
Neo4j.migrate! if Neo4j.respond_to?(:migrate!)
|
64
|
+
else
|
65
|
+
start_local_graph_db
|
66
|
+
Neo4j.migrate! if Neo4j.respond_to?(:migrate!)
|
67
|
+
end
|
68
|
+
rescue
|
69
|
+
@running = false
|
70
|
+
raise
|
67
71
|
end
|
68
|
-
rescue
|
69
|
-
@running = false
|
70
|
-
raise
|
71
|
-
end
|
72
72
|
|
73
|
-
|
73
|
+
at_exit { shutdown }
|
74
|
+
end
|
74
75
|
end
|
75
76
|
|
76
77
|
|
@@ -149,10 +150,10 @@ module Neo4j
|
|
149
150
|
# @private
|
150
151
|
def start_external_db(external_graph_db)
|
151
152
|
begin
|
152
|
-
@running = true
|
153
153
|
@graph = external_graph_db
|
154
154
|
@graph.register_transaction_event_handler(@event_handler)
|
155
155
|
@lucene = @graph.index
|
156
|
+
@running = true
|
156
157
|
@event_handler.neo4j_started(self)
|
157
158
|
Neo4j.logger.info("Started with external db")
|
158
159
|
rescue
|
@@ -167,6 +168,7 @@ module Neo4j
|
|
167
168
|
Neo4j.logger.info "Starting Neo4j in readonly mode since the #{@storage_path} is locked"
|
168
169
|
@graph = Java::OrgNeo4jKernel::EmbeddedReadOnlyGraphDatabase.new(@storage_path, Config.to_java_map)
|
169
170
|
@lucene = @graph.index
|
171
|
+
@running = true
|
170
172
|
end
|
171
173
|
|
172
174
|
def start_local_graph_db
|
@@ -174,6 +176,7 @@ module Neo4j
|
|
174
176
|
@graph = self.class.default_embedded_db.new(@storage_path, Config.to_java_map)
|
175
177
|
@graph.register_transaction_event_handler(@event_handler)
|
176
178
|
@lucene = @graph.index
|
179
|
+
@running = true
|
177
180
|
@event_handler.neo4j_started(self)
|
178
181
|
end
|
179
182
|
|
@@ -189,6 +192,7 @@ module Neo4j
|
|
189
192
|
#@graph = Java::OrgNeo4jKernelHa::HighlyAvailableGraphDatabase.new(@storage_path, Neo4j.config.to_java_map)
|
190
193
|
@graph.register_transaction_event_handler(@event_handler)
|
191
194
|
@lucene = @graph.index
|
195
|
+
@running = true
|
192
196
|
@event_handler.neo4j_started(self)
|
193
197
|
end
|
194
198
|
|
@@ -121,7 +121,7 @@ module Neo4j
|
|
121
121
|
classes_changed(class_change_map)
|
122
122
|
rescue Exception => e
|
123
123
|
# since these exceptions gets swallowed
|
124
|
-
puts "ERROR in before commit hook #{e}"
|
124
|
+
puts "ERROR in before commit hook: #{e.class} - #{e}"
|
125
125
|
puts e.backtrace.join("\n")
|
126
126
|
end
|
127
127
|
|
@@ -235,12 +235,12 @@ module Neo4j
|
|
235
235
|
if Array === value
|
236
236
|
value.each do |v|
|
237
237
|
term = Java::OrgApacheLuceneIndex::Term.new(key.to_s, v.to_s)
|
238
|
-
term_query = Java::OrgApacheLuceneSearch::
|
238
|
+
term_query = Java::OrgApacheLuceneSearch::WildcardQuery.new(term)
|
239
239
|
and_query.add(term_query, Java::OrgApacheLuceneSearch::BooleanClause::Occur::SHOULD)
|
240
240
|
end
|
241
241
|
else
|
242
242
|
term = Java::OrgApacheLuceneIndex::Term.new(key.to_s, value.to_s)
|
243
|
-
term_query = Java::OrgApacheLuceneSearch::
|
243
|
+
term_query = Java::OrgApacheLuceneSearch::WildcardQuery.new(term)
|
244
244
|
and_query.add(term_query, Java::OrgApacheLuceneSearch::BooleanClause::Occur::MUST)
|
245
245
|
end
|
246
246
|
end
|
@@ -88,7 +88,7 @@ module Neo4j
|
|
88
88
|
# @param [String, Symbol] key of the property to set
|
89
89
|
# @param [String,Fixnum,Float,true,false, Array] value to set
|
90
90
|
def []=(key, value)
|
91
|
-
raise "Not valid Neo4j Property value #{value.class}, valid: #{VALID_PROPERTY_VALUE_CLASSES.join(', ')}" unless valid_property?(value)
|
91
|
+
raise "Not valid Neo4j Property value #{value.class}, valid: #{VALID_PROPERTY_VALUE_CLASSES.to_a.join(', ')}" unless valid_property?(value)
|
92
92
|
|
93
93
|
k = key.to_s
|
94
94
|
if value.nil?
|
@@ -115,4 +115,4 @@ module Neo4j
|
|
115
115
|
|
116
116
|
end
|
117
117
|
end
|
118
|
-
end
|
118
|
+
end
|
@@ -13,6 +13,12 @@ module Neo4j
|
|
13
13
|
def _start_node
|
14
14
|
get_start_node
|
15
15
|
end
|
16
|
+
|
17
|
+
# Same as Java::OrgNeo4jGraphdb::Relationship#getNodes
|
18
|
+
# @see http://api.neo4j.org/1.6.1/org/neo4j/graphdb/Relationship.html#getNodes()
|
19
|
+
def _nodes
|
20
|
+
get_nodes
|
21
|
+
end
|
16
22
|
|
17
23
|
# Same as Java::OrgNeo4jGraphdb::Relationship#getOtherNode
|
18
24
|
# @see http://api.neo4j.org/1.6.1/org/neo4j/graphdb/Relationship.html#getOtherNode()
|
data/lib/neo4j-core/version.rb
CHANGED
data/lib/neo4j/neo4j.rb
CHANGED
@@ -31,15 +31,15 @@ module Neo4j
|
|
31
31
|
# @param [String] config_file (optionally) if this is nil or not given use the Neo4j::Config, otherwise setup the Neo4j::Config file using the provided YAML configuration file.
|
32
32
|
# @param [Java::OrgNeo4jKernel::EmbeddedGraphDatabase] external_db (optionally) use this Java Neo4j instead of creating a new neo4j database service.
|
33
33
|
def start(config_file=nil, external_db = $NEO4J_SERVER)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
return if @db && @db.running?
|
35
|
+
|
36
|
+
Neo4j.config.default_file = config_file if config_file
|
37
|
+
if external_db
|
38
|
+
@db ||= Neo4j::Core::Database.new
|
39
|
+
self.db.start_external_db(external_db)
|
40
|
+
else
|
41
|
+
db.start
|
42
|
+
end
|
43
43
|
end
|
44
44
|
|
45
45
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
@@ -9,27 +9,25 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-05-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: neo4j-community
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 1.8.1
|
21
|
-
- -
|
22
|
-
PA==
|
21
|
+
- - <
|
23
22
|
- !ruby/object:Gem::Version
|
24
23
|
version: '1.9'
|
25
24
|
none: false
|
26
25
|
requirement: !ruby/object:Gem::Requirement
|
27
26
|
requirements:
|
28
|
-
- -
|
27
|
+
- - '>='
|
29
28
|
- !ruby/object:Gem::Version
|
30
29
|
version: 1.8.1
|
31
|
-
- -
|
32
|
-
PA==
|
30
|
+
- - <
|
33
31
|
- !ruby/object:Gem::Version
|
34
32
|
version: '1.9'
|
35
33
|
none: false
|
@@ -122,18 +120,17 @@ require_paths:
|
|
122
120
|
- lib
|
123
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
122
|
requirements:
|
125
|
-
- -
|
123
|
+
- - '>='
|
126
124
|
- !ruby/object:Gem::Version
|
127
125
|
version: 1.8.7
|
128
126
|
none: false
|
129
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
128
|
requirements:
|
131
|
-
- -
|
129
|
+
- - '>='
|
132
130
|
- !ruby/object:Gem::Version
|
133
131
|
segments:
|
134
132
|
- 0
|
135
|
-
version:
|
136
|
-
MA==
|
133
|
+
version: '0'
|
137
134
|
hash: 2
|
138
135
|
none: false
|
139
136
|
requirements: []
|