I have been using Neo4j with the Play framework. You may be interested to
know that I wrote a plugin module, however, I will have to wait until this
weekend to release it. I'm not yet happy with the way my plugin connects to
multiple embedded databases.

With the Play framework you will likely want to wrap you graph model into
Java classes. That will get you automatic HTTP parameter binding to your
objects when they are used as arguments in controller methods.
http://www.playframework.org/documentation/1.2.3/controllers#binding

To wrap your graph database model into Java classes, start here
http://wiki.neo4j.org/content/Design_Guide#How_to_wrap_nodes_in_POJOs.

If you pass node Ids with you HTML forms and HTTP requests you do not need
an index lookup, but often you will probably not want to pass node Ids
directly. Regardless, you need to validate that the current user has access
to modify that portion of the model. You can use the secure module for that
http://www.playframework.org/documentation/1.2.3/secure.

When you need to take an HTTP request and the Java object arguments you
receive that and identify that with the nodes and relationships in the
database you can do an index lookup
http://wiki.neo4j.org/content/Design_Guide#Searching_by_index. When you have
validated the users security access and identified an HTTP argument reliably
to the corresponding nodes and relationships in the database you can write
the new parameter values to nodes in database and create or delete nodes and
relationships. How tightly you couple that with your object model is up to
you.

Be aware that I recently had a problem with the Play framework not accepting
a List<> member on my top level HTTP parameter. That scenario would probably
be very common in a graph to Java object model. Seek me out if you have a
problem with that and I'll take the time to track the bug down and patch it.
I worked around it by putting the List<> argument top level with the main
argument and assigning it to the main member just inside the controller
method.

I hope you will try out Play and Neo4j together and please post more
questions when you have them.

Thanks,

McKinley


On Thu, Sep 15, 2011 at 3:36 AM, deviantCode <hnoclel...@gmail.com> wrote:

> Hi guys,
> Has anybody successfully used neo for a play framework project? I am new to
> both of these and would really appreciate an example project that does that
> or uses some mvc framework.
>
> I want to know how to design my models within play to be persisted to neo.
> for a sample project
>
> Models will be:
> User:[userid, name, num, .....]
> Item, : [itemid, name, provider,]
>
> Relatioships are:  knows, likes, bought,
>
> i want to be able to do usera--knows--- userb; usera---likes---itema;
> userb----bought itema
> this i want to do very simply with playframework.
>
> Also i want to know how to index on for instance item.provider.
>
>
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to