neography 0.0.27 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -2
- data/README.rdoc +16 -1
- data/lib/neography/index.rb +34 -4
- data/lib/neography/node.rb +1 -1
- data/lib/neography/oj_parser.rb +2 -2
- data/lib/neography/relationship.rb +1 -1
- data/lib/neography/rest.rb +72 -6
- data/spec/integration/index_spec.rb +15 -26
- data/spec/integration/parsing_spec.rb +13 -0
- data/spec/integration/rest_batch_spec.rb +36 -8
- data/spec/integration/rest_index_spec.rb +78 -4
- metadata +22 -21
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neography (0.0.
|
4
|
+
neography (0.0.28)
|
5
5
|
httparty (>= 0.8.1)
|
6
6
|
json
|
7
7
|
oj
|
@@ -17,7 +17,6 @@ GEM
|
|
17
17
|
multi_json (~> 1.0)
|
18
18
|
multi_xml
|
19
19
|
json (1.7.3)
|
20
|
-
json (1.7.3-java)
|
21
20
|
multi_json (1.3.6)
|
22
21
|
multi_xml (0.5.1)
|
23
22
|
net-http-spy (0.2.1)
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
== Welcome to Neography
|
1
|
+
== Welcome to Neography
|
2
2
|
|
3
3
|
Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:
|
4
4
|
* {Getting Started with Neo4j Server}[http://neo4j.org/community/]
|
@@ -7,6 +7,7 @@ Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:
|
|
7
7
|
If you want to the full power of Neo4j, you will want to use JRuby and the excellent Neo4j.rb gem at https://github.com/andreasronge/neo4j by Andreas Ronge
|
8
8
|
|
9
9
|
{<img src="https://secure.travis-ci.org/maxdemarzi/neography.png?branch=master" alt="Build Status" />}[http://travis-ci.org/maxdemarzi/neography]
|
10
|
+
{<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/maxdemarzi/neography]
|
10
11
|
|
11
12
|
Complement to Neography are the:
|
12
13
|
|
@@ -144,6 +145,7 @@ To Use:
|
|
144
145
|
|
145
146
|
@neo.list_node_indexes # gives names and query templates for all defined indices
|
146
147
|
@neo.create_node_index(name, type, provider) # creates an index, defaults are "exact" and "lucene"
|
148
|
+
@neo.create_node_auto_index(type, provider) # creates an auto index, defaults are "exact" and "lucene"
|
147
149
|
@neo.add_node_to_index(index, key, value, node1) # adds a node to the index with the given key/value pair
|
148
150
|
@neo.remove_node_from_index(index, key, value, node1) # removes a node from the index with the given key/value pair
|
149
151
|
@neo.remove_node_from_index(index, key, node1) # removes a node from the index with the given key
|
@@ -155,6 +157,7 @@ To Use:
|
|
155
157
|
@neo.find_node_auto_index(query) # advanced query of the node auto index with the given query
|
156
158
|
@neo.list_relationship_indexes # gives names and query templates for relationship indices
|
157
159
|
@neo.create_relationship_index(name, "fulltext", provider) # creates a relationship index with "fulltext" option
|
160
|
+
@neo.create_relationship_auto_index("fulltext", provider) # creates a relationship auto index with "fulltext" option
|
158
161
|
@neo.add_relationship_to_index(index, key, value, rel1) # adds a relationship to the index with the given key/value pair
|
159
162
|
@neo.remove_relationship_from_index(index, key, value, rel1) # removes a relationship from the index with the given key/value pair
|
160
163
|
@neo.remove_relationship_from_index(index, key, rel1) # removes a relationship from the index with the given key
|
@@ -164,6 +167,18 @@ To Use:
|
|
164
167
|
@neo.find_relationship_index(index, query) # advanced query of the relationship index with the given query
|
165
168
|
@neo.get_relationship_auto_index(key, value) # exact query of the relationship auto index with the given key/value pair
|
166
169
|
@neo.find_relationship_auto_index(query) # advanced query of the relationship auto index with the given query
|
170
|
+
|
171
|
+
@neo.get_node_auto_index_status # true or false depending on node auto index setting
|
172
|
+
@neo.get_relationship_auto_index_status # true or false depending on relationship auto index setting
|
173
|
+
@neo.set_node_auto_index_status(true) # set the node auto index setting to true
|
174
|
+
@neo.set_relationship_auto_index_status(false) # set the relationship auto index setting to false
|
175
|
+
@neo.get_node_auto_index_properties # array of currently auto indexed node properties
|
176
|
+
@neo.get_relationship_auto_index_properties # array of currently auto indexed relationship properties
|
177
|
+
@neo.add_node_auto_index_property(property) # add to auto indexed node properties
|
178
|
+
@neo.remove_node_auto_index_property(property) # remove from auto indexed node properties
|
179
|
+
@neo.add_relationship_auto_index_property(property) # add to auto indexed relationship properties
|
180
|
+
@neo.remove_relationship_auto_index_property(property) # remove from auto indexed relationship properties
|
181
|
+
|
167
182
|
@neo.execute_script("g.v(0)") # sends a Groovy script (through the Gremlin plugin)
|
168
183
|
@neo.execute_script("g.v(id)", {:id => 3}) # sends a parameterized Groovy script (optimized for repeated calls)
|
169
184
|
@neo.execute_query("start n=node(0) return n") # sends a Cypher query (through the Cypher plugin)
|
data/lib/neography/index.rb
CHANGED
@@ -1,13 +1,43 @@
|
|
1
1
|
module Neography
|
2
2
|
module Index
|
3
3
|
|
4
|
-
def
|
5
|
-
|
4
|
+
def self.included(base)
|
5
|
+
base.extend(ClassMethods)
|
6
|
+
end
|
7
|
+
|
8
|
+
def add_to_index(index, key, value)
|
9
|
+
if self.is_a? Neography::Node
|
10
|
+
neo_server.add_node_to_index(index, key, value, self.neo_id)
|
11
|
+
else
|
12
|
+
neo_server.add_relationship_to_index(index, key, value, self.neo_id)
|
13
|
+
end
|
6
14
|
end
|
7
15
|
|
8
|
-
def
|
9
|
-
|
16
|
+
def remove_from_index(*args)
|
17
|
+
if self.is_a? Neography::Node
|
18
|
+
neo_server.remove_node_from_index(*args)
|
19
|
+
else
|
20
|
+
neo_server.remove_relationship_from_index(*args)
|
21
|
+
end
|
10
22
|
end
|
11
23
|
|
24
|
+
module ClassMethods
|
25
|
+
def find(*args)
|
26
|
+
if name == "Neography::Node"
|
27
|
+
if args.size > 1
|
28
|
+
neo_server.find_node_index(*args)
|
29
|
+
else
|
30
|
+
neo_server.get_node_index(*args)
|
31
|
+
end
|
32
|
+
else
|
33
|
+
if args.size > 1
|
34
|
+
neo_server.find_relationship_index(*args)
|
35
|
+
else
|
36
|
+
neo_server.get_relationship_index(*args)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
12
42
|
end
|
13
43
|
end
|
data/lib/neography/node.rb
CHANGED
data/lib/neography/oj_parser.rb
CHANGED
data/lib/neography/rest.rb
CHANGED
@@ -267,6 +267,10 @@ module Neography
|
|
267
267
|
post("/index/node", options)
|
268
268
|
end
|
269
269
|
|
270
|
+
def create_node_auto_index(type = "exact", provider = "lucene")
|
271
|
+
create_node_index("node_auto_index", type, provider)
|
272
|
+
end
|
273
|
+
|
270
274
|
def add_node_to_index(index, key, value, id)
|
271
275
|
options = { :body => ({:uri => self.configuration + "/node/#{get_id(id)}", :key => key, :value => value }).to_json, :headers => {'Content-Type' => 'application/json'} }
|
272
276
|
post("/index/node/#{index}", options)
|
@@ -297,8 +301,11 @@ module Neography
|
|
297
301
|
index
|
298
302
|
end
|
299
303
|
|
300
|
-
def find_node_auto_index(
|
301
|
-
|
304
|
+
def find_node_auto_index(*args)
|
305
|
+
case args.size
|
306
|
+
when 2 then index = get("/index/auto/node/#{args[0]}/#{args[1]}") || Array.new
|
307
|
+
when 1 then index = get("/index/auto/node/?query=#{args[0]}") || Array.new
|
308
|
+
end
|
302
309
|
return nil if index.empty?
|
303
310
|
index
|
304
311
|
end
|
@@ -326,6 +333,10 @@ module Neography
|
|
326
333
|
post("/index/relationship", options)
|
327
334
|
end
|
328
335
|
|
336
|
+
def create_relationship_auto_index(type = "exact", provider = "lucene")
|
337
|
+
create_relationship_index("relationship_auto_index", type, provider)
|
338
|
+
end
|
339
|
+
|
329
340
|
def add_relationship_to_index(index, key, value, id)
|
330
341
|
options = { :body => ({:uri => self.configuration + "/relationship/#{get_id(id)}", :key => key, :value => value}).to_json, :headers => {'Content-Type' => 'application/json'} }
|
331
342
|
post("/index/relationship/#{index}", options)
|
@@ -360,12 +371,59 @@ module Neography
|
|
360
371
|
index
|
361
372
|
end
|
362
373
|
|
363
|
-
def find_relationship_auto_index(
|
364
|
-
|
374
|
+
def find_relationship_auto_index(*args)
|
375
|
+
case args.size
|
376
|
+
when 2 then index = get("/index/auto/relationship/#{args[0]}/#{args[1]}") || Array.new
|
377
|
+
when 1 then index = get("/index/auto/relationship/?query=#{args[0]}") || Array.new
|
378
|
+
end
|
365
379
|
return nil if index.empty?
|
366
380
|
index
|
367
381
|
end
|
368
382
|
|
383
|
+
def get_node_auto_index_status
|
384
|
+
get("/index/auto/node/status")
|
385
|
+
end
|
386
|
+
|
387
|
+
def get_relationship_auto_index_status
|
388
|
+
get("/index/auto/relationship/status")
|
389
|
+
end
|
390
|
+
|
391
|
+
def set_node_auto_index_status(change_to = true)
|
392
|
+
options = { :body => change_to.to_json, :headers => {'Content-Type' => 'application/json'} }
|
393
|
+
put("/index/auto/node/status", options)
|
394
|
+
end
|
395
|
+
|
396
|
+
def set_relationship_auto_index_status(change_to = true)
|
397
|
+
options = { :body => change_to.to_json, :headers => {'Content-Type' => 'application/json'} }
|
398
|
+
put("/index/auto/relationship/status", options)
|
399
|
+
end
|
400
|
+
|
401
|
+
def get_node_auto_index_properties
|
402
|
+
get("/index/auto/node/properties")
|
403
|
+
end
|
404
|
+
|
405
|
+
def get_relationship_auto_index_properties
|
406
|
+
get("/index/auto/relationship/properties")
|
407
|
+
end
|
408
|
+
|
409
|
+
def add_node_auto_index_property(property)
|
410
|
+
options = { :body => property, :headers => {'Content-Type' => 'application/json'} }
|
411
|
+
post("/index/auto/node/properties", options)
|
412
|
+
end
|
413
|
+
|
414
|
+
def remove_node_auto_index_property(property)
|
415
|
+
delete("/index/auto/node/properties/#{property}")
|
416
|
+
end
|
417
|
+
|
418
|
+
def add_relationship_auto_index_property(property)
|
419
|
+
options = { :body => property, :headers => {'Content-Type' => 'application/json'} }
|
420
|
+
post("/index/auto/relationship/properties", options)
|
421
|
+
end
|
422
|
+
|
423
|
+
def remove_relationship_auto_index_property(property)
|
424
|
+
delete("/index/auto/relationship/properties/#{property}")
|
425
|
+
end
|
426
|
+
|
369
427
|
def traverse(id, return_type, description)
|
370
428
|
options = { :body => {"order" => get_order(description["order"]),
|
371
429
|
"uniqueness" => get_uniqueness(description["uniqueness"]),
|
@@ -473,10 +531,18 @@ module Neography
|
|
473
531
|
else
|
474
532
|
{:method => "POST", :to => @cypher_path, :body => {:query => args[1]}}
|
475
533
|
end
|
476
|
-
|
534
|
+
when :remove_node_from_index
|
535
|
+
case args.size
|
536
|
+
when 5 then {:method => "DELETE", :to => "/index/node/#{args[1]}/#{args[2]}/#{args[3]}/#{get_id(args[4])}" }
|
537
|
+
when 4 then {:method => "DELETE", :to => "/index/node/#{args[1]}/#{args[2]}/#{get_id(args[3])}" }
|
538
|
+
when 3 then {:method => "DELETE", :to => "/index/node/#{args[1]}/#{get_id(args[2])}" }
|
539
|
+
end
|
540
|
+
when :delete_node
|
541
|
+
{:method => "DELETE", :to => "/node/#{get_id(args[1])}"}
|
542
|
+
else
|
477
543
|
raise "Unknown option #{args[0]}"
|
478
544
|
end
|
479
|
-
|
545
|
+
end
|
480
546
|
|
481
547
|
def evaluate_response(response)
|
482
548
|
code = response.code
|
@@ -1,32 +1,21 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
2
|
|
3
|
-
describe Neography::
|
4
|
-
before(:each) do
|
5
|
-
pending "Phase 2 - Index part is not done."
|
6
|
-
Neography::Relationship.index(:strength)
|
7
|
-
end
|
3
|
+
describe Neography::Index do
|
8
4
|
|
9
|
-
it "can
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Neography::Relationship.find('strength: strong').first.should == r
|
5
|
+
it "can add a node to an index" do
|
6
|
+
new_node = Neography::Node.create
|
7
|
+
key = generate_text(6)
|
8
|
+
value = generate_text
|
9
|
+
new_node.add_to_index("node_test_index", key, value)
|
15
10
|
end
|
16
11
|
|
17
|
-
it "can
|
18
|
-
|
19
|
-
|
20
|
-
r
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
r2.del
|
25
|
-
Neography::Relationship.find('strength: weak').should be_empty
|
12
|
+
it "can add a relationship to an index" do
|
13
|
+
node1 = Neography::Node.create
|
14
|
+
node2 = Neography::Node.create
|
15
|
+
r = Neography::Relationship.create(:friends, node1, node2)
|
16
|
+
key = generate_text(6)
|
17
|
+
value = generate_text
|
18
|
+
r.add_to_index("relationship_test_index", key, value)
|
26
19
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
describe Neography::Node, "find" do
|
31
|
-
|
32
|
-
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
describe Neography do
|
4
|
+
subject { Neography::Rest.new }
|
5
|
+
describe 'create_node' do
|
6
|
+
it 'should not convert strings to symbol' do
|
7
|
+
node = subject.create_node({:text => ':1456'})
|
8
|
+
|
9
|
+
node['data']['text'].class.should == String # fails! expected: String got: Symbol (using ==)
|
10
|
+
node['data']['text'].should == ':1456'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -266,6 +266,37 @@ describe Neography::Rest do
|
|
266
266
|
batch_result.first["body"]["data"][0][0]["self"].split('/').last.should == id
|
267
267
|
end
|
268
268
|
|
269
|
+
it "can delete a node in batch" do
|
270
|
+
|
271
|
+
node1 = @neo.create_node
|
272
|
+
node2 = @neo.create_node
|
273
|
+
id1 = node1['self'].split('/').last
|
274
|
+
id2 = node2['self'].split('/').last
|
275
|
+
batch_result = @neo.batch [:delete_node, id1 ], [:delete_node, id2]
|
276
|
+
@neo.get_node(node1).should be_nil
|
277
|
+
@neo.get_node(node2).should be_nil
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
it "can remove a node from an index in batch " do
|
282
|
+
index = generate_text(6)
|
283
|
+
key = generate_text(6)
|
284
|
+
value1 = generate_text
|
285
|
+
value2 = generate_text
|
286
|
+
value3 = generate_text
|
287
|
+
|
288
|
+
node1 = @neo.create_unique_node(index, key, value1, { "name" => "Max" })
|
289
|
+
node2 = @neo.create_unique_node(index, key, value2, { "name" => "Neo" })
|
290
|
+
node3 = @neo.create_unique_node(index, key, value3, { "name" => "Samir"})
|
291
|
+
|
292
|
+
batch_result = @neo.batch [:remove_node_from_index, index, key, value1, node1 ],
|
293
|
+
[:remove_node_from_index, index, key, node2 ],
|
294
|
+
[:remove_node_from_index, index, node3 ]
|
295
|
+
|
296
|
+
@neo.get_node_index(index, key, value1).should be_nil
|
297
|
+
@neo.get_node_index(index, key, value2).should be_nil
|
298
|
+
@neo.get_node_index(index, key, value3).should be_nil
|
299
|
+
end
|
269
300
|
|
270
301
|
end
|
271
302
|
|
@@ -364,25 +395,22 @@ describe Neography::Rest do
|
|
364
395
|
end
|
365
396
|
|
366
397
|
it "can create a relationship from a unique node" do
|
367
|
-
|
368
|
-
require 'net-http-spy'
|
369
|
-
Net::HTTP.http_logger_options = {:verbose => true} # see everything
|
370
|
-
|
371
398
|
batch_result = @neo.batch [:create_node, {:street1=>"94437 Kemmer Crossing", :street2=>"Apt. 333", :city=>"Abshireton", :state=>"AA", :zip=>"65820", :_type=>"Address", :created_at=>1335269478}],
|
372
399
|
[:add_node_to_index, "person_ssn", "ssn", "000-00-0001", "{0}"],
|
373
400
|
[:create_unique_node, "person", "ssn", "000-00-0001", {:first_name=>"Jane", :last_name=>"Doe", :ssn=>"000-00-0001", :_type=>"Person", :created_at=>1335269478}],
|
374
401
|
[:create_relationship, "has", "{0}", "{2}", {}]
|
375
|
-
|
402
|
+
batch_result.should_not be_nil
|
376
403
|
|
377
404
|
|
378
405
|
batch_result = @neo.batch [:create_unique_node, "person", "ssn", "000-00-0001", {:first_name=>"Jane", :last_name=>"Doe", :ssn=>"000-00-0001", :_type=>"Person", :created_at=>1335269478}],
|
379
406
|
[:add_node_to_index, "person_ssn", "ssn", "000-00-0001", "{0}"],
|
380
407
|
[:create_node, {:street1=>"94437 Kemmer Crossing", :street2=>"Apt. 333", :city=>"Abshireton", :state=>"AA", :zip=>"65820", :_type=>"Address", :created_at=>1335269478}],
|
381
408
|
[:create_relationship, "has", "{0}", "{2}", {}]
|
382
|
-
|
383
|
-
|
409
|
+
# create_unique_node is returning an index result, not a node, so we can't do this yet.
|
410
|
+
# See https://github.com/neo4j/community/issues/697
|
411
|
+
batch_result.should_not be_nil
|
384
412
|
end
|
385
413
|
|
386
414
|
end
|
387
415
|
|
388
|
-
end
|
416
|
+
end
|
@@ -294,21 +294,95 @@ describe Neography::Rest do
|
|
294
294
|
end
|
295
295
|
|
296
296
|
describe "auto indexes" do
|
297
|
+
|
298
|
+
it "can check the status of node auto index" do
|
299
|
+
@neo.get_node_auto_index_status.should satisfy{|status| [true, false].include?(status)}
|
300
|
+
end
|
297
301
|
|
302
|
+
it "can check the status of relationship auto index" do
|
303
|
+
@neo.get_relationship_auto_index_status.should satisfy{|status| [true, false].include?(status)}
|
304
|
+
end
|
305
|
+
|
306
|
+
it "can change the node auto index status" do
|
307
|
+
@neo.set_node_auto_index_status(true)
|
308
|
+
@neo.get_node_auto_index_status.should be_true
|
309
|
+
end
|
310
|
+
|
311
|
+
it "can change the relationship auto index status" do
|
312
|
+
@neo.set_relationship_auto_index_status(true)
|
313
|
+
@neo.get_relationship_auto_index_status.should be_true
|
314
|
+
end
|
315
|
+
|
316
|
+
it "can get a list of auto indexed node properties" do
|
317
|
+
@neo.set_node_auto_index_status(true)
|
318
|
+
@neo.create_node_auto_index
|
319
|
+
@neo.add_node_auto_index_property("name")
|
320
|
+
@neo.get_node_auto_index_properties.should == ["name"]
|
321
|
+
end
|
322
|
+
|
323
|
+
it "can get a list of auto indexed relationship properties" do
|
324
|
+
@neo.set_relationship_auto_index_status(true)
|
325
|
+
@neo.create_relationship_auto_index
|
326
|
+
@neo.add_relationship_auto_index_property("weight")
|
327
|
+
@neo.get_relationship_auto_index_properties.should == ["weight"]
|
328
|
+
end
|
329
|
+
|
330
|
+
it "can remove a property from the auto indexed node properties" do
|
331
|
+
@neo.add_node_auto_index_property("name")
|
332
|
+
@neo.add_node_auto_index_property("label")
|
333
|
+
@neo.get_node_auto_index_properties.should == ["name", "label"]
|
334
|
+
@neo.remove_node_auto_index_property("label")
|
335
|
+
@neo.get_node_auto_index_properties.should == ["name"]
|
336
|
+
end
|
337
|
+
|
338
|
+
it "can remove a property from the auto indexed relationship properties" do
|
339
|
+
@neo.add_relationship_auto_index_property("weight")
|
340
|
+
@neo.add_relationship_auto_index_property("strength")
|
341
|
+
@neo.get_relationship_auto_index_properties.should == ["weight", "strength"]
|
342
|
+
@neo.remove_relationship_auto_index_property("strength")
|
343
|
+
@neo.get_relationship_auto_index_properties.should == ["weight"]
|
344
|
+
end
|
345
|
+
|
298
346
|
it "can get a node from an automatic index" do
|
299
|
-
|
347
|
+
new_node = @neo.create_node("name" => "Max")
|
348
|
+
existing_nodes = @neo.get_node_auto_index("name", "Max")
|
349
|
+
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).should be_true
|
350
|
+
end
|
351
|
+
|
352
|
+
it "can query a node from an automatic index using key value" do
|
353
|
+
new_node = @neo.create_node("name" => "Max")
|
354
|
+
existing_nodes = @neo.find_node_auto_index("name", "Max")
|
355
|
+
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).should be_true
|
300
356
|
end
|
301
357
|
|
302
358
|
it "can query a node from an automatic index" do
|
303
|
-
|
359
|
+
new_node = @neo.create_node("name" => "Max")
|
360
|
+
existing_nodes = @neo.find_node_auto_index("name:Max")
|
361
|
+
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).should be_true
|
304
362
|
end
|
305
363
|
|
306
364
|
it "can get a relationship from an automatic index" do
|
307
|
-
|
365
|
+
new_node1 = @neo.create_node("name" => "Max")
|
366
|
+
new_node2 = @neo.create_node("name" => "Peter")
|
367
|
+
new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"weight" => 5})
|
368
|
+
existing_rels = @neo.get_relationship_auto_index("weight", 5)
|
369
|
+
existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"]).should be_true
|
370
|
+
end
|
371
|
+
|
372
|
+
it "can query a relationship from an automatic index using key value" do
|
373
|
+
new_node1 = @neo.create_node("name" => "Max")
|
374
|
+
new_node2 = @neo.create_node("name" => "Peter")
|
375
|
+
new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"weight" => 5})
|
376
|
+
existing_rels = @neo.find_relationship_auto_index("weight", 5)
|
377
|
+
existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"]).should be_true
|
308
378
|
end
|
309
379
|
|
310
380
|
it "can query a relationship from an automatic index" do
|
311
|
-
|
381
|
+
new_node1 = @neo.create_node("name" => "Max")
|
382
|
+
new_node2 = @neo.create_node("name" => "Peter")
|
383
|
+
new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"weight" => 5})
|
384
|
+
existing_rels = @neo.find_relationship_auto_index("weight:5")
|
385
|
+
existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"]).should be_true
|
312
386
|
end
|
313
387
|
|
314
388
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neography
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.28
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &8820440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *8820440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: net-http-spy
|
27
|
-
requirement: &
|
27
|
+
requirement: &8819700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.2.1
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *8819700
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &8832280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.8.7
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *8832280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: httparty
|
49
|
-
requirement: &
|
49
|
+
requirement: &8831800 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.8.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *8831800
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &8831340 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.8.7
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *8831340
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
|
-
requirement: &
|
71
|
+
requirement: &8830960 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *8830960
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: os
|
82
|
-
requirement: &
|
82
|
+
requirement: &8830500 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *8830500
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rubyzip
|
93
|
-
requirement: &
|
93
|
+
requirement: &8830080 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *8830080
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: oj
|
104
|
-
requirement: &
|
104
|
+
requirement: &8829640 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *8829640
|
113
113
|
description: A Ruby wrapper to the Neo4j Rest API see http://components.neo4j.org/neo4j-rest/
|
114
114
|
for more details.
|
115
115
|
email: maxdemarzi@gmail.com
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- spec/integration/node_path_spec.rb
|
160
160
|
- spec/integration/node_relationship_spec.rb
|
161
161
|
- spec/integration/node_spec.rb
|
162
|
+
- spec/integration/parsing_spec.rb
|
162
163
|
- spec/integration/relationship_spec.rb
|
163
164
|
- spec/integration/rest_batch_spec.rb
|
164
165
|
- spec/integration/rest_bulk_spec.rb
|
@@ -191,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
192
|
version: '0'
|
192
193
|
requirements: []
|
193
194
|
rubyforge_project: neography
|
194
|
-
rubygems_version: 1.8.
|
195
|
+
rubygems_version: 1.8.17
|
195
196
|
signing_key:
|
196
197
|
specification_version: 3
|
197
198
|
summary: ruby wrapper to Neo4j Rest API
|