neo4j-core 3.0.0.alpha.1 → 3.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-embedded.rb +1 -6
- data/lib/neo4j-embedded/embedded_impermanent_session.rb +17 -0
- data/lib/neo4j-embedded/embedded_node.rb +1 -4
- data/lib/neo4j-embedded/embedded_session.rb +1 -11
- data/lib/neo4j-server/cypher_session.rb +3 -4
- data/lib/neo4j-server/cypher_transaction.rb +1 -1
- data/lib/neo4j/property_validator.rb +1 -1
- data/lib/neo4j/session.rb +13 -0
- data/lib/neo4j/tasks/neo4j_server.rb +13 -10
- data/neo4j-core.gemspec +4 -2
- metadata +3 -14
- data/lib/neo4j/jars/concurrentlinkedhashmap-lru-1.3.1.jar +0 -0
- data/lib/neo4j/jars/geronimo-jta_1.1_spec-1.1.1.jar +0 -0
- data/lib/neo4j/jars/lucene-core-3.6.2.jar +0 -0
- data/lib/neo4j/jars/neo4j-cypher-2.0.0-M06.jar +0 -0
- data/lib/neo4j/jars/neo4j-kernel-2.0-SNAPSHOT-tests.jar +0 -0
- data/lib/neo4j/jars/neo4j-kernel-2.0.0-M06.jar +0 -0
- data/lib/neo4j/jars/neo4j-lucene-index-2.0.0-M06.jar +0 -0
- data/lib/neo4j/jars/neo4j-management-2.0.0-M06.jar +0 -0
- data/lib/neo4j/jars/org.apache.servicemix.bundles.jline-0.9.94_1.jar +0 -0
- data/lib/neo4j/jars/parboiled-core-1.1.6.jar +0 -0
- data/lib/neo4j/jars/parboiled-scala_2.10-1.1.6.jar +0 -0
- data/lib/neo4j/jars/scala-library-2.10.2.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d39f7102c26a7e8aff35bbb2e0bff24cc4f383a3
|
4
|
+
data.tar.gz: 04f2ad73f2fe99a55ff14f981474ec2114436d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c26991e87c194a1be4f4a49c237e2ebeaa181b571450a060c936916fc65cbc658fb451a0f58b93a918a2bd9e109ca2393d7b4ba00f2cf1bccdd83078ab081772
|
7
|
+
data.tar.gz: 8f6fcaa0a955b5c14248de1a4d4587bfe40f47d226abb22499f7d90466f5d0ce830967a0391fe3e8c0f1c51713f19827b19e2a39e539073c7ed0db945ef2d643
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ You need to install the Neo4j server. This can be done by included Rake file.
|
|
18
18
|
Example
|
19
19
|
|
20
20
|
```
|
21
|
-
rake neo4j:install[community-2.0.0
|
21
|
+
rake neo4j:install[community-2.0.0]
|
22
22
|
rake neo4j:start
|
23
23
|
```
|
24
24
|
|
@@ -158,6 +158,19 @@ Neo4j::Transaction.run do
|
|
158
158
|
end
|
159
159
|
```
|
160
160
|
|
161
|
+
Rollback occurs if an exception is thrown, or the failure method is called on the transaction.
|
162
|
+
|
163
|
+
E.g.
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
Neo4j::Transaction.run do |tx|
|
167
|
+
n = Neo4j::Node.create(name: 'kalle')
|
168
|
+
tx.failure # all operations inside this tx will be rollbacked
|
169
|
+
n[:age] = 42
|
170
|
+
end
|
171
|
+
|
172
|
+
```
|
173
|
+
|
161
174
|
### Relationship
|
162
175
|
|
163
176
|
How to create a relationship between node n1 and node n2 with one property
|
data/lib/neo4j-core/version.rb
CHANGED
data/lib/neo4j-embedded.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
require 'java'
|
2
2
|
|
3
|
-
|
4
|
-
# Load Neo4j Jars for the jars folder
|
5
|
-
jar_folder = File.expand_path('../neo4j/jars', __FILE__)
|
6
|
-
jars = Dir.new(jar_folder).entries.find_all { |x| x =~ /\.jar$/ }
|
7
|
-
jars.each { |jar| require File.expand_path(jar, jar_folder) }
|
8
|
-
|
3
|
+
require 'neo4j-community'
|
9
4
|
require 'neo4j-embedded/to_java'
|
10
5
|
require 'neo4j-embedded/property'
|
11
6
|
require 'neo4j-embedded/embedded_session'
|
@@ -0,0 +1,17 @@
|
|
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::Embedded
|
8
|
+
class EmbeddedImpermanentSession < EmbeddedSession
|
9
|
+
def start
|
10
|
+
raise Error.new("Embedded Neo4j db is already running") if running?
|
11
|
+
#puts "Start test impermanent embedded Neo4j db at #{db_location}"
|
12
|
+
@graph_db = Java::OrgNeo4jTest::TestGraphDatabaseFactory.new.newImpermanentDatabase()
|
13
|
+
Neo4j::Session._notify_listeners(:session_available, self)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -4,9 +4,6 @@ Neo4j::Session.register_db(:embedded_db) do |*args|
|
|
4
4
|
Neo4j::Embedded::EmbeddedSession.new(*args)
|
5
5
|
end
|
6
6
|
|
7
|
-
Neo4j::Session.register_db(:impermanent_db) do |*args|
|
8
|
-
Neo4j::Embedded::EmbeddedImpermanentSession.new(*args)
|
9
|
-
end
|
10
7
|
|
11
8
|
module Neo4j::Embedded
|
12
9
|
class EmbeddedSession < Neo4j::Session
|
@@ -31,6 +28,7 @@ module Neo4j::Embedded
|
|
31
28
|
puts "Start embedded Neo4j db at #{db_location}"
|
32
29
|
factory = Java::OrgNeo4jGraphdbFactory::GraphDatabaseFactory.new
|
33
30
|
@graph_db = factory.newEmbeddedDatabase(db_location)
|
31
|
+
Neo4j::Session._notify_listeners(:session_available, self)
|
34
32
|
end
|
35
33
|
|
36
34
|
def factory_class
|
@@ -138,14 +136,6 @@ module Neo4j::Embedded
|
|
138
136
|
|
139
137
|
end
|
140
138
|
|
141
|
-
class EmbeddedImpermanentSession < EmbeddedSession
|
142
|
-
def start
|
143
|
-
raise Error.new("Embedded Neo4j db is already running") if running?
|
144
|
-
#puts "Start test impermanent embedded Neo4j db at #{db_location}"
|
145
|
-
@graph_db = Java::OrgNeo4jTest::TestGraphDatabaseFactory.new.newImpermanentDatabase()
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
139
|
|
150
140
|
|
151
141
|
end
|
@@ -17,6 +17,7 @@ module Neo4j::Server
|
|
17
17
|
def initialize(data_url)
|
18
18
|
Neo4j::Session.register(self)
|
19
19
|
initialize_resource(data_url)
|
20
|
+
Neo4j::Session._notify_listeners(:session_available, self)
|
20
21
|
end
|
21
22
|
|
22
23
|
def to_s
|
@@ -38,9 +39,7 @@ module Neo4j::Server
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def begin_tx
|
41
|
-
|
42
|
-
Thread.current[:neo4j_curr_tx] = tx
|
43
|
-
tx
|
42
|
+
Thread.current[:neo4j_curr_tx] = wrap_resource(self, 'transaction', CypherTransaction, nil, :post)
|
44
43
|
end
|
45
44
|
|
46
45
|
def create_node(props=nil, labels=[])
|
@@ -82,7 +81,7 @@ module Neo4j::Server
|
|
82
81
|
data_resource = JSON.parse(response.body)
|
83
82
|
|
84
83
|
property_keys = data_resource.map do |row|
|
85
|
-
row['
|
84
|
+
row['property_keys'].map(&:to_sym)
|
86
85
|
end
|
87
86
|
|
88
87
|
{
|
@@ -48,7 +48,7 @@ module Neo4j::Server
|
|
48
48
|
cr.set_data(first_result['data'], first_result['columns'])
|
49
49
|
else
|
50
50
|
first_error = response['errors'].first
|
51
|
-
cr.set_error(first_error['message'], first_error['
|
51
|
+
cr.set_error(first_error['message'], first_error['code'], first_error['code'])
|
52
52
|
end
|
53
53
|
cr
|
54
54
|
end
|
data/lib/neo4j/session.rb
CHANGED
@@ -106,6 +106,19 @@ module Neo4j
|
|
106
106
|
@@current_session = session
|
107
107
|
end
|
108
108
|
|
109
|
+
def add_listener(&listener)
|
110
|
+
self._listeners << listener
|
111
|
+
end
|
112
|
+
|
113
|
+
def _listeners
|
114
|
+
@@listeners ||= []
|
115
|
+
@@listeners
|
116
|
+
end
|
117
|
+
|
118
|
+
def _notify_listeners(event, data)
|
119
|
+
_listeners.each {|li| li.call(event, data)}
|
120
|
+
end
|
121
|
+
|
109
122
|
def register(session)
|
110
123
|
set_current(session) unless @@current_session
|
111
124
|
@@current_session
|
@@ -4,15 +4,17 @@ require 'os'
|
|
4
4
|
namespace :neo4j do
|
5
5
|
desc "Install Neo4j"
|
6
6
|
task :install, :edition, :version do |t, args|
|
7
|
-
args.with_defaults(:edition => "community"
|
8
|
-
|
7
|
+
args.with_defaults(:edition => "community")
|
8
|
+
|
9
|
+
file = args[:version] ? "#{args[:edition]}-#{args[:version]}" : "#{args[:edition]}"
|
10
|
+
puts "Installing Neo4j-#{file}"
|
9
11
|
|
10
12
|
if OS::Underlying.windows?
|
11
|
-
# Download Neo4j
|
13
|
+
# Download Neo4j
|
12
14
|
unless File.exist?('neo4j.zip')
|
13
15
|
df = File.open('neo4j.zip', 'wb')
|
14
16
|
begin
|
15
|
-
df << HTTParty.get("http://dist.neo4j.org/neo4j-#{
|
17
|
+
df << HTTParty.get("http://dist.neo4j.org/neo4j-#{file}-windows.zip")
|
16
18
|
ensure
|
17
19
|
df.close()
|
18
20
|
end
|
@@ -31,7 +33,7 @@ namespace :neo4j do
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
34
|
-
FileUtils.mv "neo4j-#{
|
36
|
+
FileUtils.mv "neo4j-#{file}", "neo4j"
|
35
37
|
end
|
36
38
|
|
37
39
|
# Install if running with Admin Privileges
|
@@ -40,11 +42,12 @@ namespace :neo4j do
|
|
40
42
|
puts "Neo4j Installed as a service."
|
41
43
|
end
|
42
44
|
|
43
|
-
else
|
44
|
-
|
45
|
-
%x[
|
46
|
-
%x[
|
47
|
-
%x[
|
45
|
+
else
|
46
|
+
# E.g. http://dist.neo4j.org/neo4j-community-2.0.0-unix.tar.gz
|
47
|
+
%x[wget http://dist.neo4j.org/neo4j-#{file}-unix.tar.gz]
|
48
|
+
%x[tar -xvzf neo4j-#{file}-unix.tar.gz]
|
49
|
+
%x[mv neo4j-#{file} neo4j]
|
50
|
+
%x[rm neo4j-#{file}-unix.tar.gz]
|
48
51
|
puts "Neo4j Installed in to neo4j directory."
|
49
52
|
end
|
50
53
|
puts "Type 'rake neo4j:start' to start it"
|
data/neo4j-core.gemspec
CHANGED
@@ -30,6 +30,8 @@ It comes included with the Apache Lucene document database.
|
|
30
30
|
s.add_dependency("httparty")
|
31
31
|
s.add_dependency("json")
|
32
32
|
s.add_dependency("neo4j-cypher")
|
33
|
-
|
34
|
-
|
33
|
+
|
34
|
+
if RUBY_PLATFORM =~ /java/
|
35
|
+
s.add_dependency("neo4j-community", '~> 2.0.0')
|
36
|
+
end
|
35
37
|
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: 3.0.0.alpha.
|
4
|
+
version: 3.0.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -64,18 +64,6 @@ extra_rdoc_files:
|
|
64
64
|
- README.md
|
65
65
|
files:
|
66
66
|
- lib/neo4j/entity_equality.rb
|
67
|
-
- lib/neo4j/jars/concurrentlinkedhashmap-lru-1.3.1.jar
|
68
|
-
- lib/neo4j/jars/geronimo-jta_1.1_spec-1.1.1.jar
|
69
|
-
- lib/neo4j/jars/lucene-core-3.6.2.jar
|
70
|
-
- lib/neo4j/jars/neo4j-cypher-2.0.0-M06.jar
|
71
|
-
- lib/neo4j/jars/neo4j-kernel-2.0-SNAPSHOT-tests.jar
|
72
|
-
- lib/neo4j/jars/neo4j-kernel-2.0.0-M06.jar
|
73
|
-
- lib/neo4j/jars/neo4j-lucene-index-2.0.0-M06.jar
|
74
|
-
- lib/neo4j/jars/neo4j-management-2.0.0-M06.jar
|
75
|
-
- lib/neo4j/jars/org.apache.servicemix.bundles.jline-0.9.94_1.jar
|
76
|
-
- lib/neo4j/jars/parboiled-core-1.1.6.jar
|
77
|
-
- lib/neo4j/jars/parboiled-scala_2.10-1.1.6.jar
|
78
|
-
- lib/neo4j/jars/scala-library-2.10.2.jar
|
79
67
|
- lib/neo4j/label.rb
|
80
68
|
- lib/neo4j/node.rb
|
81
69
|
- lib/neo4j/property_container.rb
|
@@ -91,6 +79,7 @@ files:
|
|
91
79
|
- lib/neo4j-core/version.rb
|
92
80
|
- lib/neo4j-core.rb
|
93
81
|
- lib/neo4j-embedded/embedded_database.rb
|
82
|
+
- lib/neo4j-embedded/embedded_impermanent_session.rb
|
94
83
|
- lib/neo4j-embedded/embedded_label.rb
|
95
84
|
- lib/neo4j-embedded/embedded_node.rb
|
96
85
|
- lib/neo4j-embedded/embedded_relationship.rb
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|