Annotate the Python object model to the Neo4j graph database

In this recipe, we will learn how to map the Python object model to the Neo4j graph database server.

Getting ready

Neomodel is an excellent binding module used for mapping an object model to the Neo4j graph database, thinking in terms of objects and further enhancing properties, relationships, and so on.

Neomodel can be installed from both via pip and easy_install:

$ pip install neomodel
$ easy_install neomodel

Now, set the location of Neo4j via the environment variable:

export NEO4J_REST_URL="http://<ip:port>/db/data"

How to do it...

Let's create our first relationship model using Neomodel, as shown in the following code:

from neomodel import (StructuredNode, StringProperty, IntegerProperty,RelationshipTo, ...

Get Neo4j Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.