neography-ajaycb 0.0.21

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.
Files changed (54) hide show
  1. data/.gitignore +5 -0
  2. data/.project +12 -0
  3. data/.travis.yml +1 -0
  4. data/CONTRIBUTORS +12 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +39 -0
  7. data/LICENSE +19 -0
  8. data/README.rdoc +350 -0
  9. data/Rakefile +15 -0
  10. data/examples/facebook.rb +40 -0
  11. data/examples/facebook_v2.rb +25 -0
  12. data/examples/greatest.rb +43 -0
  13. data/examples/linkedin.rb +39 -0
  14. data/examples/linkedin_v2.rb +22 -0
  15. data/examples/traversal_example1.rb +65 -0
  16. data/examples/traversal_example2.rb +54 -0
  17. data/lib/neography.rb +46 -0
  18. data/lib/neography/config.rb +17 -0
  19. data/lib/neography/equal.rb +21 -0
  20. data/lib/neography/index.rb +13 -0
  21. data/lib/neography/neography.rb +10 -0
  22. data/lib/neography/node.rb +45 -0
  23. data/lib/neography/node_path.rb +29 -0
  24. data/lib/neography/node_relationship.rb +35 -0
  25. data/lib/neography/node_traverser.rb +142 -0
  26. data/lib/neography/path_traverser.rb +94 -0
  27. data/lib/neography/property.rb +53 -0
  28. data/lib/neography/property_container.rb +17 -0
  29. data/lib/neography/railtie.rb +8 -0
  30. data/lib/neography/relationship.rb +68 -0
  31. data/lib/neography/relationship_traverser.rb +80 -0
  32. data/lib/neography/rest.rb +534 -0
  33. data/lib/neography/tasks.rb +131 -0
  34. data/lib/neography/version.rb +3 -0
  35. data/neography.gemspec +29 -0
  36. data/spec/integration/authorization_spec.rb +48 -0
  37. data/spec/integration/index_spec.rb +32 -0
  38. data/spec/integration/neography_spec.rb +10 -0
  39. data/spec/integration/node_path_spec.rb +222 -0
  40. data/spec/integration/node_relationship_spec.rb +374 -0
  41. data/spec/integration/node_spec.rb +215 -0
  42. data/spec/integration/relationship_spec.rb +37 -0
  43. data/spec/integration/rest_batch_spec.rb +221 -0
  44. data/spec/integration/rest_bulk_spec.rb +106 -0
  45. data/spec/integration/rest_experimental_spec.rb +22 -0
  46. data/spec/integration/rest_gremlin_fail_spec.rb +46 -0
  47. data/spec/integration/rest_index_spec.rb +297 -0
  48. data/spec/integration/rest_node_spec.rb +232 -0
  49. data/spec/integration/rest_path_spec.rb +209 -0
  50. data/spec/integration/rest_plugin_spec.rb +67 -0
  51. data/spec/integration/rest_relationship_spec.rb +327 -0
  52. data/spec/integration/rest_traverse_spec.rb +149 -0
  53. data/spec/spec_helper.rb +18 -0
  54. metadata +222 -0
@@ -0,0 +1,5 @@
1
+ neo4j
2
+ pkg/*
3
+ *.gem
4
+ .bundle
5
+ log/*
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>neography</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ </buildSpec>
9
+ <natures>
10
+ <nature>com.aptana.ruby.core.rubynature</nature>
11
+ </natures>
12
+ </projectDescription>
@@ -0,0 +1 @@
1
+ script: "bundle exec rake neo4j:install neo4j:start spec --trace"
@@ -0,0 +1,12 @@
1
+ Maintainer:
2
+ Max De Marzi <maxdemarzi at gmail dot com>
3
+
4
+ Contributors:
5
+ * Peter Neubauer
6
+ * Ian Dees
7
+ * Phuong CAO
8
+ * Carlo Alberto Degli Atti
9
+ * Stephen Becker IV
10
+ * Thomas Baum
11
+ * Maximilian Schulz
12
+ * Hesham Amiri
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in neography.gemspec
4
+ gemspec
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ neography (0.0.19)
5
+ httparty (= 0.7.8)
6
+ json
7
+ os
8
+ rubyzip
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ crack (0.1.8)
14
+ diff-lcs (1.1.3)
15
+ httparty (0.7.8)
16
+ crack (= 0.1.8)
17
+ json (1.6.4)
18
+ net-http-spy (0.2.1)
19
+ os (0.9.5)
20
+ rake (0.8.7)
21
+ rspec (2.7.0)
22
+ rspec-core (~> 2.7.0)
23
+ rspec-expectations (~> 2.7.0)
24
+ rspec-mocks (~> 2.7.0)
25
+ rspec-core (2.7.1)
26
+ rspec-expectations (2.7.0)
27
+ diff-lcs (~> 1.1.2)
28
+ rspec-mocks (2.7.0)
29
+ rubyzip (0.9.5)
30
+
31
+ PLATFORMS
32
+ java
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ neography!
37
+ net-http-spy (= 0.2.1)
38
+ rake (~> 0.8.7)
39
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Max De Marzi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,350 @@
1
+ == Welcome to Neography
2
+
3
+ Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:
4
+ * {Getting Started with Neo4j Server}[http://wiki.neo4j.org/content/Getting_Started_with_Neo4j_Server]
5
+ * {Neo4j Rest API Reference}[http://components.neo4j.org/neo4j-server/milestone/rest.html]
6
+
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
+
9
+ A complement to Neography is the Neology Gem at https://github.com/lordkada/neology by Carlo Alberto Degli Atti
10
+
11
+ An alternative is the Architect4r Gem at https://github.com/namxam/architect4r by Maximilian Schulz
12
+
13
+ === Neography in the Wild
14
+
15
+ * {Vouched}[http://getvouched.com]
16
+ * {Neovigator}[http://neovigator.herokuapp.com] fork it at https://github.com/maxdemarzi/neovigator
17
+ * {Neoflix}[http://neoflix.herokuapp.com] fork it at https://github.com/maxdemarzi/neoflix
18
+
19
+ === Getting started with Neography
20
+
21
+ * {Getting Started with Ruby and Neo4j}[http://maxdemarzi.com/2012/01/04/getting-started-with-ruby-and-neo4j/]
22
+ * {Graph visualization with Neo4j}[http://maxdemarzi.com/2012/01/11/graph-visualization-and-neo4j/]
23
+ * {Neo4j on Heroku}[http://maxdemarzi.com/2012/01/13/neo4j-on-heroku-part-one/]
24
+
25
+
26
+ === Installation
27
+
28
+ gem install 'neography'
29
+
30
+
31
+ After that, in your ruby script:
32
+
33
+ require 'rubygems'
34
+ require 'neography'
35
+
36
+ in order to access the functionality.
37
+
38
+
39
+ === Dependencies
40
+
41
+ for use:
42
+ os
43
+ rake
44
+ json
45
+ httparty
46
+
47
+ for development:
48
+ rspec
49
+ net-http-spy
50
+
51
+ ==== Rails
52
+
53
+ Just add gem 'neography' to your Gemfile and run bundle install.
54
+
55
+ The following tasks will be available to you:
56
+
57
+ rake neo4j:install # Install Neo4j to the neo4j directory under your project
58
+ rake neo4j:install[community,1.6.M03] # Install Neo4j Community edition, version 1.6.M03
59
+ rake neo4j:install[advanced,1.5] # Install Neo4j Advanced edition, version 1.5
60
+ rake neo4j:install[enterprise,1.5] # Install Neo4j Enterprise edition, version 1.5
61
+ rake neo4j:start # Start Neo4j
62
+ rake neo4j:stop # Stop Neo4j
63
+ rake neo4j:restart # Restart Neo4j
64
+ rake neo4j:reset_yes_i_am_sure # Wipe your Neo4j Database
65
+
66
+ Windows users will need to run in a command prompt with Administrative Privileges
67
+ in order to install Neo4j as a Service.
68
+
69
+ If you are not using Rails, then add:
70
+
71
+ require 'neography/tasks'
72
+
73
+ to your Rakefile to have access to these tasks.
74
+
75
+
76
+ === Documentation
77
+
78
+ @neo = Neography::Rest.new({:protocol => 'http://',
79
+ :server => 'localhost',
80
+ :port => 7474,
81
+ :directory => '', # use '/<my directory>' or leave out for default
82
+ :authentication => 'basic', # 'basic', 'digest' or leave out for default
83
+ :username => 'your username', #leave out for default
84
+ :password => 'your password', #leave out for default
85
+ :log_file => 'neography.log',
86
+ :log_enabled => false,
87
+ :max_threads => 20})
88
+
89
+ Quick initializer (assumes basic authorization if username is given):
90
+
91
+ @neo = Neography::Rest.new("http://username:password@myserver.com:7474/mydirectory")
92
+
93
+
94
+ To Use:
95
+
96
+ @neo = Neography::Rest.new # Inialize using all default parameters
97
+
98
+ @neo.get_root # Get the root node
99
+ node1 = @neo.create_node # Create an empty node
100
+ node2 = @neo.create_node("age" => 31, "name" => "Max") # Create a node with some properties
101
+ @neo.get_node(node2) # Get a node and its properties
102
+ @neo.delete_node(node2) # Delete an unrelated node
103
+ @neo.delete_node!(node2) # Delete a node and all its relationships
104
+
105
+ @neo.reset_node_properties(node1, {"age" => 31}) # Reset a node's properties
106
+ @neo.set_node_properties(node1, {"weight" => 200}) # Set a node's properties
107
+ @neo.get_node_properties(node1) # Get just the node properties
108
+ @neo.get_node_properties(node1, ["weight","age"]) # Get some of the node properties
109
+ @neo.remove_node_properties(node1) # Remove all properties of a node
110
+ @neo.remove_node_properties(node1, "weight") # Remove one property of a node
111
+ @neo.remove_node_properties(node1, ["weight","age"]) # Remove multiple properties of a node
112
+
113
+ rel1 = @neo.create_relationship("friends", node1, node2) # Create a relationship between node1 and node2
114
+ rel2 = @neo.get_relationship(rel1) # Get a relationship
115
+ @neo.get_node_relationships(node1) # Get all relationships
116
+ @neo.get_node_relationships(node1, "in") # Get only incoming relationships
117
+ @neo.get_node_relationships(node1, "all", "enemies") # Get all relationships of type enemies
118
+ @neo.get_node_relationships(node1, "in", "enemies") # Get only incoming relationships of type enemies
119
+ @neo.delete_relationship(rel1) # Delete a relationship
120
+
121
+ @neo.reset_relationship_properties(rel1, {"age" => 31}) # Reset a relationship's properties
122
+ @neo.set_relationship_properties(rel1, {"weight" => 200}) # Set a relationship's properties
123
+ @neo.get_relationship_properties(rel1) # Get just the relationship properties
124
+ @neo.get_relationship_properties(rel1, ["since","met"]) # Get some of the relationship properties
125
+ @neo.remove_relationship_properties(rel1) # Remove all properties of a relationship
126
+ @neo.remove_relationship_properties(rel1, "since") # Remove one property of a relationship
127
+ @neo.remove_relationship_properties(rel1, ["since","met"]) # Remove multiple properties of a relationship
128
+
129
+ @neo.list_node_indexes # gives names and query templates for all defined indices
130
+ @neo.create_node_index(name, type, provider) # creates an index, defaults are "exact" and "lucene"
131
+ @neo.add_node_to_index(index, key, value, node1) # adds a node to the index with the given key/value pair
132
+ @neo.remove_node_from_index(index, key, value, node1) # removes a node from the index with the given key/value pair
133
+ @neo.remove_node_from_index(index, key, node1) # removes a node from the index with the given key
134
+ @neo.remove_node_from_index(index, node1) # removes a node from the index
135
+ @neo.get_node_index(index, key, value) # exact query of the node index with the given key/value pair
136
+ @neo.find_node_index(index, key, value) # advanced query of the node index with the given key/value pair
137
+ @neo.find_node_index(index, query ) # advanced query of the node index with the given query
138
+ @neo.list_relationship_indexes # gives names and query templates for relationship indices
139
+ @neo.create_relationship_index(name, "fulltext", provider) # creates a relationship index with "fulltext" option
140
+ @neo.add_relationship_to_index(index, key, value, rel1) # adds a relationship to the index with the given key/value pair
141
+ @neo.remove_relationship_from_index(index, key, value, rel1) # removes a relationship from the index with the given key/value pair
142
+ @neo.remove_relationship_from_index(index, key, rel1) # removes a relationship from the index with the given key
143
+ @neo.remove_relationship_from_index(index, rel1) # removes a relationship from the index
144
+ @neo.get_relationship_index(index, key, value) # exact query of the relationship index with the given key/value pair
145
+ @neo.find_relationship_index(index, key, value) # advanced query of the relationship index with the given key/value pair
146
+ @neo.find_relationship_index(index, query) # advanced query of the relationship index with the given query
147
+ @neo.execute_script("g.v(0)") # sends a Groovy script (through the Gremlin plugin)
148
+ @neo.execute_script("g.v(id)", {:id => 3}) # sends a parameterized Groovy script (optimized for repeated calls)
149
+ @neo.execute_query("start n=node(0) return n") # sends a Cypher query (through the Cypher plugin)
150
+ @neo.execute_query("start n=node(id) return n", {:id => 3}) # sends a parameterized Cypher query (optimized for repeated calls)
151
+
152
+ @neo.get_path(node1, node2, relationships, depth=4, algorithm="shortestPath") # finds the shortest path between two nodes
153
+ @neo.get_paths(node1, node2, relationships, depth=3, algorithm="allPaths") # finds all paths between two nodes
154
+
155
+ nodes = @neo.traverse(node1, # the node where the traversal starts
156
+ "nodes", # return_type "nodes", "relationships" or "paths"
157
+ {"order" => "breadth first", # "breadth first" or "depth first" traversal order
158
+ "uniqueness" => "node global", # See Uniqueness in API documentation for options.
159
+ "relationships" => [{"type"=> "roommates", # A hash containg a description of the traversal
160
+ "direction" => "all"}, # two relationships.
161
+ {"type"=> "friends", #
162
+ "direction" => "out"}], #
163
+ "prune evaluator" => {"language" => "javascript", # A prune evaluator (when to stop traversing)
164
+ "body" => "position.endNode().getProperty('age') < 21;"},
165
+ "return filter" => {"language" => "builtin", # "all" or "all but start node"
166
+ "name" => "all"},
167
+ "depth" => 4})
168
+
169
+ # "depth" is a short-hand way of specifying a prune evaluator which prunes after a certain depth.
170
+ # If not specified a depth of 1 is used and if a "prune evaluator" is specified instead of a depth, no depth limit is set.
171
+
172
+ Please see the specs for more examples.
173
+
174
+ Batch (in progress):
175
+
176
+ @neo.batch [:get_node, node1], [:get_node, node2] # Gets two nodes in a batch
177
+ @neo.batch [:create_node, {"name" => "Max"}],
178
+ [:create_node, {"name" => "Marc"}] # Creates two nodes in a batch
179
+ @neo.batch [:set_node_property, node1, {"name" => "Tom"}],
180
+ [:set_node_property, node2, {"name" => "Jerry"}] # Sets the property of two nodes
181
+ @neo.batch [:get_relationship, rel1],
182
+ [:get_relationship, rel2] # Gets two relationships in a batch
183
+ @neo.batch [:create_relationship, "friends",
184
+ node1, node2, {:since => "high school"}],
185
+ [:create_relationship, "friends",
186
+ node1, node3, {:since => "college"}] # Creates two relationships in a batch
187
+ @neo.batch [:create_node, {"name" => "Max"}],
188
+ [:create_node, {"name" => "Marc"}], # Creates two nodes and index them
189
+ [:add_node_to_index, "test_node_index", key, value, "{0}"],
190
+ [:add_node_to_index, "test_node_index", key, value, "{1}"],
191
+ [:create_relationship, "friends", # and create a relationship for those
192
+ "{0}", "{1}", {:since => "college"}], # newly created nodes
193
+ [:add_relationship_to_index,
194
+ "test_relationship_index", key, value, "{4}"] # and index the new relationship
195
+
196
+ @neo.batch *[[:create_node, {"name" => "Max"}],
197
+ [:create_node, {"name" => "Marc"}]] # Use the Splat (*) with Arrays of Arrays
198
+
199
+ See http://docs.neo4j.org/chunked/milestone/rest-api-batch-ops.html for Neo4j Batch operations documentation.
200
+
201
+ Experimental:
202
+
203
+ nodes = @neo.create_nodes(5) # Create 5 empty nodes
204
+ nodes = @neo.create_nodes_threaded(5) # Create 5 empty nodes using threads
205
+ nodes = @neo.create_node_nodes([{"age" => 31, "name" => "Max"},
206
+ {"age" => 24, "name" => "Alex"}) # Create two nodes with properties
207
+ nodes = @neo.create_node_nodes_threaded([{"age" => 31, "name" => "Max"},
208
+ {"age" => 24, "name" => "Alex"}) # Create two nodes with properties threaded
209
+ nodes = @neo.get_nodes([17,86,397,33]) # Get four nodes by their id
210
+
211
+ one_set_nodes = @neo.create_nodes(3)
212
+ another_node = @neo.create_node("age" => 31, "name" => "Max")
213
+ nodes = @neo.get_nodes([one_set_nodes, another_node]) # Get four nodes
214
+
215
+ === Phase 2
216
+
217
+ Trying to mimic the Neo4j.rb API.
218
+
219
+ Now we are returning full objects. The properties of the node or relationship can be accessed directly (node.name).
220
+ The Neo4j ID is available by using node.neo_id .
221
+
222
+ @neo2 = Neography::Rest.new ({:server => '192.168.10.1'})
223
+
224
+ Neography::Node.create # Create an empty node
225
+ Neography::Node.create("age" => 31, "name" => "Max") # Create a node with some properties
226
+ Neography::Node.create(@neo2, {"age" => 31, "name" => "Max"}) # Create a node on the server defined in @neo2
227
+ Neography::Node.create({"age" => 31, "name" => "Max"}, @neo2) # Same as above, but different order
228
+
229
+ Neography::Node.load(5) # Get a node and its properties by id
230
+ Neography::Node.load(existing_node) # Get a node and its properties by Node
231
+ Neography::Node.load("http://localhost:7474/db/data/node/2") # Get a node and its properties by String
232
+
233
+ Neography::Node.load(@neo2, 5) # Get a node on the server defined in @neo2
234
+ Neography::Node.load(5, @neo2) # Same as above, but different order
235
+
236
+ n1 = Node.create
237
+ n1.del # Deletes the node
238
+ n1.exist? # returns true/false if node exists in Neo4j
239
+
240
+ n1 = Node.create("age" => 31, "name" => "Max")
241
+ n1[:age] #returns 31 # Get a node property using [:key]
242
+ n1.name #returns "Max" # Get a node property as a method
243
+ n1[:age] = 24 # Set a node property using [:key] =
244
+ n1.name = "Alex" # Set a node property as a method
245
+ n1[:hair] = "black" # Add a node property using [:key] =
246
+ n1.weight = 190 # Add a node property as a method
247
+ n1[:name] = nil # Delete a node property using [:key] = nil
248
+ n1.name = nil # Delete a node property by setting it to nil
249
+
250
+ n2 = Neography::Node.create
251
+ new_rel = Neography::Relationship.create(:family, n1, n2) # Create a relationship from my_node to node2
252
+ new_rel.start_node # Get the start/from node of a relationship
253
+ new_rel.end_node # Get the end/to node of a relationship
254
+ new_rel.other_node(n2) # Get the other node of a relationship
255
+
256
+ existing_rel = Neography::Relationship.load(12) # Get an existing relationship by id
257
+ existing_rel.del # Delete a relationship
258
+
259
+ Neography::Relationship.create(:friends, n1, n2)
260
+ n1.outgoing(:friends) << n2 # Create outgoing relationship
261
+ n1.incoming(:friends) << n2 # Create incoming relationship
262
+ n1.both(:friends) << n2 # Create both relationships
263
+
264
+ n1.outgoing # Get nodes related by outgoing relationships
265
+ n1.incoming # Get nodes related by incoming relationships
266
+ n1.both # Get nodes related by any relationships
267
+
268
+ n1.outgoing(:friends) # Get nodes related by outgoing friends relationship
269
+ n1.incoming(:friends) # Get nodes related by incoming friends relationship
270
+ n1.both(:friends) # Get nodes related by friends relationship
271
+
272
+ n1.outgoing(:friends).incoming(:enemies) # Get nodes related by one of multiple relationships
273
+ n1.outgoing(:friends).depth(2) # Get nodes related by friends and friends of friends
274
+ n1.outgoing(:friends).depth(:all) # Get nodes related by friends until the end of the graph
275
+ n1.outgoing(:friends).depth(2).include_start_node # Get n1 and nodes related by friends and friends of friends
276
+
277
+ n1.outgoing(:friends).prune("position.endNode().getProperty('name') == 'Tom';")
278
+ n1.outgoing(:friends).filter("position.length() == 2;")
279
+
280
+ n1.rel?(:friends) # Has a friends relationship
281
+ n1.rel?(:outgoing, :friends) # Has outgoing friends relationship
282
+ n1.rel?(:friends, :outgoing) # same, just the other way
283
+ n1.rel?(:outgoing) # Has any outgoing relationships
284
+ n1.rel?(:both) # Has any relationships
285
+ n1.rel?(:all) # same as above
286
+ n1.rel? # same as above
287
+
288
+ n1.rels # Get node relationships
289
+ n1.rels(:friends) # Get friends relationships
290
+ n1.rels(:friends).outgoing # Get outgoing friends relationships
291
+ n1.rels(:friends).incoming # Get incoming friends relationships
292
+ n1.rels(:friends,:work) # Get friends and work relationships
293
+ n1.rels(:friends,:work).outgoing # Get outgoing friends and work relationships
294
+
295
+ n1.all_paths_to(n2).incoming(:friends).depth(4) # Gets all paths of a specified type
296
+ n1.all_simple_paths_to(n2).incoming(:friends).depth(4) # for the relationships defined
297
+ n1.all_shortest_paths_to(n2).incoming(:friends).depth(4) # at a maximum depth
298
+ n1.path_to(n2).incoming(:friends).depth(4) # Same as above, but just one path.
299
+ n1.simple_path_to(n2).incoming(:friends).depth(4)
300
+ n1.shortest_path_to(n2).incoming(:friends).depth(4)
301
+
302
+ n1.shortest_path_to(n2).incoming(:friends).depth(4).rels # Gets just relationships in path
303
+ n1.shortest_path_to(n2).incoming(:friends).depth(4).nodes # Gets just nodes in path
304
+
305
+
306
+ See Neo4j API for:
307
+ * {Order}[http://components.neo4j.org/neo4j-examples/1.2.M04/apidocs/org/neo4j/graphdb/Traverser.Order.html]
308
+ * {Uniqueness}[http://components.neo4j.org/neo4j-examples/1.2.M04/apidocs/org/neo4j/kernel/Uniqueness.html]
309
+ * {Prune Evaluator}[http://components.neo4j.org/neo4j-examples/1.2.M04/apidocs/org/neo4j/graphdb/StopEvaluator.html]
310
+ * {Return Filter}[http://components.neo4j.org/neo4j-examples/1.2.M04/apidocs/org/neo4j/graphdb/ReturnableEvaluator.html]
311
+
312
+ === Examples
313
+
314
+ A couple of examples borrowed from Matthew Deiters's Neo4jr-social:
315
+
316
+ * {Facebook}[https://github.com/maxdemarzi/neography/blob/master/examples/facebook.rb]
317
+ * {Linked In}[https://github.com/maxdemarzi/neography/blob/master/examples/linkedin.rb]
318
+
319
+ Phase 2 way of doing these:
320
+
321
+ * {Facebook}[https://github.com/maxdemarzi/neography/blob/master/examples/facebook_v2.rb]
322
+ * {Linked In}[https://github.com/maxdemarzi/neography/blob/master/examples/linkedin_v2.rb]
323
+
324
+
325
+ === To Do
326
+
327
+ * Batch functions
328
+ * Phase 2 Index functionality
329
+ * More Tests
330
+ * More Examples
331
+ * Mixins ?
332
+
333
+ === Contributing
334
+
335
+ {<img src="https://secure.travis-ci.org/maxdemarzi/neography.png" />}[http://travis-ci.org/maxdemarzi/neography]
336
+
337
+ Please create a {new issue}[https://github.com/maxdemarzi/neography/issues] if you run into any bugs.
338
+ Contribute patches via pull requests.
339
+
340
+ === Help
341
+
342
+ If you are just starting out, or need help send me an e-mail at maxdemazi@gmail.com.
343
+
344
+ === Licenses
345
+
346
+ * Neography - MIT, see the LICENSE file http://github.com/maxdemarzi/neography/tree/master/LICENSE.
347
+ * Lucene - Apache, see http://lucene.apache.org/java/docs/features.html
348
+ * Neo4j - Dual free software/commercial license, see http://neo4j.org
349
+
350
+