neo4j 1.1.0.beta.3-java → 1.1.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +24 -1
- data/lib/neo4j/database.rb +18 -3
- data/lib/neo4j/neo4j.rb +16 -6
- data/lib/neo4j/relationship.rb +1 -0
- data/lib/neo4j/relationship_mixin/relationship_mixin.rb +2 -2
- data/lib/neo4j/version.rb +1 -1
- metadata +5 -5
data/CHANGELOG
CHANGED
@@ -1,4 +1,27 @@
|
|
1
|
-
==
|
1
|
+
== 1.1.0 / 2011-05-13
|
2
|
+
* Support for embedding neo4j.rb by providing an already running db instance (#168)
|
3
|
+
* Neo4j::Rails::Relationships should be ActiveModel compliant (#156)
|
4
|
+
* Support for incoming relationships in Neo4j::Rails::Model (#157)
|
5
|
+
* to_json method for models no tags √ resolved (#154)
|
6
|
+
* Implement hash so that it will work with Sets (#160)
|
7
|
+
* Modified the traverser to allow iterating over paths not just over end_nodes (#161)
|
8
|
+
* Create method should take a block to initialize itself (#162)
|
9
|
+
* Upgrade to 1.3 neo4j java library (#164)
|
10
|
+
* Default `nodes' invocation for Algo path finders (#165)
|
11
|
+
* Property and index class methods modified to take arbitrary number of symbols optionally followed by options hash (#166)
|
12
|
+
* BUG: Setting property :system on Neo4j::Rails::Model should work (#163)
|
13
|
+
* BUG: update_attributes should convert values according to Type (#155)
|
14
|
+
* BUG: Neo4j::RelationshipMixin#relationship_type broken #(169)
|
15
|
+
* BUG: Relationship.load(nil) == Relationship.load(0) (#167)
|
16
|
+
* BUG: Full text search returns nil in rails model (#153)
|
17
|
+
|
18
|
+
== 1.0.0 / 2011-03-02
|
19
|
+
* Complete rewrite of everything.
|
20
|
+
* Replaced the lucene module with using the java neo4j-lucene integration instead
|
21
|
+
* Lots of improvements of the API
|
22
|
+
* Better ActiveModel/Rails integration
|
23
|
+
|
24
|
+
== 0.4.4 / 2010-08-01
|
2
25
|
* Fixed bug on traversing when using the RelationshipMixin (#121)
|
3
26
|
* BatchInserter and JRuby 1.6 - Fix iteration error with trying to modify in-place hash
|
4
27
|
|
data/lib/neo4j/database.rb
CHANGED
@@ -64,13 +64,28 @@ module Neo4j
|
|
64
64
|
def start_ha_graph_db
|
65
65
|
Neo4j.logger.info "starting Neo4j in HA mode, machine id: #{Neo4j.config['ha.machine_id']} at #{Neo4j.config['ha.server']} db #{@storage_path}"
|
66
66
|
Neo4j.load_ha_jars # those jars are only needed for the HighlyAvailableGraphDatabase
|
67
|
-
Neo4j.load_online_backup if Neo4j.config[:online_backup_enabled]
|
67
|
+
Neo4j.load_online_backup if Neo4j.config[:online_backup_enabled]
|
68
68
|
@graph = org.neo4j.kernel.HighlyAvailableGraphDatabase.new(@storage_path, Neo4j.config.to_java_map)
|
69
69
|
@graph.register_transaction_event_handler(@event_handler)
|
70
70
|
@lucene = @graph.index #org.neo4j.index.impl.lucene.LuceneIndexProvider.new
|
71
71
|
@event_handler.neo4j_started(self)
|
72
72
|
end
|
73
73
|
|
74
|
+
def start_external_db(external_graph_db)
|
75
|
+
begin
|
76
|
+
@running = true
|
77
|
+
@graph = external_graph_db
|
78
|
+
Neo4j.migrate!
|
79
|
+
@graph.register_transaction_event_handler(@event_handler)
|
80
|
+
@lucene = @graph.index #org.neo4j.index.impl.lucene.LuceneIndexProvider.new
|
81
|
+
@event_handler.neo4j_started(self)
|
82
|
+
Neo4j.logger.info("Started with external db")
|
83
|
+
rescue
|
84
|
+
@running = false
|
85
|
+
raise
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
74
89
|
def running? #:nodoc:
|
75
90
|
@running
|
76
91
|
end
|
@@ -100,8 +115,8 @@ module Neo4j
|
|
100
115
|
@graph.unregister_transaction_event_handler(@event_handler) unless read_only?
|
101
116
|
@event_handler.neo4j_shutdown(self)
|
102
117
|
@graph.shutdown
|
103
|
-
@graph
|
104
|
-
@lucene
|
118
|
+
@graph = nil
|
119
|
+
@lucene = nil
|
105
120
|
@running = false
|
106
121
|
@neo4j_manager = nil
|
107
122
|
end
|
data/lib/neo4j/neo4j.rb
CHANGED
@@ -16,13 +16,22 @@ module Neo4j
|
|
16
16
|
class << self
|
17
17
|
# Start Neo4j using the default database.
|
18
18
|
# This is usally not required since the database will be started automatically when it is used.
|
19
|
+
# If the global variable $NEO4J_SERVER is defined then it will use that as the Java Graph DB. This can
|
20
|
+
# be used if you want to embed neo4j.rb and already got an instance of the Java Neo4j Database service.
|
19
21
|
#
|
20
22
|
# ==== Parameters
|
21
23
|
# 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.
|
22
|
-
#
|
23
|
-
def start(config_file=nil)
|
24
|
+
# external_db :: (optionally) use this Java Neo4j instead of creating a new neo4j database service
|
25
|
+
def start(config_file=nil, external_db = $NEO4J_SERVER)
|
26
|
+
return if @db && @db.running?
|
27
|
+
|
24
28
|
Neo4j.config.default_file = config_file if config_file
|
25
|
-
|
29
|
+
if external_db
|
30
|
+
@db ||= Database.new
|
31
|
+
self.db.start_external_db(external_db)
|
32
|
+
else
|
33
|
+
db.start
|
34
|
+
end
|
26
35
|
end
|
27
36
|
|
28
37
|
|
@@ -41,10 +50,11 @@ module Neo4j
|
|
41
50
|
def read_only?
|
42
51
|
@db && @db.graph && @db.graph.read_only?
|
43
52
|
end
|
44
|
-
|
53
|
+
|
45
54
|
# Returns a started db instance. Starts it's not running.
|
55
|
+
# if $NEO4J_SERVER is defined then use that Java Neo4j Database service instead of creating a new one.
|
46
56
|
def started_db
|
47
|
-
|
57
|
+
start unless db.running?
|
48
58
|
db
|
49
59
|
end
|
50
60
|
|
@@ -166,6 +176,6 @@ module Neo4j
|
|
166
176
|
def event_handler(this_db = db)
|
167
177
|
this_db.event_handler
|
168
178
|
end
|
169
|
-
|
179
|
+
|
170
180
|
end
|
171
181
|
end
|
data/lib/neo4j/relationship.rb
CHANGED
@@ -165,6 +165,7 @@ module Neo4j
|
|
165
165
|
# Same as load but does not return the node as a wrapped Ruby object.
|
166
166
|
#
|
167
167
|
def _load(rel_id, db = Neo4j.started_db)
|
168
|
+
return nil if rel_id.nil?
|
168
169
|
rel = db.graph.get_relationship_by_id(rel_id.to_i)
|
169
170
|
rel.hasProperty('_classname') # since we want a IllegalStateException which is otherwise not triggered
|
170
171
|
rel
|
@@ -108,7 +108,7 @@ module Neo4j
|
|
108
108
|
# the relationship type (of type Symbol)
|
109
109
|
#
|
110
110
|
def relationship_type
|
111
|
-
|
111
|
+
@_java_rel.getType.name.to_sym
|
112
112
|
end
|
113
113
|
|
114
114
|
# --------------------------------------------------------------------------
|
@@ -139,4 +139,4 @@ module Neo4j
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
142
|
-
end
|
142
|
+
end
|
data/lib/neo4j/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 1.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.1.0
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Andreas Ronge
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-13 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -211,9 +211,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
211
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
212
|
none: false
|
213
213
|
requirements:
|
214
|
-
- - "
|
214
|
+
- - ">="
|
215
215
|
- !ruby/object:Gem::Version
|
216
|
-
version:
|
216
|
+
version: "0"
|
217
217
|
requirements: []
|
218
218
|
|
219
219
|
rubyforge_project: neo4j
|