Neo4j MetaModel
neo4j-meta_model
is a Rails engine for providing a web user interface for easily managing neo4j databases. It can be included in your Rails app or used independently via the neo4j-meta_model-app application.
Concepts
The neo4j gem is used behind the scenes, and so the concepts of Models and Associations are exposed directly in neo4j-meta_model
-
Models Models correspond to Neo4j Labels. Models define which properties which we are concerned with as well as validations and business logic. Models also support inheritance. Currently
neo4j-meta_model
supports properties and inheritance but not validation or custom business logic. -
Associations Associations specify which nodes are related to a node under consideration. For example, if there are
Person
andArticle
models with aWROTE_ARTICLE
relationship between them, one might define anarticles
association for thePerson
model and anauthor
association for theArticle
model, both of which use theWROTE_ARTICLE
relationship. Inneo4j-meta_model
, both associations are always defined at the same time.
Interface
neo4j-meta_model
has two main sections: one for managing your domain model, and one for editing records in the domain model.
Domain Model Management (Admin)
Models
Models can be added by going to the section for Models and entering a new name for your model. Once a model has been added, click it in the list to edit.
When editing models, you can define if the model inherits properties from other models and what properties the model has. Properties are the slots where data is stored in records for those models. The ID Property is a property which is unique across all records in the model. If you do not choose an ID Property, a uuid
property will be created automatically.
Associations
In neo4j-meta_model
, opposite pair associations are always defined at the same time. The following diagram is used in a couple of places to describe associations.
In this case it indicates a many-to-many relationship where:
- the
Person
model has agists
association - the
Gist
model has awriters
association - the
WRITER_OF
relationship type is used to query the associations
Installation
Gemfile
gem 'neo4j-meta_model', require: 'neo4j/meta_model'
In your environment (config/application.rb
or config/environments/development.rb
for example)
config.neo4j.session_type = :server_db
config.neo4j.session_path = 'http://localhost:7474'
config/routes.rb
mount Neo4j::MetaModel::Engine => "/mount/path"
This project rocks and uses MIT-LICENSE.