I’ve mix phx.new ed many applications and when doing so I often start with wondering how to organize my code. I love how Phoenix pushes you to think about th...
Modeling in Neo4j Sans Programming
I have a bit of a problem.
Sometimes I have a hard time implementing a specific solution to a problem. Sometimes I think: “If I just took a step back, I could create a tool which anybody could use to do anything!” If I do it right, nobody will ever need to write a piece of software again!
I’m not there yet, but I’d like to announce a big step on my journey: neo4j-meta_model
neo4j-meta_model is a tool for managing Neo4j graph databases in Ruby on Rails apps. A big goal of the project is to create something which, while a very powerful tool for programmers, can also be used by non-programmers. This is such an important goal that I created a Rails app (creatively named neo4j-meta_model-app) which you need only to download, install, and run to set up a user-friendly interface for working with Neo4j databases.
What does it do?
neo4j-meta_model provides a web-based user interface for doing two things:
- Defining the structure of your data in Neo4j
- Browsing and managing your data
Defining the structure of your data
An administrative section is provided to allow users to define models and associations. Since the neo4j Ruby library’s ActiveNode is used behind the scenes, models and associations correspond to Neo4j’s nodes and relationships. A quick primer:
Models correspond to Neo4j Labels which define entity tyes like
Product, etc… For a model, you can define
- Properties (such as
price) with which we are concerned
- Data validations and other business logic
- Inheritance for when we want one model to have mostly the same properties as another
neo4j-meta_model supports properties and inheritance but not validation or custom business logic.
Associations specify which nodes are related to a node under consideration. For example, if there are
Article models with a
WROTE_ARTICLE relationship between them, one might define an
articles association for the
Person model and an
author association for the
Article model. In
neo4j-meta_model, both associations are always defined at the same time.
To the right is the diagram which is shown when creating associations. The diagram represents a pair of associations and changes in real time as the pair of associations is defined. In this case it indicates a one-to-many relationship where:
Songmodel has one
Personmodel has many
- there is a
WRITTEN_BYrelationship type in Neo4j which goes from Songs to People and it is used to find nodes for the associations
Browsing and managing your data
Once the database model has been established users can browse and edit the data itself. A simple CRUD interface is provided for records of the defined models. When a record is found all other records known via associations are displayed (see screenshot to the right which shows a
Gist and it’s associated
Domains). When editing a record properties can be edited but associations can also be selected to create/destroy relationships. For
has one relationships this is done via a simple drop-down, but for
has many relationships an add/remove list interface is provided.
I’ve deployed an instance of neo4j-meta_model-app at http://neo4j-meta-model-app.herokuapp.com/ so that you can play around with it. Let me know what you think and if you have any issues feel free to report them on the project page!
The Technical Stuff
neo4j-meta_model is a Rails engine, which means it is a Rails application inside a Rails application. It must be given a route inside the host rails application to provide the user interface for the Neo4j database. In the case of neo4j-meta_model-app, this is simply the root (‘/’) route.
The admin side of the engine is built as an Ember.js application, while the CRUD record management side is built with standard Rails server-side rendering (with a touch of Rivets.js and Backbone.js where needed)
The current version of this project is a bare bones starting point. Some things that I’d like to see in the near future:
- Search, filtering, and pagination when browsing records
- Permissions for the admin side as well as individual models
- Visual data browsing (see Graph Visualization and Neo4j and The Last Mile)
- Tools for running graph analytics metrics
2020Back to Top ↑
For just over a year I’ve been obsessed on-and-off with a project ever since I stayed in the town of Skibbereen, Ireland. Taking data from the 1901 and 1911...
A while ago my colleague Michael suggested to me that I draw out some examples of how my record linkage algorithm did it’s thing. In order to do that, I’ve ...
Last night I ran a very successful workshop at the Friends of Neo4j Stockholm meetup group. The format was based on a workshop that I attended in San Franci...
In my last two posts I covered the process of importing data from StackOverflow and GitHub for the purpose of creating a combined MDM database. Now we get t...
In my last post I said I would “bring in another data source, show how I linked the data together, and demonstrate the sort of bigger picture that one can ge...
Joining multiple disparate data-sources, commonly dubbed Master Data Management (MDM), is usually not a fun exercise. I would like to show you how to use a g...
When using neo4j for the first time, most people want to import data from another database to start playing around. There are a lot of options including LOA...
I am he as you are he as you are me and we are all together – The Beatles
When I told the people of Northern Ireland that I was an atheist, a woman in the audience stood up and said, ‘Yes, but is it the God of the Catholics or t...
“Wilkins! Yes! I’ve considered decorating these walls with some graffiti of my own, and writing it in the Universal Character.. but it is too depressing...