{"id":13483734,"url":"https://github.com/maxdemarzi/neography","last_synced_at":"2025-05-15T11:03:39.020Z","repository":{"id":56885275,"uuid":"1076059","full_name":"maxdemarzi/neography","owner":"maxdemarzi","description":"A thin Ruby wrapper to the Neo4j Rest API","archived":false,"fork":false,"pushed_at":"2017-02-27T17:39:36.000Z","size":925,"stargazers_count":606,"open_issues_count":19,"forks_count":134,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-04-07T09:09:28.708Z","etag":null,"topics":["graph-database","graphs","neo4j","neo4j-driver","neography","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxdemarzi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-11-12T22:50:45.000Z","updated_at":"2025-02-23T12:14:20.000Z","dependencies_parsed_at":"2022-08-20T14:31:22.711Z","dependency_job_id":null,"html_url":"https://github.com/maxdemarzi/neography","commit_stats":null,"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdemarzi%2Fneography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdemarzi%2Fneography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdemarzi%2Fneography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdemarzi%2Fneography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxdemarzi","download_url":"https://codeload.github.com/maxdemarzi/neography/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248912369,"owners_count":21182263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-database","graphs","neo4j","neo4j-driver","neography","ruby"],"created_at":"2024-07-31T17:01:14.740Z","updated_at":"2025-04-14T15:55:16.611Z","avatar_url":"https://github.com/maxdemarzi.png","language":"Ruby","readme":"Neography\n=========\n\n- [![Gem Version](https://badge.fury.io/rb/neography.png)](https://rubygems.org/gems/neography)\n- [![Build Status](https://secure.travis-ci.org/maxdemarzi/neography.png?branch=master)](http://travis-ci.org/maxdemarzi/neography)\n- [![Code Climate](https://codeclimate.com/github/maxdemarzi/neography.png)](https://codeclimate.com/github/maxdemarzi/neography)\n- [![Coverage Status](https://coveralls.io/repos/maxdemarzi/neography/badge.png?branch=master)](https://coveralls.io/r/maxdemarzi/neography)\n\n## Welcome to Neography \n\nNeography is a thin Ruby wrapper to the Neo4j Rest API, for more information:\n\n* [Getting Started with Neo4j Server](http://neo4j.org/community/)\n* [Neo4j Rest API Reference](http://docs.neo4j.org/chunked/milestone/rest-api.html)\n\nIf 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\n\n\n## Installation\n\n### Gemfile\n\nAdd `neography` to your Gemfile:\n\n```ruby\ngem 'neography'\n```\n\nAnd run Bundler:\n\n```sh\n$ bundle\n```\n\n### Manually:\n\nOr install `neography` manually:\n\n```sh\n$ gem install 'neography'\n```\n\nAnd require the gem in your Ruby code:\n\n```ruby\nrequire 'rubygems'\nrequire 'neography'\n```\n\nRead the wiki for information about [dependencies](https://github.com/maxdemarzi/neography/wiki/Dependencies).\n\n[Rake tasks](https://github.com/maxdemarzi/neography/wiki/Rake-tasks) are available for downloading, installing and running Neo4j.\n\n\n## Usage\n\n### Configuration and initialization\n\nConfigure Neography as follows:\n\n```ruby\n# these are the default values:\nNeography.configure do |config|\n  config.protocol             = \"http\"\n  config.server               = \"localhost\"\n  config.port                 = 7474\n  config.directory            = \"\"  # prefix this path with '/'\n  config.cypher_path          = \"/cypher\"\n  config.gremlin_path         = \"/ext/GremlinPlugin/graphdb/execute_script\"\n  config.log_file             = \"neography.log\"\n  config.log_enabled          = false\n  config.slow_log_threshold   = 0    # time in ms for query logging\n  config.max_threads          = 20\n  config.authentication       = nil  # 'basic' or 'digest'\n  config.username             = nil\n  config.password             = nil\n  config.parser               = MultiJsonParser\n  config.http_send_timeout    = 1200\n  config.http_receive_timeout = 1200\n  config.persistent           = true\n  end\n  ```\n\nThen initialize a `Rest` instance:\n\n```ruby\n@neo = Neography::Rest.new\n@neo = Neography::Rest.new({:authentication =\u003e 'basic', :username =\u003e \"neo4j\", :password =\u003e \"swordfish\"})\n@neo = Neography::Rest.new(\"http://neo4j:swordfish@localhost:7474\")\n```\n\nFor overriding these default and other initialization methods, see the\n[configuration and initialization](https://github.com/maxdemarzi/neography/wiki/Configuration-and-initialization) page in the Wiki.\n\n\n### REST API\n\nNeography supports the creation and retrieval of nodes and relationships through the Neo4j REST interface.\nIt supports indexes, Gremlin scripts, Cypher queries and batch operations.\n\nSome of this functionality is shown here, but all of it is explained in the following Wiki pages:\n\n2.0 Only features:\n\n* [Schema indexes](https://github.com/maxdemarzi/neography/wiki/Schema-indexes) - Create, get and delete schema indexes.\n* [Node labels](https://github.com/maxdemarzi/neography/wiki/Node-labels) - Create, get and delete node labels.\n* [Transactions](https://github.com/maxdemarzi/neography/wiki/Transactions) - Begin, add to, commit, rollback transactions.\n\n1.8+ features:\n\n* [Nodes](https://github.com/maxdemarzi/neography/wiki/Nodes) - Create, get and delete nodes.\n* [Node properties](https://github.com/maxdemarzi/neography/wiki/Node-properties) - Set, get and remove node properties.\n* [Node relationships](https://github.com/maxdemarzi/neography/wiki/Node-relationships) - Create and get relationships between nodes.\n* [Relationship](https://github.com/maxdemarzi/neography/wiki/Relationships) - Get and delete relationships.\n* [Relationship properties](https://github.com/maxdemarzi/neography/wiki/Relationship-properties) - Create, get and delete relationship properties.\n* [Relationship types](https://github.com/maxdemarzi/neography/wiki/Relationship-types) - List relationship types.\n* [Node indexes](https://github.com/maxdemarzi/neography/wiki/Node-indexes) - List and create node indexes. Add, remove, get and search nodes in indexes.\n* [Relationship indexes](https://github.com/maxdemarzi/neography/wiki/Relationship-indexes) - List and create relationships indexes. Add, remove, get and search relationships in indexes.\n* [Auto indexes](https://github.com/maxdemarzi/neography/wiki/Auto-indexes) - Get, set and remove auto indexes.\n* [Scripts and queries](https://github.com/maxdemarzi/neography/wiki/Scripts-and-queries) - Run Gremlin scripts and Cypher queries.\n* [Paths and traversal](https://github.com/maxdemarzi/neography/wiki/Paths-and-traversal) - Paths between nodes and path traversal.\n* [Batch](https://github.com/maxdemarzi/neography/wiki/Batch) - Execute multiple calls at once.\n* [Errors](https://github.com/maxdemarzi/neography/wiki/Errors) - Errors raised if REST API calls fail.\n\n\nSome example usage:\n\n```ruby\n# Node creation:\nnode1 = @neo.create_node(\"age\" =\u003e 31, \"name\" =\u003e \"Max\")\nnode2 = @neo.create_node(\"age\" =\u003e 33, \"name\" =\u003e \"Roel\")\n\n# Node properties:\n@neo.set_node_properties(node1, {\"weight\" =\u003e 200})\n\n# Relationships between nodes:\n@neo.create_relationship(\"coding_buddies\", node1, node2)\n\n# Get node relationships:\n@neo.get_node_relationships(node2, \"in\", \"coding_buddies\")\n\n# Use indexes:\n@neo.add_node_to_index(\"people\", \"name\", \"max\", node1)\n@neo.get_node_index(\"people\", \"name\", \"max\")\n\n# Batches:\n@neo.batch [:create_node, {\"name\" =\u003e \"Max\"}],\n           [:create_node, {\"name\" =\u003e \"Marc\"}]\n           \n# Cypher queries:\n@neo.execute_query(\"start n=node(0) return n\")\n           \n```\n\nYou can also use the [cypher gem](https://github.com/andreasronge/neo4j-cypher) instead of writing cypher as text.\n\n\n```\nnode(1).outgoing(rel(:friends).where{|r| r[:since] == 1994})\n```\n\nwould become:\n\n```\nSTART me=node(1) \nMATCH (me)-[friend_rel:`friends`]-\u003e(friends) \nWHERE (friend_rel.since = 1994) \nRETURN friends\n```\n\nThis is just a small sample of the full API, see the [Wiki documentation](https://github.com/maxdemarzi/neography/wiki) for the full API.\n\nNeography raises REST API errors as Ruby errors, see the wiki page about [errors](https://github.com/maxdemarzi/neography/wiki/Errors).\n(**Note**: older versions of Neography did not raise any errors!)\n\n\n## *Phase 2*\n\nTrying to mimic the [Neo4j.rb API](https://github.com/andreasronge/neo4j/wiki/Neo4j%3A%3ACore-Nodes-Properties-Relationships).\n\nNow we are returning full objects. The properties of the node or relationship can be accessed directly (`node.name`).\nThe Neo4j ID is available by using `node.neo_id`.\n\nSome of this functionality is shown here, but all of it is explained in the following Wiki pages:\n\n* [Nodes](https://github.com/maxdemarzi/neography/wiki/Phase-2-Nodes) - Create, load and delete nodes.\n* [Node properties](https://github.com/maxdemarzi/neography/wiki/Phase-2-Node-properties) - Add, get and remove node properties.\n* [Node relationships](https://github.com/maxdemarzi/neography/wiki/Phase-2-Node-relationships) - Create and retrieve node relationships.\n* [Node paths](https://github.com/maxdemarzi/neography/wiki/Phase-2-Node-paths) - Gets paths between nodes.\n\n\n```ruby\n# create two nodes:\nn1 = Neography::Node.create(\"age\" =\u003e 31, \"name\" =\u003e \"Max\")\nn2 = Neography::Node.create(\"age\" =\u003e 33, \"name\" =\u003e \"Roel\")\n\nn1.exist? # =\u003e true\n\n# get and change some properties:\nn1[:age]         # =\u003e 31\nn1.name          # =\u003e \"Max\"\nn1[:age]  = 32   # change property\nn1.weight = 190  # new property\nn1.age    = nil  # remove property\n\n# add a relationship between nodes:\nnew_rel = Neography::Relationship.create(:coding_buddies, n1, n2)\n\n# remove a relationship:\nnew_rel.del\n\n# add a relationship on nodes:\nn1.outgoing(:coding_buddies) \u003c\u003c n2\n\n# more advanced relationship traversal:\nn1.outgoing(:friends)                                                # Get nodes related by outgoing friends relationship\nn1.outgoing(:friends).depth(2).include_start_node                    # Get n1 and nodes related by friends and friends of friends\n\nn1.rel?(:outgoing, :friends)                                         # Has outgoing friends relationship\nn1.rels(:friends,:work).outgoing                                     # Get outgoing friends and work relationships\n\nn1.all_paths_to(n2).incoming(:friends).depth(4)                      # Gets all paths of a specified type\nn1.shortest_path_to(n2).incoming(:friends).depth(4).nodes            # Gets just nodes in path\n```\n\nThis is just a small sample of the full API, see the [Wiki documentation](https://github.com/maxdemarzi/neography/wiki) for the full API.\n\n## More\n\n### Examples\n\nSome [example code](https://github.com/maxdemarzi/neography/wiki/Examples).\n\n\n### Testing\n\nSome [tips about testing](https://github.com/maxdemarzi/neography/wiki/Testing).\n\n\n### Related Neo4j projects\n\nComplement to Neography are the:\n\n* [Neo4j Active Record Adapter](https://github.com/yournextleap/activerecord-neo4j-adapter) by Nikhil Lanjewar\n* [Neology](https://github.com/lordkada/neology) by Carlo Alberto Degli Atti\n* [Neoid](https://github.com/elado/neoid) by Elad Ossadon\n\nAn alternative to Neography is [Architect4r](https://github.com/namxam/architect4r) by Maximilian Schulz\n\n\n### Neography in the Wild\n\n* [Vouched](http://getvouched.com)\n* [Neovigator](http://neovigator.herokuapp.com) fork it at https://github.com/maxdemarzi/neovigator\n* [Neoflix](http://neoflix.herokuapp.com) fork it at  https://github.com/maxdemarzi/neoflix\n\n\n### Getting started with Neography\n\n* [Getting Started with Ruby and Neo4j](http://maxdemarzi.com/2012/01/04/getting-started-with-ruby-and-neo4j/)\n* [Graph visualization with Neo4j](http://maxdemarzi.com/2012/01/11/graph-visualization-and-neo4j/)\n* [Neo4j on Heroku](http://maxdemarzi.com/2012/01/13/neo4j-on-heroku-part-one/)\n\n\n## Contributing\n\nPlease create a [new issue](https://github.com/maxdemarzi/neography/issues) if you run into any bugs.\n\nContribute patches via [pull requests](https://github.com/maxdemarzi/neography/pulls).\n\n\n## Help\n\nIf you are just starting out, or need help send me an e-mail at maxdemarzi@gmail.com.\n\nCheck you my blog at http://maxdemarzi.com where I have more Neography examples.\n\n\n## Licenses\n\n* Neography - MIT, see the LICENSE file http://github.com/maxdemarzi/neography/tree/master/LICENSE.\n* Lucene -  Apache, see http://lucene.apache.org/java/docs/features.html\n* Neo4j - Dual free software/commercial license, see http://neo4j.org\n\n","funding_links":[],"categories":["Connectors","Database Drivers","REST API"],"sub_categories":["REST API","Ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxdemarzi%2Fneography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxdemarzi%2Fneography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxdemarzi%2Fneography/lists"}