[Neo] Groovy and Neo4J

James Richards heiho1 at mac.com
Fri Dec 5 00:11:51 CET 2008

>> Along the
>> lines of Django integration, this is something that I actually took a
>> prolonged look at, in the midst of other projects.  I was interested
>> in making Neo4J a swappable database backend for the standard Django
>> orm.  The advantage of this is that Django Model and Admin classes
>> could integrate directly with Neo4J.  There are some relational
>> assumptions in the Django orm layer that are, probably, unavoidable  
>> in
>> the current thinking on the "standard" web application stack.  I
>> started to hack the Neo4J python layer into the Django backends but
>> have been working on a different project for the last couple of weeks
>> so I haven't returned to the initial code that I wrote.
> I've had a look at creating a Django database backend using Neo4j as  
> well,
> but the relational assumptions were pretty discouraging. One thought  
> I had
> was to implement a version of the model package (the ORM) that uses  
> Neo4j.
> This would mean that you had to use a different (but very similar)  
> system to
> define the model, but could then use the same application logic. The  
> big
> downside of this is of course that it would not work with the Django  
> Admin
> system, and the Admin system is one of the most appealing features of
> Django.

I ran into a similar conclusion regarding the relational assumptions  
of the orm layer.  This is what made me stop to see if I should  
rethink the strategy.  At the time I was the only person I knew who  
was interested in that approach so there wasn't much impetus behind  
the idea.

> If you think it's possible to create a database backend without  
> having to
> parse SQL that could be an exellent approach.
> And if you would be willing to share the code you have started in that
> direction it would be even better. ;)

I think it's possible but I only spent a day or so on the code so I  
need to make something a bit more usable.

> After my last e-mail I got an idea that I should have gotten  
> earlier: since
> I'm doing a presentation on Jython and Django on Jython on Devoxx  
> next week
> it would be cool to integrate Neo4j in that demo. So I would like to  
> get
> something (that might not be perfect, but that works) up and running  
> by
> then.

I'm running on top of JPype at the moment but I can switch my  
installation back to jython.  I plan on making a very simple Django  
application that uses Neo directly to give myself a little more  
familiarity with Neo's API (have only been writing simple examples).

>> What are your thoughts on integrating below the visible orm level?   
>> To
>> me, it seems quite feasible but would perhaps need some sort of an
>> agreed upon set of relationship types for representing class
>> hierarchies:
>> 1) A standard "IS A" relationship for subclassing/interface
>> implementation [allowing for jython Python-As-Java-Is-Java-As-Python
>> thinking]
>> 2) A standard "HAS A" type applied upon class members, to distinguish
>> class-centric data from more arbitrary graph data
> The "IS A" relation might be a good idea, but I have some doubts on  
> "HAS A",
> since it would require linear scanning for members. But for the
> read-modify-write approach of an ORM this whould be acceptable.

Is there any other way to decorate node properties so that they are  
classifiable as "class level"?  I'm just thinking of how Neo could act  
as an orm layer so forgive me if the perspective is one-directional.

I started the shell of a Neo admin app in one of my Django  
installations.  I'll work on it as times permits.

Thanks for the reply,


More information about the User mailing list