百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

neography

> 数据库
开源

一个用于 Neo4j Rest API 的薄弱 Ruby 封装

603 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

一个用于 Neo4j Rest API 的薄弱 Ruby 封装

Neography

Welcome to Neography

Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:

  • Getting Started with Neo4j Server
  • Neo4j Rest API Reference

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

Installation

Gemfile

Add neography to your Gemfile:

ruby
gem 'neography'

And run Bundler:

bash
$ bundle

Manually:

Or install neography manually:

bash
$ gem install 'neography'

And require the gem in your Ruby code:

ruby
require 'rubygems'
require 'neography'

Read the wiki for information about dependencies.

Rake tasks are available for downloading, installing and running Neo4j.

Usage

Configuration and initialization

Configure Neography as follows:

…

Then initialize a Rest instance:

ruby
@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.

REST API

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:

  • Schema indexes - Create, get and delete schema indexes.
  • Node labels - Create, get and delete node labels.
  • Transactions - Begin, add to, commit, rollback transactions.

1.8+ features:

  • Nodes - Create, get and delete nodes.
  • Node properties - Set, get and remove node properties.
  • Node relationships - Create and get relationships between nodes.
  • Relationship - Get and delete relationships.
  • Relationship properties - Create, get and delete relationship properties.
  • Relationship types - List relationship types.
  • Node indexes - List and create node indexes. Add, remove, get and search nodes in indexes.
  • Relationship indexes - List and create relationships indexes. Add, remove, get and search relationships in indexes.
  • Auto indexes - Get, set and remove auto indexes.
  • Scripts and queries - Run Gremlin scripts and Cypher queries.
  • Paths and traversal - Paths between nodes and path traversal.
  • Batch - Execute multiple calls at once.
  • Errors - Errors raised if REST API calls fail.

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 friends

This 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!)

Phase 2

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:

  • Nodes - Create, load and delete nodes.
  • Node properties - Add, get and remove node properties.
  • Node relationships - Create and retrieve node relationships.
  • Node paths - Gets paths between nodes.
…

This is just a small sample of the full API, see the Wiki documentation for the full API.

More

Examples

Some example code.

Testing

Some tips about testing.

Related Neo4j projects

Complement to Neography are the:

  • Neo4j Active Record Adapter by Nikhil Lanjewar
  • Neology by Carlo Alberto Degli Atti
  • Neoid by Elad Ossadon

An alternative to Neography is Architect4r by Maximilian Schulz

Neography in the Wild

  • Vouched
  • Neovigator fork it at https://github.com/maxdemarzi/neovigator
  • Neoflix fork it at https://github.com/maxdemarzi/neoflix

Getting started with Neography

  • Getting Started with Ruby and Neo4j
  • Graph visualization with Neo4j
  • Neo4j on Heroku

Contributing

Please create a new issue if you run into any bugs.

Contribute patches via pull requests.

Help

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.

Licenses

  • Neography - MIT, see the LICENSE file http://github.com/maxdemarzi/neography/tree/master/LICENSE.
  • Lucene - Apache, see http://lucene.apache.org/java/docs/features.html
  • Neo4j - Dual free software/commercial license, see http://neo4j.org

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubygraph-databasegraphsneo4jneo4j-driver

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库