<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Armbruster IT Blog &#187; neo4j</title>
	<atom:link href="http://blog.armbruster-it.de/tag/neo4j/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.armbruster-it.de</link>
	<description>Real world fun with Java, Grails, Groovy, Zope, Plone, Linux and much others.</description>
	<lastBuildDate>Fri, 30 Jul 2010 17:09:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Grails Neo4j plugin 0.3 released</title>
		<link>http://blog.armbruster-it.de/2010/07/grails-neo4j-plugin-0-3-released/</link>
		<comments>http://blog.armbruster-it.de/2010/07/grails-neo4j-plugin-0-3-released/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 17:09:46 +0000</pubDate>
		<dc:creator>Stefan Armbruster</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[neo4j]]></category>

		<guid isPermaLink="false">http://blog.armbruster-it.de/?p=159</guid>
		<description><![CDATA[Today I released an update of the Grails Neo4j plugin (http://www.grails.org/plugin/neo4j). The main changes are:

compatibility with Grails 1.3.x. Be aware, Grails 1.3 &#8211; 1.3.3 are suffering from http://jira.codehaus.org/browse/GRAILS-6427, so either use Grails 1.2.x, or be brave and use a recent git build of Grails 1.3.4.SNAPSHOT.
usage of Neo4j 1.1 (released today just a few hours ago, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I released an update of the Grails Neo4j plugin (<a href="http://www.grails.org/plugin/neo4j">http://www.grails.org/plugin/neo4j</a>). The main changes are:</p>
<ul>
<li>compatibility with Grails 1.3.x. Be aware, Grails 1.3 &#8211; 1.3.3 are suffering from <a href="http://jira.codehaus.org/browse/GRAILS-6427">http://jira.codehaus.org/browse/GRAILS-6427</a>, so either use Grails 1.2.x, or be brave and use a recent git build of Grails 1.3.4.SNAPSHOT.</li>
<li>usage of Neo4j 1.1 (released today just a few hours ago, so get it while it&#8217;s hot).</li>
</ul>
<p>All changes:</p>
<ul>
<li>[GRAILSPLUGINS-2302] &#8211; &#8220;home&#8221; link broken in the org.codehaus.groovy.grails.plugins.neo4j.Neo4jController views</li>
<li>[GRAILSPLUGINS-2303] &#8211; Problems with annotation Neo4jEntity</li>
<li>[GRAILSPLUGINS-2345] &#8211; upgrade to Neo4j 1.1</li>
<li>[GRAILSPLUGINS-2346] &#8211; &lt;domainclass&gt;.get() throws exception if id is not invalid</li>
<li>[GRAILSPLUGINS-2347] &#8211; &lt;domainClass&gt;.findAllBy&lt;Field&gt;(value) fails</li>
<li>[GRAILSPLUGINS-2349] &#8211; provide compatibility for Grails 1.3.x</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.armbruster-it.de/2010/07/grails-neo4j-plugin-0-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grails Neo4j plugin 0.2.1 released</title>
		<link>http://blog.armbruster-it.de/2010/04/grails-neo4j-plugin-0-2-1-released/</link>
		<comments>http://blog.armbruster-it.de/2010/04/grails-neo4j-plugin-0-2-1-released/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 10:08:11 +0000</pubDate>
		<dc:creator>Stefan Armbruster</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[neo4j]]></category>

		<guid isPermaLink="false">http://blog.armbruster-it.de/?p=130</guid>
		<description><![CDATA[Today I released a minor update of the Grails Neo4j plugin. The changes are:

performance improvement by no longer calling map constructor in createInstanceForNode
fixed transaction handling by replacing interceptor with a &#8220;real&#8221; servlet filter
support for primitve arrays as properties in domain classes
bugfix: handling of bidirectional many-to-many relationships
bugfix: setProperties does no longer null out properties that have [...]]]></description>
			<content:encoded><![CDATA[<p>Today I released a minor update of the <a href="http://www.grails.org/plugin/neo4j">Grails Neo4j plugin</a>. The changes are:</p>
<ul>
<li>performance improvement by no longer calling map constructor in createInstanceForNode</li>
<li>fixed transaction handling by replacing interceptor with a &#8220;real&#8221; servlet filter</li>
<li>support for primitve arrays as properties in domain classes</li>
<li>bugfix: handling of bidirectional many-to-many relationships</li>
<li>bugfix: setProperties does no longer null out properties that have not been set</li>
<li>support for encodeAsXXXX methods from CodecsGrailsPlugin. In previous versions encoding did not work, since the &#8216;node&#8217;<br />
property of the domain classes could not be encoded (it&#8217;s a neo4j internal class!). Workaround: add getNode()==null method<br />
in AST transformation.</li>
</ul>
<p>Everyone using the 0.2 release is recommended to upgrade.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.armbruster-it.de/2010/04/grails-neo4j-plugin-0-2-1-released/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Grails Neo4j plugin 0.2 released</title>
		<link>http://blog.armbruster-it.de/2010/03/grails-neo4j-plugin-0-2-released/</link>
		<comments>http://blog.armbruster-it.de/2010/03/grails-neo4j-plugin-0-2-released/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 16:15:22 +0000</pubDate>
		<dc:creator>Stefan Armbruster</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[neo4j]]></category>

		<guid isPermaLink="false">http://blog.armbruster-it.de/?p=87</guid>
		<description><![CDATA[Today an important update of the Grails Neo4j plugin has been released. Neo4j is a graph database, it&#8217;s main concepts are described in brevity in a previous post.  The plugin provides a convenient way to use Neo4j as a persistence layer for Grails domain classes.
The key features / changes of this release are:

domain classes managed [...]]]></description>
			<content:encoded><![CDATA[<p>Today an important update of the <a href="http://www.grails.org/plugin/neo4j">Grails Neo4j plugin</a> has been released. <a href="http://www.neo4j.org">Neo4j</a> is a graph database, it&#8217;s main concepts are described in brevity in a <a href="http://blog.armbruster-it.de/2009/10/neo4j-grails-plugin/">previous post</a>.  The plugin provides a convenient way to use Neo4j as a persistence layer for Grails domain classes.</p>
<p>The key features / changes of this release are:</p>
<ul>
<li>domain classes managed by Neo4j can now co-existing with traditional domain classes (aka mapped by Hibernate)</li>
<li>Upgrade to Neo4j 1.0</li>
<li>usage of Grails dependency resolution instead of embedding the jars in /lib directory</li>
<li>added a seperate controller to inspect the Neo4j node space</li>
<li>major refactoring using AST transformation, just like in the couchdb plugin</li>
<li>support for the <a href="http://components.neo4j.org/index-util/">Neo4j indexer</a></li>
<li>support for non-declared properties</li>
<li>support for traversers</li>
</ul>
<p><span id="more-87"></span>In more detail:</p>
<h2>Co-existence with other domain implementations</h2>
<p>In the initial 0.1 release there was no possibility to have hibernate-based domain classes and neo4j-bases domain classes within the same application. By massively learning from the implementation of the <a href="http://www.grails.org/plugin/gorm-couchdb">CouchDB plugin</a>, the neo4j plugin shares now the same principles:</p>
<ul>
<li>each domain class annotated with &#8220;@Neo4jEntity&#8221; is managed by Neo4j</li>
<li>the @Neo4jEntity  annotation triggers a <a href="http://groovy.codehaus.org/Local+AST+Transformations">Groovy AST transformation</a> at compile time. This transformation e.g. injects a reference to the Neo4j node instance in each domain class.</li>
<li>the plugin class delegates most of its work to a singleton-style plugin support class</li>
<li>the plugin support class uses Groovy MOP to inject (most of) the GORM methods into the domain classes</li>
</ul>
<h2>Upgrade to Neo4j 1.0</h2>
<p>About two weeks ago, the Neo4j team released their 1.0 version. In order to keep pace, the 0.2 version of the plugin upgrades to this version.</p>
<h2>Using dependency resolution</h2>
<p>In its recent versions Grails provides a powerful <a href="http://grails.org/doc/latest/guide/3.%20Configuration.html#3.7%20Dependency%20Resolution">dependency resolution DSL</a>. Using this feature, the Neo4j plugin does not contain the neo4j jars itself any longer. Instead they are automatically downloaded upon plugin installation from the Neo4j&#8217;s maven repository.</p>
<h2>Controller for visualizing the node space</h2>
<p>The plugin contains a Neo4jController that provides an easy way to inspect and walk through the nodespace. All the properties and relationships are visible and navigable, see the screenshot. <a href="http://blog.armbruster-it.de/wp-content/uploads/2010/03/Bildschirmfoto-explore-node-space-Mozilla-Firefox.png"><img class="alignnone size-full wp-image-90" title="Screenshot Neo4jController" src="http://blog.armbruster-it.de/wp-content/uploads/2010/03/Bildschirmfoto-explore-node-space-Mozilla-Firefox.png" alt="Screenshot Neo4jController" width="718" height="436" /></a></p>
<p>Aside from navigating through the nodespace, the Neo4jController also provides an action for viewing some statistics: counting nodes an relationship by type, and an inspector for viewing the Grails domain class structure. One word of warning: <strong>do not expose this controller to the public!</strong> Instead use e.g. the acegi plugin and protect it from public access.</p>
<h2>Support for Neo4j Indexer</h2>
<p>Since there is no easy way to ask the nodespace questions like &#8220;Give me all cars with more than 250 hp?&#8221;, Neo4j provides an <a href="http://components.neo4j.org/index-util/">addon</a> that indexes property values. The plugin supports this in two ways:</p>
<ul>
<li>Defining index properties in a domain class by annotating the properties to be indexed with @Neo4jIndexed</li>
<li>Using the indexer when the GORM methods &#8216;findBy&lt;prop&gt;&#8217; or &#8216;findAllBy&lt;prop&gt;&#8217; are called on an indexed property</li>
</ul>
<p>The following code example will make that clearer:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">grails.plugins.neo4j.*</span>
@Neo4jEntity
<span style="color: #000000; font-weight: bold;">class</span> Car <span style="color: #66cc66;">&#123;</span>
   <span style="color: #aaaadd; font-weight: bold;">String</span> licenseTag <span style="color: #808080; font-style: italic;">// normal, aka non-indexed property</span>
   @Neo4jIndex
   <span style="color: #aaaadd; font-weight: bold;">String</span> color  <span style="color: #808080; font-style: italic;">// indexed property</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h2>Support for non-declared properties</h2>
<p>Since Neo4j is a schema-less database, there is no limitation on what properties are allowed for a certain node. A Grails domain model is much more strict on this. To fill this gap, the plugin supports non-declared properties:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">def</span> car <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Car<span style="color: #66cc66;">&#40;</span>licenseTag:<span style="color: #ff0000;">'ABC123'</span>, color:<span style="color: #ff0000;">'red'</span><span style="color: #66cc66;">&#41;</span>
car.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #000000; font-weight: bold;">assert</span> <span style="color: #ff0000;">'red'</span> <span style="color: #66cc66;">==</span> car.<span style="color: #006600;">color</span> <span style="color: #808080; font-style: italic;">// declared property</span>
<span style="color: #000000; font-weight: bold;">assert</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">=</span> car.<span style="color: #006600;">numberOfSeats</span> <span style="color: #808080; font-style: italic;">// N.B: numberOfSeats is _not_ declared</span>
car.<span style="color: #006600;">numberOfSeats</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">5</span>
<span style="color: #000000; font-weight: bold;">assert</span> <span style="color: #ff0000;">'5'</span> <span style="color: #66cc66;">==</span> car.<span style="color: #006600;">numberOfSeats</span></pre></div></div>

<p>Using non-declared properties has one limitation: since there&#8217;s no type information available, they are stored as String. That&#8217;s why the last assert need &#8216;5&#8242; in quotes.</p>
<h2>Support for traversers</h2>
<p>A very powerful method to search and find nodes in the nodespace are <a href="http://wiki.neo4j.org/content/Design_Guide#Searching_using_traversing">traversers</a>. The plugin supports them on two levels:</p>
<ul>
<li>static:  DomainClass.traverse uses the reference node as starting point and</li>
<li>instance: &lt;domainClassInstance&gt;.traverse uses the domainClassInstance as starting point.</li>
</ul>
<p>Both variants come with some overloaded implementations:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">traverse<span style="color: #66cc66;">&#40;</span>StopEvaluator stopEvaluator, ReturnableEvaluator returnableEvaluator, <span style="color: #aaaadd; font-weight: bold;">Object</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>
traverse<span style="color: #66cc66;">&#40;</span>Traverser.<span style="color: #006600;">Order</span> order, StopEvaluator stopEvaluator, ReturnableEvaluator returnableEvaluator, <span style="color: #aaaadd; font-weight: bold;">Object</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>
traverse<span style="color: #66cc66;">&#40;</span>Closure stopEvaluator, Closure returnableEvaluator, <span style="color: #aaaadd; font-weight: bold;">Object</span>... <span style="color: #006600;">arg</span><span style="color: #66cc66;">&#41;</span>
traverse<span style="color: #66cc66;">&#40;</span>Traverser.<span style="color: #006600;">Order</span> order, Closure stopEvaluator, Closure returnableEvaluator, <span style="color: #aaaadd; font-weight: bold;">Object</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Note that StopEvaluators and ReturnableEvaluator might be coded in a <a href="http://groovy.codehaus.org/Groovy+way+to+implement+interfaces">&#8216;groovy&#8217; way as closures</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">def</span> traverser <span style="color: #66cc66;">=</span> car.<span style="color: #006600;">traverse</span><span style="color: #66cc66;">&#40;</span>
 <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#125;</span>,  <span style="color: #808080; font-style: italic;">// StopEvaluator</span>
 <span style="color: #66cc66;">&#123;</span> it.<span style="color: #006600;">currentNode</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getProperty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;color&quot;</span>,<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">==</span><span style="color: #ff0000;">&quot;red&quot;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #808080; font-style: italic;">// ReturnableEvaluator</span>
<span style="color: #66cc66;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.armbruster-it.de/2010/03/grails-neo4j-plugin-0-2-released/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Example for using Neo4j with Grails</title>
		<link>http://blog.armbruster-it.de/2009/10/example-neo4j-with-grails/</link>
		<comments>http://blog.armbruster-it.de/2009/10/example-neo4j-with-grails/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 20:06:52 +0000</pubDate>
		<dc:creator>Stefan Armbruster</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[neo4j]]></category>

		<guid isPermaLink="false">http://blog.armbruster-it.de/?p=33</guid>
		<description><![CDATA[In reply to my today&#8217;s annoncement of the Neo4j Grails plugin, @StigLau asked me to provide an example for using the Neo4j Grails plugin. So here we go:

Create your sample application:

grails create-app neo4jtest; cd neo4jtest


Add the Neo4j plugin:

grails install-plugin neo4j


create some sample domain classes:

grails create-domain-class Author
grails create-domain-class Book


create a controller for the domain class

grails create-controller [...]]]></description>
			<content:encoded><![CDATA[<p>In reply to my today&#8217;s <a href="http://blog.armbruster-it.de/2009/10/neo4j-grails-plugin/">annoncement</a> of the Neo4j Grails plugin, <a href="http://twitter.com/StigLau">@StigLau</a> asked me to provide an example for using the Neo4j Grails plugin. So here we go:</p>
<ol>
<li>Create your sample application:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">grails create-app neo4jtest; <span style="color: #7a0874; font-weight: bold;">cd</span> neo4jtest</pre></div></div>

</li>
<li>Add the Neo4j plugin:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">grails install-plugin neo4j</pre></div></div>

</li>
<li>create some sample domain classes:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">grails create-domain-class Author
grails create-domain-class Book</pre></div></div>

</li>
<li>create a controller for the domain class

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">grails create-controller Author
grails create-controller Book</pre></div></div>

</li>
<li>modify the domain classes:

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">grails.plugins.neo4j.Neo4jEntity</span>
@Neo4jEntity
<span style="color: #000000; font-weight: bold;">class</span> Author <span style="color: #66cc66;">&#123;</span>
    <span style="color: #aaaadd; font-weight: bold;">String</span> name
    <span style="color: #aaaadd; font-weight: bold;">Date</span> dob
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> hasMany <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span> books: <span style="color: #aaaadd; font-weight: bold;">Book</span> <span style="color: #66cc66;">&#93;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">grails.plugins.neo4j.Neo4jEntity</span>
@Neo4jEntity
<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #aaaadd; font-weight: bold;">Book</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #aaaadd; font-weight: bold;">String</span> title
    <span style="color: #000000; font-weight: bold;">static</span> belongsTo <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>author:Author<span style="color: #66cc66;">&#93;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

</li>
<li>modify the controller to use dynamic scaffolding:

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> AuthorController <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">def</span> scaffold <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">true</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> BookController <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">def</span> scaffold <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">true</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

</li>
<li>start up the application:

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">grails run<span style="color: #66cc66;">-</span>app</pre></div></div>

</li>
<li>use it, love it: go to <a href="http://localhost:8080/neo4jtest">http://localhost:8080/neo4jtest</a>, add some authors and books.</li>
<li>to explore the Neo4j node space created with your grails app, check out <a href="http://wiki.neo4j.org/content/Neoclipse_Guide">Neoclipse</a>.</li>
</ol>
<p><strong>UPDATE: </strong>Use Grails 1.2.1</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.armbruster-it.de/2009/10/example-neo4j-with-grails/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Neo4j Grails Plugin</title>
		<link>http://blog.armbruster-it.de/2009/10/neo4j-grails-plugin/</link>
		<comments>http://blog.armbruster-it.de/2009/10/neo4j-grails-plugin/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 14:55:58 +0000</pubDate>
		<dc:creator>Stefan Armbruster</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[neo4j]]></category>

		<guid isPermaLink="false">http://blog.armbruster-it.de/?p=22</guid>
		<description><![CDATA[Today I released the first version of the  Neo4j Grails plugin. The plugin&#8217;s goal is to provide an alternative approach for storing Grails domain classes: in the Neo4j database.
Neo4j is a relative new and very interesting approach for persitence in a non-SQLish way. Neo4j is a graph database and uses the concept of
Nodes
A node is [...]]]></description>
			<content:encoded><![CDATA[<p>Today I released the first version of the  <a href="http://grails.org/plugin/neo4j">Neo4j Grails plugin</a>. The plugin&#8217;s goal is to provide an alternative approach for storing Grails domain classes: in the Neo4j database.</p>
<p><a href="http://www.neo4j.org">Neo4j</a> is a relative new and very interesting approach for persitence in a non-SQLish way. Neo4j is a graph database and uses the concept of</p>
<h5>Nodes</h5>
<p>A node is the basic building block. It normally represents a &#8220;something&#8221;, a entity.</p>
<h5>Relationships</h5>
<p>Relationsships are associations between nodes. Each relationship connects exactly two nodes. Relationsships have a direction: incoming, outgoing or both.</p>
<h5>Properties</h5>
<p>Each node or relationship might contain a set of properties. A property has a name (String) and a value (primitive datatype). Complex value are not allowed for properties.</p>
<p>This is completely different from the SQL approach. There are no tables, columns, indexes, and other stuff we&#8217;ve dealt with for years. Somewhat crucial is the way how to organize the node space. Neo4j gives some advice <a href="http://wiki.neo4j.org/content/Design_Guide">here</a>.</p>
<p>Neo4j itself uses the <a href="http://http://www.gnu.org/licenses/agpl.html">AGPL</a> license, the plugin is licensed the <a href="http://sam.zoy.org/wtfpl/">WTFPL</a>.</p>
<h2>How the plugin works</h2>
<p>Using Groovy&#8217;s metaprogramming capabilities, the basic <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a>-methods list, save, get and delete are added transparently to each domain class. In addition, each domain instance gets a &#8216;node&#8217; property referencing the associated Neo4j <a href="http://api.neo4j.org/current/org/neo4j/api/core/Node.html">Node</a>.</p>
<p>For each domain class a subreference node is created related to the reference aka root node. Each domain instance holds a relation to it&#8217;s subreference node. For non-primitive properties, either relations to other domain nodes are used or they are converted to strings using the Spring&#8217;s PropertyEditor approach.</p>
<p>Aside from this, the plugin starts up and closes the Neo4j database. The database&#8217;s path is configured using the grails.neo4j.storeDir property in Config.groovy.</p>
<h2>Howto use the plugin</h2>
<p>The plugin can be used transparently in a Grails application. The only thing you have to do is to remove the hibernate plugin and install the neo4j plugin:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">grails uninstall-plugin hibernate
grails install-plugin neo4j</pre></td></tr></table></div>

<p>Add some domain classes and controllers with scaffolding &#8211; they should work.</p>
<h2>What currently works</h2>
<ul>
<li>basic CRUD operations on domain classes</li>
<li>one-to-one, one-to-many, many-to-one and many-to-many relations of domain classes</li>
<li>the current implementation supports scaffolding</li>
<li>Together with the acegi plugin, you can store your user, role and requestmap information in neo4j. Since the default UserDetailsService relies on Hibernate&#8217;s SessionFactory you have to use a custom UserDetailsService to get this working.</li>
</ul>
<h2>What&#8217;s still missing (and hopefully will be added in upcoming releases)</h2>
<ul>
<li>currently all constraints are ignored</li>
<li>only a subset of the domain methods are implemented</li>
<li>dynamic finders have only a very basic support: just DomainClass.findBy[Property](value) works so far</li>
</ul>
<h2>New planned features</h2>
<ul>
<li>SVG controller/views to display the complete object graph, just like Neoclipse does.</li>
<li>Gant scripts for automatically snapshotting and restoring the database</li>
<li>Criteria queries implemented using Neo4j traversers</li>
</ul>
<p>Any feedback is appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.armbruster-it.de/2009/10/neo4j-grails-plugin/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
