A thin Ruby wrapper to the Neo4j Rest API
Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:
If you want to utilize 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
Add neography to your Gemfile:
gem 'neography'And run Bundler:
$ bundleOr install neography manually:
$ gem install 'neography'And require the gem in your Ruby code:
require 'rubygems'
require 'neography'Read the wiki for information about dependencies.
Rake tasks are available for downloading, installing and running Neo4j.
Configure Neography as follows:
…Then initialize a Rest instance:
@neo = Neography::Rest.new
@neo = Neography::Rest.new({:authentication => 'basic', :username => "neo4j", :password => "swordfish"})
@neo = Neography::Rest.new("http://neo4j:swordfish@localhost:7474")For overriding these default and other initialization methods, see the configuration and initialization page in the Wiki.
Neography supports the creation and retrieval of nodes and relationships through the Neo4j REST interface. It supports indexes, Gremlin scripts, Cypher queries and batch operations.
Some of this functionality is shown here, but all of it is explained in the following Wiki pages:
2.0 Only features:
1.8+ features:
Some example usage:
…You can also use the cypher gem instead of writing cypher as text.
node(1).outgoing(rel(:friends).where{|r| r[:since] == 1994})would become:
START me=node(1)
MATCH (me)-[friend_rel:`friends`]->(friends)
WHERE (friend_rel.since = 1994)
RETURN friendsThis is just a small sample of the full API, see the Wiki documentation for the full API.
Neography raises REST API errors as Ruby errors, see the wiki page about errors. (Note: older versions of Neography did not raise any errors!)
Trying to mimic the Neo4j.rb API.
Now we are returning full objects. The properties of the node or relationship can be accessed directly (node.name).
The Neo4j ID is available by using node.neo_id.
Some of this functionality is shown here, but all of it is explained in the following Wiki pages:
…This is just a small sample of the full API, see the Wiki documentation for the full API.
Some example code.
Some tips about testing.
Complement to Neography are the:
An alternative to Neography is Architect4r by Maximilian Schulz
Please create a new issue if you run into any bugs.
Contribute patches via pull requests.
If you are just starting out, or need help send me an e-mail at [email protected].
Check you my blog at http://maxdemarzi.com where I have more Neography examples.
No open issues yet, or sync has not completed.