{"id":14970812,"url":"https://github.com/neo4jrb/neo4j-core","last_synced_at":"2025-05-16T13:02:45.313Z","repository":{"id":2378575,"uuid":"3343704","full_name":"neo4jrb/neo4j-core","owner":"neo4jrb","description":"A simple unified API that can access both the server and embedded Neo4j database. Used by the neo4j gem","archived":false,"fork":false,"pushed_at":"2023-04-04T21:38:28.000Z","size":23106,"stargazers_count":98,"open_issues_count":49,"forks_count":79,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-09T10:04:19.795Z","etag":null,"topics":["adaptor","driver","graph-database","neo4j","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/neo4jrb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-02-03T10:53:43.000Z","updated_at":"2024-12-01T18:35:09.000Z","dependencies_parsed_at":"2023-07-06T11:01:26.860Z","dependency_job_id":null,"html_url":"https://github.com/neo4jrb/neo4j-core","commit_stats":{"total_commits":1459,"total_committers":49,"mean_commits":"29.775510204081634","dds":0.6052090472926662,"last_synced_commit":"4b649fca33a1b1dba8705e6f999764ad9fb4d76e"},"previous_names":[],"tags_count":165,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo4jrb%2Fneo4j-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo4jrb%2Fneo4j-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo4jrb%2Fneo4j-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo4jrb%2Fneo4j-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neo4jrb","download_url":"https://codeload.github.com/neo4jrb/neo4j-core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535792,"owners_count":22087397,"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":["adaptor","driver","graph-database","neo4j","ruby"],"created_at":"2024-09-24T13:44:11.205Z","updated_at":"2025-05-16T13:02:45.220Z","avatar_url":"https://github.com/neo4jrb.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neo4j-core\n\n[![Actively Maintained](https://img.shields.io/badge/Maintenance%20Level-Actively%20Maintained-green.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d)\n[![Code Climate](https://codeclimate.com/github/neo4jrb/neo4j-core.svg)](https://codeclimate.com/github/neo4jrb/neo4j-core)\n[![Build Status](https://travis-ci.org/neo4jrb/neo4j-core.svg)](https://travis-ci.org/neo4jrb/neo4j-core)\n[![Coverage Status](https://coveralls.io/repos/neo4jrb/neo4j-core/badge.svg?branch=master)](https://coveralls.io/r/neo4jrb/neo4j-core?branch=master)\n[![PullReview stats](https://www.pullreview.com/github/neo4jrb/neo4j-core/badges/master.svg?)](https://www.pullreview.com/github/neo4jrb/neo4j-core/reviews/master)\n\nA simple Ruby wrapper around the Neo4j graph database that works with the server and embedded Neo4j API. This gem can be used both from JRuby and normal MRI.\nIt can be used standalone without the neo4j gem.\n\n## Basic usage\n\n### Executing Cypher queries\n\nTo make a basic connection to Neo4j to execute Cypher queries, first choose an adaptor.  Adaptors for HTTP, Bolt, and Embedded mode (jRuby only) are available.  You can create an adaptor like:\n\n    require 'neo4j/core/cypher_session/adaptors/http'\n    http_adaptor = Neo4j::Core::CypherSession::Adaptors::HTTP.new('http://neo4j:pass@localhost:7474', options)\n\n    # or\n\n    require 'neo4j/core/cypher_session/adaptors/bolt'\n    bolt_adaptor = Neo4j::Core::CypherSession::Adaptors::Bolt.new('bolt://neo4j:pass@localhost:7687', options)\n\n    # or\n\n    require 'neo4j/core/cypher_session/adaptors/embedded'\n    neo4j_adaptor = Neo4j::Core::CypherSession::Adaptors::Embedded.new('/file/path/to/graph.db', options)\n\nThe options are specific to each adaptor.  See below for details.\n\nOnce you have an adaptor you can create a session like so:\n\n    neo4j_session = Neo4j::Core::CypherSession.new(http_adaptor)\n\nFrom there you can make queries with a Cypher string:\n\n    # Basic query\n    neo4j_session.query('MATCH (n) RETURN n LIMIT 10')\n\n    # Query with parameters\n    neo4j_session.query('MATCH (n) RETURN n LIMIT {limit}', limit: 10)\n\nOr via the `Neo4j::Core::Query` class\n\n    query_obj = Neo4j::Core::Query.new.match(:n).return(:n).limit(10)\n\n    neo4j_session.query(query_obj)\n\nMaking multiple queries with one request is supported with the HTTP Adaptor:\n\n    results = neo4j_session.queries do\n      append 'MATCH (n:Foo) RETURN n LIMIT 10'\n      append 'MATCH (n:Bar) RETURN n LIMIT 5'\n    end\n\n    results[0] # results of first query\n    results[1] # results of second query\n\nWhen doing batched queries, there is also a shortcut for getting a new `Neo4j::Core::Query`:\n\n    results = neo4j_session.queries do\n      append query.match(:n).return(:n).limit(10)\n    end\n\n    results[0] # result\n\n### Adaptor Options\n\nAs mentioned above, each of the adaptors take different sets of options.  They are enumerated below:\n\n#### Shared options\n\nAll adaptors take `wrap_level` as an option.  This can be used to control how nodes, relationships, and path data is returned:\n\n * `wrap_level: :none` will return Ruby hashes\n * `wrap_level: :core_entity` will return objects from the `neo4j-core` gem (`Neo4j::Core::Node`, `Neo4j::Core::Relationship`, and `Neo4j::Core::Path`\n * `wrap_level: :prop` allows you to define Ruby Procs to do your own wrapping.  This is how the `neo4j` gem provides `ActiveNode` and `ActiveRel` objects (see the [`node_wrapper.rb`](https://github.com/neo4jrb/neo4j/blob/master/lib/neo4j/active_node/node_wrapper.rb) and [`rel_wrapper.rb`](https://github.com/neo4jrb/neo4j/blob/master/lib/neo4j/active_rel/rel_wrapper.rb) files for examples on how this works\n\nAll adaptors will also take either a `logger` option with a Ruby logger to define where it will log to.\n\nAll adaptors will also take the `skip_instrumentation` option to skip logging of queries.\n\nAll adaptors will also take the `verbose_query_logs` option which can be `true` or `false` (`false` being the default).  This will change the logging to output the source line of code which caused a query to be executed (note that the `skip_instrumentation` should not be set for logging to be produced).\n\n#### Bolt\n\nThe Bolt adaptor takes `connect_timeout`, `read_timeout`, and `write_timeout` options which define appropriate timeouts.  The `connect_timeout` is 10 seconds and the `read_timeout` and `write_timeout` are -1 (no timeout).  This is to cause the underlying `net_tcp_client` gem to operate in blocking mode (as opposed to non-blocking mode).  When using non-blocking mode problems were found and since the official Neo4j drivers in other languages use blocking mode, this is what this gem uses by default.  This issue could potentially be a bug in the handling of the `EAGAIN` signal, but it was not investigated further. Set the read/write timeouts at your own risk.\n\nThe Bolt adaptor also takes an `ssl` option which also corresponds to `net_tcp_client`'s `ssl` option (which, in turn, corresponds to Ruby's `OpenSSL::SSL::SSLContext`).  By default SSL is used.  For most cloud providers that use public certificate authorities this open generally won't be needed.  If you've setup Neo4j yourself you will need to provide the certificate like so:\n\n```ruby\ncert_store = OpenSSL::X509::Store.new\ncert_store.add_file('/the/path/to/your/neo4j.cert')\nssl: {cert_store: cert_store}}\nbolt_adaptor = Neo4j::Core::CypherSession::Adaptors::Bolt.new('bolt://neo4j:pass@localhost:7687', ssl: {cert_store: cert_store})\n```\n\nYou can also turn SSL off by simply specifying `ssl: false`\n\n#### HTTP\n\nSince the HTTP adaptor uses the `faraday` gem under the covers, it takes a `faraday_configurator` option.  This allows you to pass in a `Proc` which works just like a Faraday setup block:\n\n```ruby\n  faraday_configurator: proc do |faraday|\n    # The default configurator uses typhoeus so if you override the configurator you must specify this\n    faraday.adapter :typhoeus\n    # Optionally you can instead specify another adaptor\n    # faraday.use Faraday::Adapter::NetHttpPersistent\n\n    # If you need to set options which would normally be the second argument of `Faraday.new`, you can do the following:\n    faraday.options[:open_timeout] = 5\n    faraday.options[:timeout] = 65\n    # faraday.options[:ssl] = { verify: true }\n  end\n```\n\n#### Embedded\n\nThe Embedded adaptor takes `properties_file` and `properties_map` options which are passed to `loadPropertiesFromFile` and `setConfig` on the `GraphDatabaseBuilder` class from the Neo4j Java API.\n\n## Documentation\n\nOur documentation on ReadTheDocs covers both the `neo4j` and `neo4j-core` gems:\n\n * http://neo4jrb.readthedocs.org/en/stable/\n\n\n## Support\n\n### Issues\n\n[![Next Release](https://badge.waffle.io/neo4jrb/neo4j-core.png?label=Next%20Release\u0026title=Next%20Release) ![In Progress](https://badge.waffle.io/neo4jrb/neo4j-core.png?label=In%20Progress\u0026title=In%20Progress) ![In Master](https://badge.waffle.io/neo4jrb/neo4j-core.png?label=In%20Master\u0026title=In%20Master)](https://waffle.io/neo4jrb/neo4j-core)\n\n[![Post an issue](https://img.shields.io/badge/Bug%3F-Post%20an%20issue!-blue.svg)](https://waffle.io/neo4jrb/neo4j-core)\n\n\n### Get Support\n\n#### Documentation\n\nAll new documentation will be done via our [readthedocs](http://neo4jrb.readthedocs.org) site, though some old documentation has yet to be moved from our [wiki](https://github.com/neo4jrb/neo4j/wiki) (also there is the [neo4j-core wiki](https://github.com/neo4jrb/neo4j-core/wiki))\n\n#### Contact Us\n\n[![StackOverflow](https://img.shields.io/badge/StackOverflow-Ask%20a%20question!-blue.svg)](http://stackoverflow.com/questions/ask?tags=neo4j.rb+neo4j+ruby)  [![Gitter](https://img.shields.io/badge/Gitter-Join%20our%20chat!-blue.svg)](https://gitter.im/neo4jrb/neo4j?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)  [![Twitter](https://img.shields.io/badge/Twitter-Tweet%20with%20us!-blue.svg)](https://twitter.com/neo4jrb)\n\n\n## Developers\n\n### Original Author\n\n* [Andreas Ronge](https://github.com/andreasronge)\n\n### Previous Maintainers\n\n* [Brian Underwood](https://github.com/cheerfulstoic)\n* [Chris Grigg](https://github.com/subvertallchris)\n\n### Current Maintainers\n\n* [Heinrich Klobuczek](https://github.com/klobuczek)\n* [Amit Suryavanshi](https://github.com/amitsuryavanshi)\n\nConsulting support? Contact [Heinrich](https://gitter.im/klobuczek) and/or [Amit](https://gitter.im/amitTheSongadya_twitter)\n\n## Contributing\n\nPull request with high test coverage and good [code climate](https://codeclimate.com/github/neo4jrb/neo4j-core) values will be accepted faster.\nNotice, only JRuby can run all the tests (embedded and server db). To run tests with coverage: `rake coverage`.\n\n## License\n* Neo4j.rb - MIT, see the LICENSE file http://github.com/neo4jrb/neo4j-core/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\nNotice there are different license for the neo4j-community, neo4j-advanced and neo4j-enterprise jar gems.\nOnly the neo4j-community gem is by default required.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo4jrb%2Fneo4j-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneo4jrb%2Fneo4j-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo4jrb%2Fneo4j-core/lists"}