<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8978951075400478206</id><updated>2026-05-29T19:02:16.302+05:30</updated><category term="neo4j"/><category term="code"/><category term="coding"/><category term="heroku"/><category term="java"/><category term="nosql"/><category term="programming"/><category term="HTML"/><category term="appengine"/><category term="browser"/><category term="coding practices"/><category term="cypher"/><category term="firefox"/><category term="firefox internet explorer browser firebug DOM CSS HTML inspector"/><category term="flavorwocky"/><category term="gae"/><category term="grails"/><category term="java rest binding"/><category term="javascript"/><category term="neo4jchallenge"/><category term="service oriented analysis and design"/><category term="soad"/><category term="technology"/><category term="testing"/><category term="unit test"/><category term="EJB3 JPA Hibernate HSQLDB Hello World"/><category term="WrappingNeoServerBootstrapper"/><category term="ajp"/><category term="annotations"/><category term="apache"/><category term="arbor.js"/><category term="attach events"/><category term="batching"/><category term="coding standards"/><category term="coverage"/><category term="cypher jdbc driver"/><category term="d3.js"/><category term="design"/><category term="embedded neo4j"/><category term="equals"/><category term="exceptions"/><category term="experience commerce"/><category term="functional test"/><category term="graphAware framework"/><category term="graphUnit"/><category term="graphical org chart"/><category term="graphical organization chart"/><category term="graphs"/><category term="heroku grails neo4j"/><category term="ide"/><category term="ie"/><category term="img"/><category term="installing multiple tomcat instances on windows"/><category term="integration"/><category term="intern"/><category term="internet explorer"/><category term="jdbc"/><category term="jsp"/><category term="load balancing"/><category term="marker interface"/><category term="maven tips workarounds local repository skiptests"/><category term="mod jk"/><category term="multiple simultaneous user sessions"/><category term="multiple tomcat instances"/><category term="neo4j jdbc driver"/><category term="no src"/><category term="object oriented analysis and design"/><category term="onload"/><category term="ooad"/><category term="optimization"/><category term="org chart"/><category term="page loads twice"/><category term="page reloads"/><category term="pageXOffset"/><category term="pageYOffset"/><category term="performance"/><category term="performance tuning"/><category term="pseudocode"/><category term="recommendation engine"/><category term="refactoring"/><category term="runtime exceptions"/><category term="scroll position"/><category term="scrollLeft"/><category term="scrollTop"/><category term="services"/><category term="stringbuffer"/><category term="strings"/><category term="tomcat 5.5"/><category term="visualization"/><category term="window"/><category term="zapier"/><category term="zimoz postcard web2.0"/><title type='text'>Thought Bytes</title><subtitle type='html'>Technology 1&#39;s and 0&#39;s</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>38</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-3056438993042265573</id><published>2014-11-10T10:39:00.002+05:30</published><updated>2014-11-10T10:39:58.934+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="embedded neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="WrappingNeoServerBootstrapper"/><title type='text'>Using the Neo4j browser with Embedded Neo4j </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;There are times when you have an application using Neo4j in &lt;a href=&quot;http://neo4j.com/docs/2.1.5/tutorials-java-embedded.html&quot; target=&quot;_blank&quot;&gt;embedded mode&lt;/a&gt; but also need to play around with the graph using&amp;nbsp;the Neo4j web browser. Since the database can be accessed from at most one process at a time, trying to start up the Neo4j server&amp;nbsp;when your embedded Neo4j &amp;nbsp;application is running won&#39;t work.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The WrappingNeoServerBootstrapper, although deprecated, comes to the rescue.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Here&#39;s how to set it up.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;1. Make sure you have these maven dependencies-&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;div class=&quot;highlight&quot;&gt;
&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.neo4j&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;neo4j&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.1.5&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.neo4j.app&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;neo4j-server&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.1.5&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.neo4j.app&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;neo4j-server&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.1.5&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;classifier&amp;gt;&lt;/span&gt;static-web&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/classifier&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;



&lt;/div&gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;2. Start the WrappingNeoServerBootstrapper&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&lt;span style=&quot;color: #008f00;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008f00;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #c01e51;&quot;&gt;void&lt;/span&gt; connectAndStartBootstrapper&lt;span style=&quot;color: #797979;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #797979;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; WrappingNeoServerBootstrapper neoServerBootstrapper&lt;span style=&quot;color: #797979;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; GraphDatabaseService db &lt;span style=&quot;color: #797979;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008f00;&quot;&gt;new&lt;/span&gt; GraphDatabaseFactory&lt;span style=&quot;color: #797979;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #8f9f36; font-family: Courier; font-size: 14px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;newEmbeddedDatabaseBuilder&lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #c8352b;&quot;&gt;&quot;/path/to/db&quot;&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;).&lt;/span&gt;newGraphDatabase&lt;span style=&quot;color: #797979;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; registerShutdownHook&lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;db&lt;span style=&quot;color: #797979;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px; min-height: 14px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #008f00;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #797979;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GraphDatabaseAPI api &lt;span style=&quot;color: #797979;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;GraphDatabaseAPI&lt;span style=&quot;color: #797979;&quot;&gt;)&lt;/span&gt; db&lt;span style=&quot;color: #797979;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px; min-height: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ServerConfigurator config &lt;span style=&quot;color: #797979;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008f00;&quot;&gt;new&lt;/span&gt; ServerConfigurator&lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;api&lt;span style=&quot;color: #797979;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; config&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #8f9f36;&quot;&gt;configuration&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #8f9f36; font-family: Courier; font-size: 14px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;addProperty&lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Configurator&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;WEBSERVER_ADDRESS_PROPERTY_KEY&lt;span style=&quot;color: #797979;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #c8352b;&quot;&gt;&quot;127.0.0.1&quot;&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; config&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #8f9f36;&quot;&gt;configuration&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #8f9f36; font-family: Courier; font-size: 14px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;addProperty&lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Configurator&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;WEBSERVER_PORT_PROPERTY_KEY&lt;span style=&quot;color: #797979;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #c8352b;&quot;&gt;&quot;7575&quot;&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; neoServerBootstrapper &lt;span style=&quot;color: #797979;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008f00;&quot;&gt;new&lt;/span&gt; WrappingNeoServerBootstrapper&lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;api&lt;span style=&quot;color: #797979;&quot;&gt;,&lt;/span&gt; config&lt;span style=&quot;color: #797979;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; neoServerBootstrapper&lt;span style=&quot;color: #797979;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #8f9f36;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #008f00;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: #797979;&quot;&gt;(&lt;/span&gt;Exception e&lt;span style=&quot;color: #797979;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #797979;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f9192; font-family: Courier; font-size: 14px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;i&gt;//handle appropriately&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #797979;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Courier; font-size: 14px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #797979; font-family: Courier; font-size: 14px;&quot;&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Two things happen here- the GraphDatabaseService is ready to use in embedded mode, and the Neo4j web browser is available for use on http://127.0.0.1:7575/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;You need not start them together but instead start and stop the WrappingNeoServerBootstrapper on demand, you just need to have a handle to the GraphDatabaseService.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Again, note that the WrappingNeoServerBootstrapper is deprecated. At the time of writing, this code works on 2.1.5 but does not offer any guarantees for future releases of Neo4j.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;-Luanne&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/3056438993042265573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/3056438993042265573' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/3056438993042265573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/3056438993042265573'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2014/11/using-neo4j-browser-with-embedded-neo4j.html' title='Using the Neo4j browser with Embedded Neo4j '/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-880808900674804841</id><published>2014-07-18T00:00:00.000+05:30</published><updated>2014-11-08T18:32:13.219+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="integration"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="zapier"/><title type='text'>Integrate apps with Neo4j using Zapier</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Recently, I was directed to &lt;a href=&quot;http://www.zapier.com/&quot; target=&quot;_blank&quot;&gt;Zapier&lt;/a&gt; to get some lightweight integration done between systems for a quick proof of concept. Initially skeptical, I found that it really could save time and tie together all those pieces of your system you never got around to integrating.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Moreover, it is a way for people to integrate the applications they use without having to code or pay a developer to do it for you. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-b916ef4e-4587-8bb7-c8b2-386a4efe1f7c&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Going through the &lt;a href=&quot;https://zapier.com/zapbook/&quot; target=&quot;_blank&quot;&gt;Zapbook&lt;/a&gt;, I found MongoDB, MySQL, Postgresql, SQL Server and gasp! no Neo4j. Sad :-(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;I already had a potential use case which was to collect data via a form and get it into Neo4j ASAP i.e. no coding. Google Forms is available on Zapier, so I went about making Neo4j available as well. I’ve now got a first version zap ready for Neo4j which allows one to collect data triggered by another zap, and save it to Neo4j via a Cypher statement.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Here’s what it looks like. Using the Google Forms example, I’ve set up a form to capture feedback about a product and I want to push this data into Neo4j every time the form is submitted. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 1:&lt;/b&gt; Log into Zapier, click on Make a Zap!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 2:&lt;/b&gt; The triggering app is Google Docs, where we want to save data to Neo4j every time a form is filled i.e. the spreadsheet backing the form has a new row inserted.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The Neo4j zap currently supports only one action- Update the graph.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEGUdg-_AKblQK1WqLtVI3pKjDNSW_0NU9Nz7XOw4s-dZ7ccFieibc7ka2hGUl3diyKHqb1bU6euxvlsiGhyEDgAcJ2dcoB_e3luNwBz1tWLkSEnI-hIVDEGVrsFA2Gf9kOcA7BU3EkmE/s1600/step1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEGUdg-_AKblQK1WqLtVI3pKjDNSW_0NU9Nz7XOw4s-dZ7ccFieibc7ka2hGUl3diyKHqb1bU6euxvlsiGhyEDgAcJ2dcoB_e3luNwBz1tWLkSEnI-hIVDEGVrsFA2Gf9kOcA7BU3EkmE/s1600/step1.jpg&quot; height=&quot;192&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Step 3: Follow the instructions to make sure Zapier can access your Google Docs account&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;div style=&quot;line-height: 1.15;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Step 4: Set up a Neo4j account. Call it whatever you like, supply the username, password and URL. Note that in this version, the assumption is that your Neo4j database is not left open to the world. I used the &lt;a href=&quot;https://github.com/neo4j-contrib/authentication-extension&quot; target=&quot;_blank&quot;&gt;Authentication extension&lt;/a&gt; to set mine up. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 17px; white-space: pre-wrap;&quot;&gt;Make sure you don&#39;t have a trailing / in the Neo4j Server URL. http://&lt;host&gt;:&lt;port&gt;/db/data is valid, &lt;/port&gt;&lt;/host&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; line-height: 17px; white-space: pre-wrap;&quot;&gt; http://&lt;host&gt;:&lt;port&gt;/db/data/ is not!&lt;/port&gt;&lt;/host&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYOtizMWJjQqmNPRFDShXVTc8ftxCwqnIXiVhRpSgSB5WVRTZANzWs1A9Sr02B_JtQ5jO7BhE4Z7AUc3eiKmnEZoswFGQMFkRxcNnSs701KMhfKezA6Ub1LaVVJjlLh0EQEH3NA6RJe_A/s1600/step2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYOtizMWJjQqmNPRFDShXVTc8ftxCwqnIXiVhRpSgSB5WVRTZANzWs1A9Sr02B_JtQ5jO7BhE4Z7AUc3eiKmnEZoswFGQMFkRxcNnSs701KMhfKezA6Ub1LaVVJjlLh0EQEH3NA6RJe_A/s1600/step2.jpg&quot; height=&quot;497&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Click on Continue and make sure Zapier confirms that it can indeed access your Neo4j database&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7lTJDxfGzRghbP7ePlNyK_TUdROc4dbGa-VnEUIWAAH4i5Mtg3NBn6KhEwfOJJQiaFVsKkeVwilAzZS-bg8MlhTgmiC99Sot1hBccOc17bPF9lFMG7H_5jS0de3Ov6t0RcgZJwkDz9Io/s1600/step3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7lTJDxfGzRghbP7ePlNyK_TUdROc4dbGa-VnEUIWAAH4i5Mtg3NBn6KhEwfOJJQiaFVsKkeVwilAzZS-bg8MlhTgmiC99Sot1hBccOc17bPF9lFMG7H_5jS0de3Ov6t0RcgZJwkDz9Io/s1600/step3.jpg&quot; height=&quot;168&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Step 5: Select your spreadsheet and the Worksheet that contains the data. Here’s what my spreadsheet looks like-&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1G3UjQkJYeBAlV7qyUPWClU0aQXag68m-5J2Wq8WAI2AHceRP8AcdK2g_zdldT26w4bUxX1T_hLutWKbUi1U6qPavn2hyphenhyphenvGtkIdcpmtNofrV12hg0PzF8Tl6ZzDOoAu5dhIMFv645-Oc/s1600/spreadsheet.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1G3UjQkJYeBAlV7qyUPWClU0aQXag68m-5J2Wq8WAI2AHceRP8AcdK2g_zdldT26w4bUxX1T_hLutWKbUi1U6qPavn2hyphenhyphenvGtkIdcpmtNofrV12hg0PzF8Tl6ZzDOoAu5dhIMFv645-Oc/s1600/spreadsheet.jpg&quot; height=&quot;640&quot; width=&quot;425&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_X7eOIfcS0V4UBBqrsUQycmJkrYA9QzvPN0DOtSKNPrpklwsF8UipE2itXwXcr1GVcCQu9Pi7DdF6U1M7yIZK9qON2xCziRsx5JWPKcY55cDoJvDfp9olpLqewc5g-ita5GI1NoGSATk/s1600/step4.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_X7eOIfcS0V4UBBqrsUQycmJkrYA9QzvPN0DOtSKNPrpklwsF8UipE2itXwXcr1GVcCQu9Pi7DdF6U1M7yIZK9qON2xCziRsx5JWPKcY55cDoJvDfp9olpLqewc5g-ita5GI1NoGSATk/s1600/step4.jpg&quot; height=&quot;472&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Step 6: Write a Cypher query to convert that row into nodes and relationships. You must write a parameterized Cypher query in the Cypher Query field. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;div style=&quot;line-height: 1.15;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The Cypher Parameters must contain a comma separated list of the parameter names used in the query and the field selected from the triggering app (use the Insert Fields button).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1.15;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: transparent; color: black; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b style=&quot;font-size: 15px; font-style: normal; font-variant: normal; line-height: 1.15; text-decoration: none; white-space: pre-wrap;&quot;&gt;Important!&lt;/b&gt;&lt;span style=&quot;font-size: 15px; line-height: 1.15; white-space: pre-wrap;&quot;&gt; The Cypher Query is just that- a &lt;/span&gt;&lt;span style=&quot;font-size: 15px; line-height: 17px; white-space: pre-wrap;&quot;&gt;parameterised Cypher query with no parameter value substitution from your google doc or other trigger. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 17px; white-space: pre-wrap;&quot;&gt;The place that links the parameters with their values from the trigger is the Cypher Parameters field, where you list all your parameters in the form of a comma separated list- key:value, key:value etc. and the value is chosen &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 17px; white-space: pre-wrap;&quot;&gt;from your trigger.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 17px; white-space: pre-wrap;&quot;&gt;The screenshot below represents what this should look like.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDc8YrjR8wv7xrFzshUZF0V5X_qZkxJh1BDAJDWJNE-wQ7YcYmQDNygqaCcN7E-5TeyKWQy9Ay0YA9LwhlSZV2Yr5jAuJG5R8H2-yD1I3XBmfKuXIHdyS94oYwyhut4lRmqfrB37naPMU/s1600/step5.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDc8YrjR8wv7xrFzshUZF0V5X_qZkxJh1BDAJDWJNE-wQ7YcYmQDNygqaCcN7E-5TeyKWQy9Ay0YA9LwhlSZV2Yr5jAuJG5R8H2-yD1I3XBmfKuXIHdyS94oYwyhut4lRmqfrB37naPMU/s1600/step5.jpg&quot; height=&quot;507&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Step 7: See what the trigger and action samples look like- then test it out and celebrate when it says Success!&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBK6-b1kZ4z0_8iSnVwhuMtMCsJgSZqPngYYJTu_ykCLhRtgd53L26Uhap1hdrU-EJadNyVQ8UtqI00RmPuGRVSLXcnodmRv8vzVBeQAdf8k_QP-bnsIkju6UA8JdGIqO3v81ltpQg3Ws/s1600/step6.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBK6-b1kZ4z0_8iSnVwhuMtMCsJgSZqPngYYJTu_ykCLhRtgd53L26Uhap1hdrU-EJadNyVQ8UtqI00RmPuGRVSLXcnodmRv8vzVBeQAdf8k_QP-bnsIkju6UA8JdGIqO3v81ltpQg3Ws/s1600/step6.jpg&quot; height=&quot;640&quot; width=&quot;584&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;I checked what my database looked like at this point and sure enough:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixuUDKh61cKh_C5znuFu-jBBsShS33CFaCRq0bY8JvFiqVSfSDzDIWZIccVtXnEiwpu1q2DFu4WNQCe0whOemR1fpK7En018qynkX6KkPJJHqTQ1_59YZoz0CrudFEBmaDr_otWTTmLeo/s1600/step7.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixuUDKh61cKh_C5znuFu-jBBsShS33CFaCRq0bY8JvFiqVSfSDzDIWZIccVtXnEiwpu1q2DFu4WNQCe0whOemR1fpK7En018qynkX6KkPJJHqTQ1_59YZoz0CrudFEBmaDr_otWTTmLeo/s1600/step7.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;That’s all there is to it. Zapier will poll the triggering app every 15 minutes so by the time all your forms are filled, you have a Neo4j database filled with data! &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;I tried out the MongoDB-&amp;gt;Neo4j and Trello-&amp;gt;Neo4j integration and they worked well.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Whether you need a quick and dirty integration with Neo4j, or you want to collect data from other applications into Neo4j for later analysis, &amp;nbsp;or you’re building a serious application, Zapier could be of use. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;If you’d like to try it out, send @&lt;a href=&quot;http://twitter.com/luannem&quot; target=&quot;_blank&quot;&gt;luannem&lt;/a&gt; a message and I’ll send you a beta invite. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;And if you think this is useful, I’d be happy to hear about it and add more features to the Neo4j zap!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
-Luanne&lt;br /&gt;
&lt;a href=&quot;http://twitter.com/luannem&quot; target=&quot;_blank&quot;&gt;@luannem&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/880808900674804841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/880808900674804841' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/880808900674804841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/880808900674804841'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2014/07/integrate-apps-with-neo4j-using-zapier.html' title='Integrate apps with Neo4j using Zapier'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEGUdg-_AKblQK1WqLtVI3pKjDNSW_0NU9Nz7XOw4s-dZ7ccFieibc7ka2hGUl3diyKHqb1bU6euxvlsiGhyEDgAcJ2dcoB_e3luNwBz1tWLkSEnI-hIVDEGVrsFA2Gf9kOcA7BU3EkmE/s72-c/step1.jpg" height="72" width="72"/><thr:total>0</thr:total><georss:featurename>Mumbai, Maharashtra, India</georss:featurename><georss:point>19.0759837 72.877655900000036</georss:point><georss:box>18.5957917 72.232208900000032 19.556175699999997 73.52310290000004</georss:box></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-888475816048542735</id><published>2014-06-16T10:32:00.000+05:30</published><updated>2014-06-19T15:47:22.551+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="graphAware framework"/><category scheme="http://www.blogger.com/atom/ns#" term="graphUnit"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="unit test"/><title type='text'>Neo4j Unit Testing with GraphUnit</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Testing the state of an Embedded Neo4j database is now much easier if you use &lt;a href=&quot;https://github.com/graphaware/neo4j-framework#graphaware-test&quot; target=&quot;_blank&quot;&gt;GraphUnit&lt;/a&gt;, a component of the &lt;a href=&quot;http://graphaware.com/neo4j/2014/05/28/graph-aware-neo4j-framework.html&quot; target=&quot;_blank&quot;&gt;GraphAware Neo4j Framework&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;I tried replacing an existing &lt;a href=&quot;http://www.flavorwocky.com/&quot; target=&quot;_blank&quot;&gt;Flavorwocky&lt;/a&gt; unit test with GraphUnit to check out the benefits.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Let&#39;s walk through a before-after case study.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The unit test in question is the one to test that a Pairing is saved correctly. A pairing must have exactly two ingredients. Each Ingredient node has a name; a Pairing has an affinity and an array of allAffinities (all affinities ever assigned to the pairing).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUpE02vOPf6JuPxTDyLwFIEe1_D3XqVBTBUHpsv75xfDe7FIkUtwJaB-GMqkGBW4PAzD-jej0LNCzO-EJuoGexlEhUknvt7IrknmgpjODRJFolPioNazZTTb3YVzhrhQEgq_YWvhyIy7Q/s1600/ing.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUpE02vOPf6JuPxTDyLwFIEe1_D3XqVBTBUHpsv75xfDe7FIkUtwJaB-GMqkGBW4PAzD-jej0LNCzO-EJuoGexlEhUknvt7IrknmgpjODRJFolPioNazZTTb3YVzhrhQEgq_YWvhyIy7Q/s1600/ing.jpg&quot; height=&quot;175&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;u&gt;&lt;b&gt;Before&lt;/b&gt;&lt;/u&gt;: Pseudocode to test that my code saved a pairing correctly in Neo4j&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; Execute Cypher statement to find the first Ingredient by name (Chicken)  
   Fail if no results returned  
 Use the core Java API to check that a pairsWith relation exists to another node with label Ingredient and name Garlic  
   Fail if no relation exists  
   Fail if the other Ingredient node has the wrong/missing name  
 Use the core Java API to find the Pairing node from the two ingredient nodes and check that the properties on Pairing are set correctly  
   Fail if the Pairing node was missing or the properties were incorrect  
 Make sure that the graph contains ONLY these nodes and relations and no incorrectly created nodes floating around  
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;That&#39;s quite a bit of code to write just to test a simple structure. And it&#39;s difficult to remember what it does and modify it when you come back to it after a considerably long period of time.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;GraphUnit allows you to compare the entire state of your graph to a subgraph represented in the form of a data-creating Cypher statement.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;u&gt;&lt;b&gt;After&lt;/b&gt;&lt;/u&gt;: Writing a Cypher statement to represent a subgraph with two ingredients and a pairing is very easy, and my test code reduces to&lt;/span&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; String ingredientSubgraph =  
         &quot;create (i1:Ingredient {name: &#39;Chicken&#39;}), (i2:Ingredient {name: &#39;Garlic&#39;}), &quot; +  
         &quot;(i1)&amp;lt;-[:hasIngredient]-(p:Pairing {affinity: 0.45, allAffinities: [0.45]}), &quot; +  
         &quot;(p)-[:hasIngredient]-&amp;gt;(i2) merge (i1)-[:pairsWith]-(i2)&quot;;  
 GraphUnit.assertSameGraph(getGraphDb(), ingredientSubgraph);  
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #333333; line-height: 16px;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #333333; line-height: 16px;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;This will make sure that my graph contains nothing but the nodes and relations created by the Cypher statement, and that every property matches exactly. Pretty cool.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;GraphUnit exposes another method to match the existence of a subgraph in the entire graph. This will &amp;nbsp;verify only the subgraph specified and ignore other nodes and relations.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; GraphUnit.assertSubgraph(getGraphDb(), ingredientSubgraph);  
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Check out the &lt;a href=&quot;https://github.com/luanne/flavorwockyGraphUnit/blob/master/src/test/java/com/flavorwocky/domain/pairing/PairingTest.java&quot; target=&quot;_blank&quot;&gt;entire test&lt;/a&gt; in a simplified version of the flavorwocky project.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Note at this point in time, GraphUnit requires a handle to org.neo4j.graphdb.GraphDatabaseService hence it currently supports testing against an Embedded or Impermanent graph database.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Update:&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Testing against a Neo4j server is now possible using GraphAware&#39;s&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://graphaware.com/neo4j/2014/06/19/neo4j-unit-testing-with-resttest.html&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot; target=&quot;_blank&quot;&gt;RestTest&lt;/a&gt;&lt;b style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;An&amp;nbsp;&lt;a href=&quot;http://docs.neo4j.org/chunked/stable/tutorials-java-unit-testing.html&quot; target=&quot;_blank&quot;&gt;ImpermanentGraphDatabase&lt;/a&gt; is great to unit test against. Depending on your testing preferences, you can decide to create a new empty graph for every test or build up on the same one for a series of tests. &lt;a href=&quot;https://github.com/luanne/flavorwockyGraphUnit/blob/master/src/test/java/com/flavorwocky/BaseTest.java&quot; target=&quot;_blank&quot;&gt;BaseTest&lt;/a&gt; uses standard jUnit fixtures to do this.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;I inject the desired flavour of the GraphDatabaseService into a &lt;a href=&quot;https://github.com/luanne/flavorwockyGraphUnit/blob/master/src/main/java/com/flavorwocky/db/ConnectionFactory.java&quot; target=&quot;_blank&quot;&gt;factory class&lt;/a&gt; that produces the right database to be used either in &lt;a href=&quot;https://github.com/luanne/flavorwockyGraphUnit/blob/master/src/main/resources/graph-context.xml&quot; target=&quot;_blank&quot;&gt;production&lt;/a&gt; mode or &lt;a href=&quot;https://github.com/luanne/flavorwockyGraphUnit/blob/master/src/test/resources/test-graph-context.xml&quot; target=&quot;_blank&quot;&gt;testing&lt;/a&gt;, and that&#39;s all there is to it.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Apart from testing code, I found another use for GraphUnit this weekend- verifying that data imported into a graph is correct. I&#39;m creating &amp;nbsp;a 2014 World Cup graph using &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/query-load-csv.html&quot; target=&quot;_blank&quot;&gt;LOAD CSV&lt;/a&gt; to import a variety of data from scattered csv files. Visually inspecting the graph or querying it after an import run isn&#39;t quite a productive activity, so now I&#39;ve got a single unit test that uses GraphUnit to verify subgraphs in my world cup database.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; public class ImportTest extends BaseTest {  
   @Test  
   public void testGoal() {  
     String goalSubgraph = &quot;Match (country:Country {name: &#39;Australia&#39;})&amp;lt;-[:HomeCountry]-(player {name: &#39;Tim CAHILL&#39;}), (m:Match {id: 4}), (min:Minute {id: 35}) create (player)-[:Scored]-&amp;gt;(goal:Goal{type: &#39;regular&#39;})-[:In]-&amp;gt;(m) create (goal)-[:AtMinute]-&amp;gt;(min)&quot;;  
     GraphUnit.assertSubgraph(getGraphDb(), goalSubgraph);  
   }  
   @Test  
   public void testReferee() {  
     String refSubgraph = &quot;match (m:Match {id:4}) match (c:Country {name:&#39;Ivory Coast&#39;}) create (m)-[:Referee]-&amp;gt;(r:Referee {name:&#39;Noumandiez DOUE&#39;})-[:HomeCountry]-&amp;gt;(c)&quot;;  
     GraphUnit.assertSubgraph(getGraphDb(), refSubgraph);  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;It&#39;s simple to &lt;a href=&quot;http://graphaware.com/neo4j/2014/05/29/graph-unit-neo4j-unit-testing.html&quot; target=&quot;_blank&quot;&gt;get started&lt;/a&gt;- include the maven dependency and you&#39;re away!&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;-Luanne&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;script src=&quot;https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/888475816048542735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/888475816048542735' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/888475816048542735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/888475816048542735'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2014/06/neo4j-unit-testing-with-graphunit.html' title='Neo4j Unit Testing with GraphUnit'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUpE02vOPf6JuPxTDyLwFIEe1_D3XqVBTBUHpsv75xfDe7FIkUtwJaB-GMqkGBW4PAzD-jej0LNCzO-EJuoGexlEhUknvt7IrknmgpjODRJFolPioNazZTTb3YVzhrhQEgq_YWvhyIy7Q/s72-c/ing.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-4763543765003741523</id><published>2014-02-08T01:19:00.000+05:30</published><updated>2014-02-08T01:26:21.526+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="cypher"/><category scheme="http://www.blogger.com/atom/ns#" term="cypher jdbc driver"/><category scheme="http://www.blogger.com/atom/ns#" term="jdbc"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j jdbc driver"/><title type='text'>Migrating the Flavorwocky database using the Neo4j Cypher JDBC Driver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Time to upgrade the &lt;a href=&quot;http://www.flavorwocky.com/&quot; target=&quot;_blank&quot;&gt;Flavorwocky&lt;/a&gt; graph from 1.8 to the new, shiny 2.0!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;I’m used the &lt;/span&gt;&lt;a href=&quot;http://www.neo4j.org/develop/tools/jdbc&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Neo4j JDBC Driver&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; to help with my migration process.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span id=&quot;docs-internal-guid-0641e5a6-0daa-424f-b455-6af59edd5b8d&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Since Flavorwocky was built with the Grails Neo4j plugin, there are a bunch of reference and type nodes that we don’t want any more (which implies that Flavorwocky will be moving off Grails soon)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;There are 5 types of entities- each of them has a __type__ property on the node:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; line-height: 1.15; white-space: pre-wrap;&quot;&gt;com.herokuapp.flavorwocky.Ingredient&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; line-height: 1.15; white-space: pre-wrap;&quot;&gt;com.herokuapp.flavorwocky.User&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; line-height: 1.15; white-space: pre-wrap;&quot;&gt;com.herokuapp.flavorwocky.Pairing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; line-height: 1.15; white-space: pre-wrap;&quot;&gt;com.herokuapp.flavorwocky.LatestPairing&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; white-space: pre-wrap;&quot;&gt;com.herokuapp.flavorwocky.Category&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span id=&quot;docs-internal-guid-0641e5a6-0dad-676e-c405-38ed1b18643a&quot;&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Then we’ve got the root node, connected via a SUBREFERENCE relation to a “Type” node, and each instance of that type is connected via the INSTANCE relation.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span id=&quot;docs-internal-guid-0641e5a6-0dad-676e-c405-38ed1b18643a&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;I want to get rid of these and move to labels.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; line-height: 1.15; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; line-height: 1.15; white-space: pre-wrap;&quot;&gt;Here are two views of the data as it exists currently:&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjijbwyRWacWEkdtY4LSPXpymgtSNAO2Cu8prVdBxgoX0zULtTI-3box5A3EREHqncTZvVnlsrOEJKNFWKuM64cdU2-3KuFTzr2mREOsfUPBKmsfBvV4dpZLyB1w5_LlBNea2KJ60SeRZg/s1600/pic1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjijbwyRWacWEkdtY4LSPXpymgtSNAO2Cu8prVdBxgoX0zULtTI-3box5A3EREHqncTZvVnlsrOEJKNFWKuM64cdU2-3KuFTzr2mREOsfUPBKmsfBvV4dpZLyB1w5_LlBNea2KJ60SeRZg/s1600/pic1.png&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPx82hJjl_54rvac2IVQmv1_7bk_5DOpj4zVw7KhXTz8oYk7GCEGEj50LdVjeaq4ZWrudTC9dJf5CV0Pvnl3on54Q-V0FpzcGoAn-RmGzET2l-2W1shfeTM6-lAJ_Nyd3BVudQaw0ks_o/s1600/pic2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPx82hJjl_54rvac2IVQmv1_7bk_5DOpj4zVw7KhXTz8oYk7GCEGEj50LdVjeaq4ZWrudTC9dJf5CV0Pvnl3on54Q-V0FpzcGoAn-RmGzET2l-2W1shfeTM6-lAJ_Nyd3BVudQaw0ks_o/s1600/pic2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 15px; line-height: 1.15; text-decoration: underline; white-space: pre-wrap;&quot;&gt;Upgrade the database from 1.8 to 2.0&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; line-height: 1.15; text-decoration: underline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span id=&quot;docs-internal-guid-0641e5a6-0daf-909f-a4b4-29cd25bbea29&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;I followed the instructions from &lt;/span&gt;&lt;span style=&quot;color: #1155cc; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;a href=&quot;http://www.neo4j.org/download/upgrade-faq&quot; style=&quot;text-decoration: none;&quot;&gt;http://www.neo4j.org/download/upgrade-faq&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
In particular-&amp;nbsp;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: #f7f7f7; color: #555555; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;The upgrade basically happens by starting your Neo4j data store (after making the backup) with Neo4j 2.0 and the configuration&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: #00546a; font-family: Consolas; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;allow_store_upgrade=true&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #555555; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; enabled in the configuration file &lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: #00546a; font-family: Consolas; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;conf/neo4j.properties&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #555555; font-family: Arial; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;. To avoid running into server startup issues as part of the upgrade, you can also use the neo4j-shell for that purpose. The command line call would then be:&lt;/span&gt;&lt;span id=&quot;docs-internal-guid-0641e5a6-0db3-12a1-1691-69941aafb18b&quot;&gt;&lt;span style=&quot;background-color: whitesmoke; color: #00546a; font-family: Consolas; font-size: 12px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;bin/neo4j-shell -path data/graph.db -config conf/neo4j.properties&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #555555; font-family: Arial; font-size: 16px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;&lt;a href=&quot;http://www.neo4j.org/download/upgrade-faq&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;color: #1155cc; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Use the Neo4j JDBC Driver&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Get the Neo4j JDBC Driver binary from &lt;/span&gt;&lt;a href=&quot;http://www.neo4j.org/develop/tools/jdbc&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;color: #1155cc; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;http://www.neo4j.org/develop/tools/jdbc&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; or build it from the 2.0 branch at &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://github.com/neo4j-contrib/neo4j-jdbc&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;color: #1155cc; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;https://github.com/neo4j-contrib/neo4j-jdbc&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;I built it from source and dropped it into the lib directory at &lt;a href=&quot;https://github.com/luanne/flavorwocky-jdbc-migrate&quot;&gt;https://github.com/luanne/flavorwocky-jdbc-migrate&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;You can use the driver both with an embedded database or with the Neo4j server.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;I chose to use it with the embedded database because that supports turning auto commit off, which enables me to verify that every entity is migrated correctly before applying the changes on the database. &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Using the driver is straightforward. &lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;The connection URL for an embedded file path is &lt;b&gt;jdbc:neo4j:file:/path/to/db&lt;/b&gt; while the url for the server looks like &lt;b&gt;jdbc:neo4j://&lt;host&gt;:&lt;port&gt;/ &lt;/port&gt;&lt;/host&gt;&lt;/b&gt;(authentication parameters are passed as properties) [See &lt;a href=&quot;https://github.com/luanne/flavorwocky-jdbc-migrate/blob/master/src/com/flavorwocky/util/ConnectionFactory.java&quot;&gt;ConnectionFactory.java&lt;/a&gt; and the properties defined in &lt;a href=&quot;https://github.com/luanne/flavorwocky-jdbc-migrate/blob/master/config/db.properties&quot;&gt;db.properties&lt;/a&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;font-size: 15px;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Statements and ResultSets work as you’d expect them to- just swap out SQL for Cypher.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;With a PreparedStatement, you need to remember to parameterize the Cypher query using {1},{2}, {3} etc. Named parameters are not supported (PreparedStatement itself does not support named parameters). [See &lt;a href=&quot;https://github.com/luanne/flavorwocky-jdbc-migrate/blob/master/src/com/flavorwocky/migrate/MigrateDb.java&quot;&gt;MigrateDb.java&lt;/a&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Statement.executeUpdate will return 0 at the time of writing this- it is not yet implemented.&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif; line-height: 19.166667938232422px; white-space: pre-wrap;&quot;&gt;Pretty easy!&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;
&lt;span style=&quot;line-height: 19.166667938232422px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;The source is available at &lt;a href=&quot;https://github.com/luanne/flavorwocky-jdbc-migrate&quot;&gt;https://github.com/luanne/flavorwocky-jdbc-migrate&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Related links:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;a href=&quot;http://thought-bytes.blogspot.com/2012/03/getting-started-with-grails-neo4j.html&quot; target=&quot;_blank&quot;&gt;Getting Started with Grails + Neo4j plugin + Heroku&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;a href=&quot;http://thought-bytes.blogspot.com/2012/02/flavor-of-month-neo4j-add-on-for-heroku.html&quot; target=&quot;_blank&quot;&gt;Flavor of the month- Neo4j add-on for Heroku&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;a href=&quot;http://rickardoberg.wordpress.com/2011/12/19/creating-a-jdbc-driver-for-neo4j/&quot; target=&quot;_blank&quot;&gt;Creating a JDBC Driver for Neo4j&lt;/a&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;a href=&quot;http://www.neo4j.org/develop/tools/jdbc&quot; target=&quot;_blank&quot;&gt;Cypher Neo4j JDBC Driver&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;-Luanne&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/4763543765003741523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/4763543765003741523' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4763543765003741523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4763543765003741523'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2014/02/migrating-flavorwocky-database-using.html' title='Migrating the Flavorwocky database using the Neo4j Cypher JDBC Driver'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjijbwyRWacWEkdtY4LSPXpymgtSNAO2Cu8prVdBxgoX0zULtTI-3box5A3EREHqncTZvVnlsrOEJKNFWKuM64cdU2-3KuFTzr2mREOsfUPBKmsfBvV4dpZLyB1w5_LlBNea2KJ60SeRZg/s72-c/pic1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-7631333665579874230</id><published>2013-07-25T18:40:00.001+05:30</published><updated>2013-07-25T21:41:53.868+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="batching"/><category scheme="http://www.blogger.com/atom/ns#" term="java rest binding"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><title type='text'>Neo4j Java REST Binding- Part 2 (Batching)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;In &lt;a href=&quot;http://thought-bytes.blogspot.com/2013/07/getting-started-with-neo4j-java-rest-heroku.html&quot; target=&quot;_blank&quot;&gt;Part 1&lt;/a&gt;, we talked about setting up a connection to the Neo4j Server using the Java REST Binding.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Let’s now go into some details about transactions, batching, and what the REST requests really look like.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Make sure you turn on logging (set &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;system property &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;org.neo4j.rest.logging_filter to true) as described in Part 1.&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;We will change our code to &amp;nbsp;execute these Neo4j API calls.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Example 1:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;code&gt;Transaction tx = graphDb.beginTx();
    Map&lt;string bject=&quot;&quot;&gt; props=new HashMap&lt;string object=&quot;&quot;&gt;();
    props.put(&quot;id&quot;, 100);
    props.put(&quot;name&quot;,&quot;firstNode&quot;);
    Node node=graphDb.createNode(props);

    props.put(&quot;id&quot;,200);
    props.put(&quot;name&quot;,&quot;secondNode&quot;);
    Node node2=graphDb.createNode(props);

    node.createRelationshipTo(node2, DynamicRelationshipType.withName(&quot;KNOWS&quot;));

    tx.success();
    tx.finish();
    
    result=engine.query(&quot;start n=node(*) return count(n) as total&quot;, Collections.EMPTY_MAP);
    Iterator &lt;map object=&quot;&quot; tring=&quot;&quot;&gt;iterator=result.iterator();
    if(iterator.hasNext()) {
        Map&lt;string bject=&quot;&quot;&gt; row= iterator.next();
        out.print(&quot;Total nodes: &quot; + row.get(&quot;total&quot;));
    }

&lt;/string&gt;&lt;/map&gt;&lt;/string&gt;&lt;/string&gt;&lt;/code&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Check the logs (for me, they appeared by default on the Tomcat console) and look for the REST calls. The code above produced:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;code&gt;
INFO: 1 * Client out-bound request
1 &amp;gt;  POST http://localhost:7474/db/data/node
1 &amp;gt;  Accept: application/json; stream=true
1 &amp;gt;  X-Stream: true
1 &amp;gt;  Content-Type: application/json
1 &amp;gt;
{&quot;id&quot;:100,&quot;name&quot;:&quot;firstNode&quot;}

INFO: 1 * Client in-bound response
1 &amp;lt; 201
1 &amp;lt; Access-Control-Allow-Origin: *
1 &amp;lt; Transfer-Encoding: chunked
1 &amp;lt; Content-Encoding: UTF-8
1 &amp;lt; Location: http://localhost:7474/db/data/node/1
1 &amp;lt; Content-Type: application/json; stream=true
1 &amp;lt; Server: Jetty(6.1.25)
1 &amp;lt; 
{&quot;extensions&quot;:{},&quot;paged_traverse&quot;:&quot;http://localhost:7474/db/data/node/1/paged/traverse/{returnType}{?pageSize,leaseTime}&quot;,&quot;outgoing_relationships&quot;:&quot;http://localhost:7474/db/data/node/1/relationships/out&quot;,&quot;traverse&quot;:&quot;http://localhost:7474/db/data/node/1/traverse/{returnType}&quot;,&quot;all_typed_relationships&quot;:&quot;http://localhost:7474/db/data/node/1/relationships/all/{-list|&amp;amp;|types}&quot;,&quot;property&quot;:&quot;http://localhost:7474/db/data/node/1/properties/{key}&quot;,&quot;all_relationships&quot;:&quot;http://localhost:7474/db/data/node/1/relationships/all&quot;,&quot;self&quot;:&quot;http://localhost:7474/db/data/node/1&quot;,&quot;properties&quot;:&quot;http://localhost:7474/db/data/node/1/properties&quot;,&quot;outgoing_typed_relationships&quot;:&quot;http://localhost:7474/db/data/node/1/relationships/out/{-list|&amp;amp;|types}&quot;,&quot;incoming_relationships&quot;:&quot;http://localhost:7474/db/data/node/1/relationships/in&quot;,&quot;incoming_typed_relationships&quot;:&quot;http://localhost:7474/db/data/node/1/relationships/in/{-list|&amp;amp;|types}&quot;,&quot;create_relationship&quot;:&quot;http://localhost:7474/db/data/node/1/relationships&quot;,&quot;data&quot;:{&quot;name&quot;:&quot;firstNode&quot;,&quot;id&quot;:100}}

INFO: 2 * Client out-bound request
2 &amp;gt; POST http://localhost:7474/db/data/node
2 &amp;gt; Accept: application/json; stream=true
2 &amp;gt; X-Stream: true
2 &amp;gt; Content-Type: application/json
2 &amp;gt; 
{&quot;id&quot;:200,&quot;name&quot;:&quot;secondNode&quot;}

INFO: 2 * Client in-bound response
2 &amp;lt; 201
2 &amp;lt; Access-Control-Allow-Origin: *
2 &amp;lt; Transfer-Encoding: chunked
2 &amp;lt; Content-Encoding: UTF-8
2 &amp;lt; Location: http://localhost:7474/db/data/node/2
2 &amp;lt; Content-Type: application/json; stream=true
2 &amp;lt; Server: Jetty(6.1.25)
2 &amp;lt; 
{&quot;extensions&quot;:{},&quot;paged_traverse&quot;:&quot;http://localhost:7474/db/data/node/2/paged/traverse/{returnType}{?pageSize,leaseTime}&quot;,&quot;outgoing_relationships&quot;:&quot;http://localhost:7474/db/data/node/2/relationships/out&quot;,&quot;traverse&quot;:&quot;http://localhost:7474/db/data/node/2/traverse/{returnType}&quot;,&quot;all_typed_relationships&quot;:&quot;http://localhost:7474/db/data/node/2/relationships/all/{-list|&amp;amp;|types}&quot;,&quot;property&quot;:&quot;http://localhost:7474/db/data/node/2/properties/{key}&quot;,&quot;all_relationships&quot;:&quot;http://localhost:7474/db/data/node/2/relationships/all&quot;,&quot;self&quot;:&quot;http://localhost:7474/db/data/node/2&quot;,&quot;properties&quot;:&quot;http://localhost:7474/db/data/node/2/properties&quot;,&quot;outgoing_typed_relationships&quot;:&quot;http://localhost:7474/db/data/node/2/relationships/out/{-list|&amp;amp;|types}&quot;,&quot;incoming_relationships&quot;:&quot;http://localhost:7474/db/data/node/2/relationships/in&quot;,&quot;incoming_typed_relationships&quot;:&quot;http://localhost:7474/db/data/node/2/relationships/in/{-list|&amp;amp;|types}&quot;,&quot;create_relationship&quot;:&quot;http://localhost:7474/db/data/node/2/relationships&quot;,&quot;data&quot;:{&quot;name&quot;:&quot;secondNode&quot;,&quot;id&quot;:200}}

INFO: 3 * Client out-bound request
3 &amp;gt; POST http://localhost:7474/db/data/node/1/relationships
3 &amp;gt; Accept: application/json; stream=true
3 &amp;gt; X-Stream: true
3 &amp;gt; Content-Type: application/json
3 &amp;gt; 
{&quot;to&quot;:&quot;http://localhost:7474/db/data/node/2&quot;,&quot;type&quot;:&quot;KNOWS&quot;}

INFO: 3 * Client in-bound response
3 &amp;lt; 201
3 &amp;lt; Access-Control-Allow-Origin: *
3 &amp;lt; Transfer-Encoding: chunked
3 &amp;lt; Content-Encoding: UTF-8
3 &amp;lt; Location: http://localhost:7474/db/data/relationship/0
3 &amp;lt; Content-Type: application/json; stream=true
3 &amp;lt; Server: Jetty(6.1.25)
3 &amp;lt; 
{&quot;extensions&quot;:{},&quot;start&quot;:&quot;http://localhost:7474/db/data/node/1&quot;,&quot;property&quot;:&quot;http://localhost:7474/db/data/relationship/0/properties/{key}&quot;,&quot;self&quot;:&quot;http://localhost:7474/db/data/relationship/0&quot;,&quot;properties&quot;:&quot;http://localhost:7474/db/data/relationship/0/properties&quot;,&quot;type&quot;:&quot;KNOWS&quot;,&quot;end&quot;:&quot;http://localhost:7474/db/data/node/2&quot;,&quot;data&quot;:{}}

INFO: 4 * Client out-bound request
4 &amp;gt; POST http://localhost:7474/db/data/cypher
4 &amp;gt; Accept: application/json; stream=true
4 &amp;gt; X-Stream: true
4 &amp;gt; Content-Type: application/json
4 &amp;gt; 
{&quot;query&quot;:&quot;start n=node(*) return count(n) as total&quot;,&quot;params&quot;:{}}

INFO: 4 * Client in-bound response
4 &amp;lt; 200
4 &amp;lt; Access-Control-Allow-Origin: *
4 &amp;lt; Transfer-Encoding: chunked
4 &amp;lt; Content-Encoding: UTF-8
4 &amp;lt; Content-Type: application/json; stream=true
4 &amp;lt; Server: Jetty(6.1.25)
4 &amp;lt; 
{&quot;columns&quot;:[&quot;total&quot;],&quot;data&quot;:[[3]]}


&lt;/code&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;A total of 4 REST calls over the wire for that tiny piece of code. You definitely want to avoid this as far as possible. &lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Option 1 is to use Cypher as far as possible.&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;We could convert the first three REST calls into one by not using the embedded style API and switching to Cypher.&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Example 2:&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;code&gt; Map&amp;lt;String,Object&amp;gt; props=new HashMap&amp;lt;String, Object&amp;gt;();
 props.put(&quot;id&quot;, 100);
 props.put(&quot;name&quot;,&quot;firstNode&quot;);
     
 Map&amp;lt;String,Object&amp;gt; props2=new HashMap&amp;lt;String, Object&amp;gt;();
 props2.put(&quot;id&quot;,200);
 props2.put(&quot;name&quot;,&quot;secondNode&quot;);
    
  Map&amp;lt;String,Object&amp;gt; params=new HashMap&amp;lt;String, Object&amp;gt;();
  params.put(&quot;props1&quot;,props);
  params.put(&quot;props2&quot;,props2);
        
 engine.query(&quot;create (n1 {props1})-[:KNOWS]-&amp;gt;(n2 {props2})&quot;, params);

&lt;/code&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15df-f864-1eeb-aeab0aa78030&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e1-0912-c473-59f9eb46feab&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial; font-size: 15px;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;This produces:&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;

&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;code&gt;1 &amp;gt; POST http://localhost:7474/db/data/cypher
{&quot;query&quot;:&quot;create (n1 {props1})-[:KNOWS]-&amp;gt;(n2 {props2})&quot;,&quot;params&quot;:{&quot;props1&quot;:{&quot;id&quot;:100,&quot;name&quot;:&quot;firstNode&quot;},&quot;props2&quot;:{&quot;id&quot;:100,&quot;name&quot;:&quot;firstNode&quot;}}}

Jul 24, 2013 10:38:47 PM com.sun.jersey.api.client.filter.LoggingFilter log
INFO: 1 * Client in-bound response
1 &amp;lt; 200
1 &amp;lt; Access-Control-Allow-Origin: *
1 &amp;lt; Transfer-Encoding: chunked
1 &amp;lt; Content-Encoding: UTF-8
1 &amp;lt; Content-Type: application/json; stream=true
1 &amp;lt; Server: Jetty(6.1.25)
1 &amp;lt; 
{&quot;columns&quot;:[],&quot;data&quot;:[]}


&lt;/code&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;u&gt;Batching all operations within a transaction&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;The documentation at &lt;/span&gt;&lt;a href=&quot;https://github.com/neo4j/java-rest-binding&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;https://github.com/neo4j/java-rest-binding&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; states:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.7045454545454546; margin-bottom: 11pt; margin-top: 11pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;“&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #333333; font-size: 15px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;In 1.8 it tries to collect all operations within a tx as a batch-operation which will then be executed on the server. &lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #333333; font-size: 15px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;This has the implication that the results retrieved within that &quot;tx&quot; are not immediately available but only after you called tx.success and tx.finish&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 21px;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;“&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;However, note that this is NOT the default behavior as you can see from Example 1. To turn this on, you need to set the following system property:&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;org.neo4j.rest.batch_transaction=true&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e4-0d02-2af1-8dd16a3f2c82&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Once the system property is set and Example 1 is re-run, the REST calls look like(requests only)&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;INFO: 1 * Client out-bound request
1 &amp;gt; POST http://localhost:7474/db/data/batch
1 &amp;gt; Accept: application/json; stream=true
1 &amp;gt; X-Stream: true
1 &amp;gt; Content-Type: application/json
1 &amp;gt; 
[{&quot;id&quot;:1,&quot;to&quot;:&quot;node&quot;,&quot;body&quot;:{&quot;id&quot;:200,&quot;name&quot;:&quot;secondNode&quot;},&quot;method&quot;:&quot;POST&quot;},{&quot;id&quot;:2,&quot;to&quot;:&quot;node&quot;,&quot;body&quot;:{&quot;id&quot;:200,&quot;name&quot;:&quot;secondNode&quot;},&quot;method&quot;:&quot;POST&quot;},{&quot;id&quot;:3,&quot;to&quot;:&quot;{1}/relationships&quot;,&quot;body&quot;:{&quot;to&quot;:&quot;{2}&quot;,&quot;type&quot;:&quot;KNOWS&quot;},&quot;method&quot;:&quot;POST&quot;}]

INFO: 2 * Client out-bound request
2 &amp;gt; POST http://localhost:7474/db/data/cypher
2 &amp;gt; Accept: application/json; stream=true
2 &amp;gt; X-Stream: true
2 &amp;gt; Content-Type: application/json
2 &amp;gt; 
{&quot;query&quot;:&quot;start n=node(*) return count(n) as total&quot;,&quot;params&quot;:{}}


&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e5-307e-9314-4aa305a17b13&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;You may also explicitly create batch operations like so:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;List&amp;lt;Node&amp;gt; response =graphDb.executeBatch(new BatchCallback&amp;lt;List&amp;lt;Node&amp;gt;&amp;gt;() {

            @Override
            public List&amp;lt;Node&amp;gt; recordBatch(RestAPI batchRestApi) {
                List&amp;lt;Node&amp;gt; nodes=new ArrayList&amp;lt;Node&amp;gt;();

                Map props=new HashMap&amp;lt;String, Object&amp;gt;();
                props.put(&quot;id&quot;,600);
                nodes.add(batchRestApi.createNode(props));

                Map props2=new HashMap&amp;lt;String, Object&amp;gt;();
                props2.put(&quot;id&quot;,500);
                nodes.add(batchRestApi.createNode(props2));
                return nodes;
            }
        });

&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e5-307e-9314-4aa305a17b13&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e5-307e-9314-4aa305a17b13&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e5-ff0e-cb2a-1eca3924e67c&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;This translates into: &lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e5-307e-9314-4aa305a17b13&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e5-ff0e-cb2a-1eca3924e67c&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;INFO: 1 * Client out-bound request
1 &amp;gt; POST http://localhost:7474/db/data/batch
1 &amp;gt; Accept: application/json; stream=true
1 &amp;gt; X-Stream: true
1 &amp;gt; Content-Type: application/json
1 &amp;gt; 
[{&quot;id&quot;:1,&quot;to&quot;:&quot;node&quot;,&quot;body&quot;:{&quot;id&quot;:600},&quot;method&quot;:&quot;POST&quot;},{&quot;id&quot;:2,&quot;to&quot;:&quot;node&quot;,&quot;body&quot;:{&quot;id&quot;:500},&quot;method&quot;:&quot;POST&quot;}]

&lt;/code&gt;&lt;/pre&gt;
&lt;/b&gt;&lt;div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;display: inline !important;&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;display: inline !important; line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;div style=&quot;display: inline !important;&quot;&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e7-45bd-9f83-73639d43d998&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Any of the Cypher/Batching approaches are highly recommended over the finer grained Neo4j Java API. &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e7-45bd-9f83-73639d43d998&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e7-45bd-9f83-73639d43d998&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;In the final post, we will take a look how transactions behave in the context of the REST binding.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b id=&quot;docs-internal-guid-4910248c-15e7-45bd-9f83-73639d43d998&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;-Luanne&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-4910248c-15de-e57f-b834-bd188272b539&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/7631333665579874230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/7631333665579874230' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/7631333665579874230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/7631333665579874230'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2013/07/neo4j-java-rest-binding-part-2-batching.html' title='Neo4j Java REST Binding- Part 2 (Batching)'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-4708763250269949528</id><published>2013-07-20T14:43:00.001+05:30</published><updated>2013-07-20T14:43:22.584+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="heroku"/><category scheme="http://www.blogger.com/atom/ns#" term="java rest binding"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><title type='text'>Getting started with the Neo4j Java Rest Binding (Heroku deployment)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Believe it or not, the last couple of days were my first attempt at using Neo4j’s &lt;/span&gt;&lt;a href=&quot;https://github.com/neo4j/java-rest-binding&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Java Rest Binding&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;. My earlier application on Heroku, &lt;/span&gt;&lt;a href=&quot;http://www.flavorwocky.com/&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Flavorwocky&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;, used the &lt;/span&gt;&lt;a href=&quot;http://thought-bytes.blogspot.in/2012/03/getting-started-with-grails-neo4j.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Grails Neo4j plugin&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; and for other stuff including work, embedded Neo4j rules.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;However, embedded won’t do when deploying to Heroku, so the Java Rest Binding it is. Much better than dealing with raw REST, especially if you are very used to the embedded api’s.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Since it took me a short while to figure things out, mostly due to my shameful lack of Maven knowledge, thought I’d post a simple “getting started” guide.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;At the end of this, your application and Neo4j should be talking to each other.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-34656c78-fb47-b77a-d77e-be38fd339f64&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;u&gt;Note 1&lt;/u&gt;: This article deals with the rest binding for Neo4j 1.8.1, which is the version used by my Heroku application.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;u&gt;Note 2&lt;/u&gt;: Add the Neo4j add-on to your Heroku application if you do plan on trying this out&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 1: Get/Include the library&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;If you are not deploying to Heroku and/or want to just include the jars, pick them up from here: &lt;/span&gt;&lt;a href=&quot;http://m2.neo4j.org/content/groups/everything/org/neo4j/neo4j-rest-graphdb/1.8.1/&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;http://m2.neo4j.org/content/groups/everything/org/neo4j/neo4j-rest-graphdb/1.8.1/&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;If you like/have to use maven, include the following dependency in your pom.xml&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 17.98611068725586px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  &amp;lt;dependency&amp;gt;  
    &amp;lt;groupId&amp;gt;org.neo4j&amp;lt;/groupId&amp;gt;  
    &amp;lt;artifactId&amp;gt;neo4j-rest-graphdb&amp;lt;/artifactId&amp;gt;  
    &amp;lt;version&amp;gt;1.8.1&amp;lt;/version&amp;gt;  
  &amp;lt;/dependency&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The dependency refused to resolve until I added the following:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;repositories&amp;gt;  
     &amp;lt;repository&amp;gt;  
       &amp;lt;id&amp;gt;mvn-neo4j&amp;lt;/id&amp;gt;  
       &amp;lt;url&amp;gt;http://m2.neo4j.org/content/groups/everything&amp;lt;/url&amp;gt;  
     &amp;lt;/repository&amp;gt;  
 &amp;lt;/repositories&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 2: Connect to your local Neo4j server&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;I created a simple servlet to test code and figure out the library, you might add this code to whatever you like.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; RestAPI graphDb = new RestAPIFacade(&quot;http://localhost:7474/db/data&quot;);  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Note that you can also use &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; GraphDatabaseService graphDb=new RestGraphDatabase(“http://localhost:7474/db/data”);  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;which is what I attempted to use first, and it does work, but doesn’t seem to be a valid parameter when creating a RestCypherQueryEngine (see step 3)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 3: Does it work?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Execute a Cypher query to return the number of nodes in the database. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; line-height: 1.15; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 17.98611068725586px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; QueryEngine engine=new RestCypherQueryEngine(graphDb);  
 QueryResult&amp;lt;Map&amp;lt;String,Object&amp;gt;&amp;gt; result=  
     engine.query(&quot;start n=node(*) return count(n) as total&quot;, Collections.EMPTY_MAP);  
 Iterator&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; iterator=result.iterator();  
 if(iterator.hasNext()) {  
   Map&amp;lt;String,Object&amp;gt; row= iterator.next();  
   out.print(&quot;Total nodes: &quot; + row.get(&quot;total&quot;));  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 4: Let’s find out&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Now is a good time to start your Neo4j server if you haven’t already.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;If you’re using Tomcat and following the guide here &lt;/span&gt;&lt;a href=&quot;https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt; then build and run:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; mvn package  
 sh target/bin/webapp  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;or launch your web application otherwise.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Access your servlet/jsp/anything else and you should see the count of nodes in your Neo4j database. A new database will return 1 node (the reference node)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 5: Deploy to Heroku&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The URL to your Neo4j database on Heroku can be found in the NEO4J_URL environment variable so you don’t need to hardcode this in your application. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;The variable value looks like this:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 20px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; http://username:password@db.hosted.neo4j.org:port  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 20px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; line-height: 1.15; white-space: pre-wrap;&quot;&gt;Pick up the variable in your application code using &lt;/span&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 20px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; String neoUrl=System.getenv(&quot;NEO4J_URL&quot;);  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;and parse it to extract the username, password and db URL (&lt;/span&gt;&lt;a href=&quot;about:blank&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;http://db.hosted.neo4j.org:port&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Modify your code to now accept a username and password:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 20px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; GraphDatabaseService graphDb=new RestGraphDatabase(dbUrl + “/db/data”,username,password);  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Push changes to heroku, access your application, and you should see the count of nodes in your remote instance.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Step 6: Add a node just to be really sure&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 20px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; Transaction tx = graphDb.beginTx();  
 Map&amp;lt;String,Object&amp;gt; props=new HashMap&amp;lt;String, Object&amp;gt;();  
 props.put(&quot;id&quot;,100);  
 props.put(&quot;name&quot;,&quot;firstNode&quot;);  
 Node node=graphDb.createNode(props);  
 tx.success();  
 tx.finish();  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Execute the same Cypher query to fetch the count of nodes and you should see it increment by 1.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;If you can’t wait to see the REST calls that the binding is actually producing, you can turn on logging.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;As per the documentation, you need to set the system property &lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;org.neo4j.rest.logging_filter to true.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;I saw the REST calls being logged on my Tomcat console.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;Further googling told me that I could set this property on Heroku by adding it &amp;nbsp;as an extraJvmArgument in the appassembler-maven-plugin in pom.xml:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 20px; white-space: pre-wrap;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbqIaHQCBUxfv9jMjSQYA9GnUntwSoI60ffz3xwUlWkWMEXWgdLJ1iIR3MQqrwy6Fu4tCwB60E6md2UC_30fVwliH57AzQU23V2p6hysQkdQFVBEwVkZ75jnc2rMkDDKAiGKzfRZBUGWT/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  &amp;lt;configuration&amp;gt;  
    &amp;lt;assembleDirectory&amp;gt;target&amp;lt;/assembleDirectory&amp;gt;  
    &amp;lt;programs&amp;gt;  
      &amp;lt;program&amp;gt;  
        &amp;lt;mainClass&amp;gt;launch.Main&amp;lt;/mainClass&amp;gt;  
        &amp;lt;name&amp;gt;webapp&amp;lt;/name&amp;gt;  
      &amp;lt;/program&amp;gt;  
    &amp;lt;/programs&amp;gt;  
    &amp;lt;extraJvmArguments&amp;gt;-Dorg.neo4j.rest.logging_filter=true&amp;lt;/extraJvmArguments&amp;gt;  
 &amp;lt;/configuration&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;That’s it! You should now be able to manipulate your graph using Cypher or the core API, but more on transactions and batching in Part 2. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;-Luanne&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/4708763250269949528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/4708763250269949528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4708763250269949528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4708763250269949528'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2013/07/getting-started-with-neo4j-java-rest-heroku.html' title='Getting started with the Neo4j Java Rest Binding (Heroku deployment)'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-4149773422265410619</id><published>2013-01-02T23:15:00.002+05:30</published><updated>2013-01-02T23:18:32.472+05:30</updated><title type='text'>Optimizing Neo4j Cypher queries</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Last week, I spent a good number of hours trying to optimize around 20 Cypher queries that were performing disastrously(36866ms to 155575ms) with data from a live system. After some trial and error, and a lot of input from &lt;a href=&quot;https://twitter.com/mesirii&quot; target=&quot;_blank&quot;&gt;Michael&lt;/a&gt;, I was able to figure out generally what needed to be done to the queries to make them perform better- at the end of this, the worst performing query dropped to 521ms on a cold graph and 1GB heap space (and that query has optional paths- not quite sure how to improve that), and the remaining were all under 50ms- quite a large improvement from original numbers.&lt;br /&gt;&lt;br /&gt;Hoping that this might help someone else, here is what I did (mostly guess work and largely unscientific)- perhaps Michael can help explain the internals and correct me on some assumptions.&lt;br /&gt;&lt;br /&gt;The first thing I did was make sure that every cypher query is using parameters- as stated in the &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/cypher-parameters.html&quot; target=&quot;_blank&quot;&gt;Neo4j documentation&lt;/a&gt;, this helps in caching of execution plans.&lt;br /&gt;&lt;br /&gt;Second, I came across a post in the Neo4j mailing list, where Michael mentioned NOT re-instantiating the ExecutionEngine so that the above said parameterized queries actually do cache. This might seem obvious to many, but it was a fact that easily slipped by, given I have a class called QueryExecutor that contains a method to execute a query with map of parameters, and the method created a new ExecutionEngine for every query. Once this method was written and used many, many times over, it was very easy to forget about. However, this was a very important factor in the overall performance (a mention in the docs would be extremely helpful), and it explained why my queries generally took the same time to execute even when parameterized. Changing this to use a cached ExecutionEngine saw the bottom half of my query time worksheet drop off...0 to 1 ms after being cached- excellent progress.&lt;br /&gt;&lt;br /&gt;Now, to get to each query, starting with the worst. I decided to optimize on my local machine, with only 1GB heap space allocated, and on a cold graph. So I ignore the improvement in the query execution after caching- I feel that this is a better way to ensure progress- if the first query hit isn&#39;t improving, then you really haven&#39;t optimized it. That way, if it works really well with limited hardware, I am more confident of it working better in production.&lt;br /&gt;Apart from timing the query in the code, I optimized using the webadmin console. The indicator that the query was awful is that it just would not return and the console would hang. Optimizing so that it didn&#39;t hang was a major improvement in itself. Highly unscientific, but I recommend it.&lt;br /&gt;&lt;br /&gt;My first query averaged about 76558ms (the time was obtained by putting in a start and end time around the engine execute method). After the first optimization, it was down to 466ms.&lt;br /&gt;Here is the original query: &lt;a href=&quot;https://gist.github.com/4436272&quot; target=&quot;_blank&quot;&gt;https://gist.github.com/4436272&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;!-----&gt;&lt;!-----&gt;&lt;!-----&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;And this is the optimized one: &lt;a href=&quot;https://gist.github.com/4436281&quot; target=&quot;_blank&quot;&gt;https://gist.github.com/4436281&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;There was no need to do this huge match only to filter out results based on the alertDate property on a, so I reduced the match to return the smallest set of data that could be filtered first ie. the path to a.&lt;br /&gt;If you were to execute the bad query up to the first match, you would see something like 20K rows returned. After filtering, they are a mere 450 odd rows.&lt;br /&gt;So as you can imagine, the second query quickly trims down the number of results you are potentially working with.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;The second change was something I learnt from Michael on the day, when I asked whether it makes sense to do a giant match or keep pruning with subqueries. His response was &quot;&lt;i&gt;The question is, are you using match to actually expand the result set by describing patterns or do you just want to make certain that some relationships are there (or not) aka FILTERING. If the latter, you might want to use the path-expression syntax in a where clause.&lt;br /&gt;&lt;br /&gt;WHERE a-[:FOO]-&amp;gt;b&lt;br /&gt;or WHERE NOT(a-[:FOO]-&amp;gt;b)&lt;/i&gt;&quot;&lt;br /&gt;&lt;br /&gt;This took a little getting used to as the way I wrote the MATCH clause was exactly how I&#39;d think of it in my head- but now I am able to differentiate between a match for results required versus match to filter. In the query above, I need (ir) in my results, so there is no need to include (a)-[:alert_for_inspection]-&amp;gt;(i) in the match; I can just use it in the WHERE to make sure that a does indeed relate to i.&lt;br /&gt;&lt;br /&gt;Here is another example: &lt;a href=&quot;https://gist.github.com/4436293&quot; target=&quot;_blank&quot;&gt;https://gist.github.com/4436293&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Straight away, you can see that we filter the cm relations by date- there is no need for us to first go and match all sorts of stuff if they don&#39;t fall in the date range. So this part of the query can be rewritten to:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt; start c=node:companies(id={id})&lt;br /&gt;&amp;nbsp; match c&lt;span style=&quot;font-size: small;&quot;&gt; &amp;lt;-[&lt;/span&gt;parent_company*0..]&lt;span style=&quot;font-size: small;&quot;&gt;-(n)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &lt;/span&gt;with n&lt;br /&gt;&amp;nbsp; match n-[:defines_business_process]-&amp;gt;(bp)-[:has_cycle]-&amp;gt;(cm)&lt;br /&gt;&amp;nbsp; where cm.measureDate&amp;gt;={measureStartDate} and cm.measureDate&amp;lt;={measureEndDate}&lt;!-----&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;After that, the next filter is on a- same principle applies:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;with cm&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; match (cm)-[:cycle_metric] -&amp;gt;m-[:metric_activity] -&amp;gt;ma-[:metric_unit] -&amp;gt; &lt;span style=&quot;font-size: small;&quot;&gt;(u)&lt;span style=&quot;font-size: small;&quot;&gt;-&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;[:&lt;/span&gt;&lt;/span&gt;alert_for_unit&lt;span style=&quot;font-size: small;&quot;&gt;]&lt;span style=&quot;font-size: small;&quot;&gt;-(a)&lt;/span&gt;&lt;/span&gt; where a.alertDate=cm.measureDate and a.fromEntityType={type}&lt;!-----&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;This further prunes our result set. Finally add the connections to r (for our results), making sure that paths that do not lead to r but are necessary go into the WHERE clause:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;with a,ma&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; match (r) &amp;lt;&lt;span style=&quot;font-size: small;&quot;&gt; &lt;/span&gt;- [:for_inspection_result]-a-[:alert_for_inspection]-&lt;span style=&quot;font-size: small;&quot;&gt; &amp;gt; &lt;/span&gt;i&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where (i)&lt;span style=&quot;font-size: small;&quot;&gt; &amp;lt; &lt;/span&gt;-[:metric_inspection]-(ma)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&amp;nbsp; a.id as alertId, r.value as resultValue&lt;/span&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;!-----&gt;&lt;!-----&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Here is the full query: &lt;a href=&quot;https://gist.github.com/4436328&quot; target=&quot;_blank&quot;&gt;https://gist.github.com/4436328&lt;/a&gt;&lt;br /&gt;&amp;nbsp;Original time- 33360ms, after optimization- 246ms.&lt;br /&gt;&lt;br /&gt;At least for me, most of my queries fell into this pattern, so by day 2, I was able to refactor them very quickly.&lt;br /&gt;The interesting thing is, after this, I still felt the response sluggish but the query times printed out in my log were tiny. After elimination, I found that my code actually stuck for a very long time after the query had executed (by executionEngine.execute) but within the first iteration over the resultset.&lt;br /&gt;I assume that the results are not collected necessarily during the execute() method, but lazily fetched upon iteration of the resultset- I do not know Cypher internals so I might be completely wrong. But timing the iteration itself serves to point out even more badly written queries. &lt;br /&gt;&lt;br /&gt;The other bits and pieces are- ORDER BY adds on a lot of time. If you can do without it, this is the first thing you should drop.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;DISTINCT also adds time, but in many of my cases, it was difficult to drop.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;If you want to check the absence of optional paths, where I typically do MATCH (u)-[r?:has_a]- (a) WHERE NOT (r is null), instead, re-write as MATCH (u)-[other_stuff]-.. WHERE NOT(u-[:has_a]-a) and it performs much better. However where I have optional paths like MATCH X-[o?:optional]-Y WHERE (o is present, match Y to A and B) OR&amp;nbsp; (o is absent, match X to c and d), I was unable to simplify and these queries still take some time as compared to others without optional paths.&lt;br /&gt;&lt;br /&gt;Finally- the problem was discovered so late because test data is never quite close to live data. The structure of the graph played a big role- some nodes were heavily connected, others, not so much- and the queries involving those heavily connected nodes were the ones that hurt us most. Try and use production quality data as far as possible to performance test or try and create test data as similar to it.&lt;br /&gt;&lt;br /&gt;So, to summarize:&lt;br /&gt;1. Always parameterize your queries&lt;br /&gt;2. Cache the ExecutionEngine&lt;br /&gt;3. Figure out what you&#39;re filtering on- try and apply that filter as early as possible with the least possible matches involved, so that your resultset gets progressively smaller as you move further into the query. Keep measuring both timing and results returned in each subquery so you can decide what goes first when the filter is not obvious&lt;br /&gt;4. Examing your MATCH and RETURN clauses- include in the MATCH only those pieces that are required in RETURN. The remaining which would be to filter the results can go into the WHERE&lt;br /&gt;5. If you don&#39;t need ORDER BY, drop it yesterday&lt;br /&gt;6. If you don&#39;t need DISTINCT, get rid of it too&lt;br /&gt;7. Checking the absence/presence of optional paths can be moved from the MATCH into WHERE if you don&#39;t need fancy filtering stuff based on it&lt;br /&gt;8. Time not only the execute() on the query, but also the time to iterate through the results&lt;br /&gt;9. If your webadmin console hangs, you have done a Bad Thing. Drop various parts of your query to figure out the offending one.&lt;br /&gt;10. Try to use live data as far as possible&lt;br /&gt;11. Test on a cold graph with miserly resources- you feel so much better when you see it zip past you on production!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-Luanne&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/4149773422265410619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/4149773422265410619' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4149773422265410619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4149773422265410619'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2013/01/optimizing-neo4j-cypher-queries.html' title='Optimizing Neo4j Cypher queries'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-938666370004354869</id><published>2012-03-04T22:53:00.000+05:30</published><updated>2012-03-06T12:09:28.835+05:30</updated><title type='text'>Getting started with the Grails + Neo4j plugin + Heroku</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;As promised in a previous &lt;a href=&quot;http://thought-bytes.blogspot.in/2012/02/grails-20-heroku-and-neo4j-addon.html&quot;&gt;post&lt;/a&gt;, here is a brief update with the Grails Neo4j 1.0.0.M2 plugin.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;This largely follows the guide at&amp;nbsp;&lt;a href=&quot;http://devcenter.heroku.com/articles/grails&quot; style=&quot;color: #d646d6; text-decoration: none;&quot;&gt;http://devcenter.heroku.com/articles/grails&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18px;&quot;&gt;&lt;i&gt;&lt;br style=&quot;background-color: white;&quot; /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Create the grails app&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
&amp;gt;grails create-app heroku-neo4j&lt;br /&gt;
&amp;gt;cd heroku-neo4j&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Check into Git&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Create a .gitignore file for ignored files and check into git&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
*.iws&lt;br /&gt;
*Db.properties&lt;br /&gt;
*Db.script&lt;br /&gt;
.settings&lt;br /&gt;
.classpath&lt;br /&gt;
.project&lt;br /&gt;
eclipse&lt;br /&gt;
stacktrace.log&lt;br /&gt;
target&lt;br /&gt;
/plugins&lt;br /&gt;
/web-app/plugins&lt;br /&gt;
/web-app/WEB-INF/classes&lt;br /&gt;
web-app/WEB-INF/tld/c.tld&lt;br /&gt;
web-app/WEB-INF/tld/fmt.tld&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
&amp;gt;git init&lt;br /&gt;
&amp;gt;git add .&lt;br /&gt;
&amp;gt;git commit -m init&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Create a Heroku app&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
&amp;gt;heroku create --stack cedar&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;...and deploy&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
&amp;gt;git push heroku master&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Check it out in the browser&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
&amp;gt;heroku open&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Add the Neo4J addon&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
&amp;gt;heroku addons:add neo4j:test&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Install the Grails Neo4j plugin&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;
&amp;gt;grails install-plugin neo4j&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Update BuildConfig.groovy&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Add the neo4j repo,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;repositories {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; ...&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; mavenRepo &#39;http://m2.neo4j.org/releases&#39;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;and a compile dependency,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;dependencies {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;compile &quot;org.neo4j:neo4j-rest-graphdb:1.6&quot;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Update DataSource.groovy&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Configure your database location through DataSource. Since the Heroku Neo4j addon is only accessible via REST, we use type=&quot;rest&quot;. On Heroku, the system environment variable NEO4J_REST_URL will be set to your own Neo4j instance &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;development {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; grails {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; neo4j {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type = &quot;rest&quot;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; location = &quot;http://localhost:7474/db/data/&quot;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; }&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;production {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; grails {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; neo4j {&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type = &quot;rest&quot;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; location = System.getenv(&#39;NEO4J_REST_URL&#39;) ?: &quot;http://localhost:7474/db/data/&quot;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; }&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Now you should be able to use GORM to maintain your Neo4J datastore.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;What&#39;s great with this setup is, you can switch to an embedded or HA data setup by modifying the type and location parameters in DataSource, without changing any other code.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;One more thing...&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Relationship properties are not yet supported. See&amp;nbsp;&lt;a href=&quot;https://groups.google.com/d/topic/neo4j/6IiFN_RG19I/discussion&quot;&gt;https://groups.google.com/d/topic/neo4j/6IiFN_RG19I/discussion&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/938666370004354869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/938666370004354869' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/938666370004354869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/938666370004354869'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2012/03/getting-started-with-grails-neo4j.html' title='Getting started with the Grails + Neo4j plugin + Heroku'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-4586866331789745257</id><published>2012-02-25T22:17:00.000+05:30</published><updated>2012-02-25T23:20:14.845+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="cypher"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><category scheme="http://www.blogger.com/atom/ns#" term="recommendation engine"/><title type='text'>Similarity based recommendations with Cypher</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;Josh Adell recently published a &lt;a href=&quot;http://blog.everymansoftware.com/2012/02/similarity-based-recommendation-engines.html&quot; target=&quot;_blank&quot;&gt;blog post&lt;/a&gt; on the similarity based recommendation engine he is building for rating and recommending beer- always a welcome service! His post shares his experience with &lt;a href=&quot;http://gremlin.tinkerpop.com/&quot; target=&quot;_blank&quot;&gt;Gremlin&lt;/a&gt;, a graph traversal language. I&#39;m going to take his example to show you how it can be done using &lt;a href=&quot;http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html&quot; target=&quot;_blank&quot;&gt;Cypher&lt;/a&gt;, Neo4j&#39;s query language.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;So basically, we want to be able to recommend beers. But we just don&#39;t want the highly rated beers- it means much more to us if they were rated highly by people who have similar tastes to us.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;The goal is to answer two questions:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;1. For a beer that I have not rated, what is the average rating given to it by people similar to me?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;2. Which beers should I try and then rate? We want to recommend beers that have been rated 7 or higher by people similar to me.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;To get to both these questions, we first need to determine people with similar tastes. For our purposes, Josh defines a similar user as one whos ratings on an average are within 2 points of my ratings for the same items.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;We&#39;ll use this simple graph to test our Cypher queries:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user1) -[:RATED 3]-&amp;gt;(itemA)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user2) -[:RATED 2]-&amp;gt;(itemA)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user3) -[:RATED 7]-&amp;gt;(itemA)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user1) -[:RATED 8]-&amp;gt;(itemB)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user2) -[:RATED 7]-&amp;gt;(itemB)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user3) -[:RATED 4]-&amp;gt;(itemB)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user2) -[:RATED 5]-&amp;gt;(itemC)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user3) -[:RATED 9]-&amp;gt;(itemC)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user2) -[:RATED 8]-&amp;gt;(itemD)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;(user3) -[:RATED 4]-&amp;gt;(itemD)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: 13.0px Arial; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: 13.0px Arial; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;Considering user1, the user with similar tastes is user2. Let&#39;s take a look at the Cypher query:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: 13.0px Arial; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;start me = node(user1) //Look up user1 via an index or some other means&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;match (me)-[myRating:RATED]-&amp;gt;(i)&amp;lt;-[otherRating:RATED]-(u)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;where abs(myRating.rating-otherRating.rating)&amp;lt;=2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;return&amp;nbsp;u&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;The match clause finds all items that I rated which have also been rated by other users, represented by u.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;The where clause filters out ratings that differ by more than 2 points. The result of this query would be user2.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;Let&#39;s try to answer question 1: What is the average rating(by similar people) of a beer not rated by me?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;start item=node(x),&amp;nbsp;//Look up item via an index or other means&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;similarUsers=node(u) &amp;nbsp;//similarUsers here is the result received in the first query above&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;match (similarUsers)-[r:RATED]-&amp;gt;(item)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;return AVG(r.rating)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;And finally, question 2: Which beers(that I haven&#39;t tried) have been rated 7 or higher by users similar to me?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;start me=node(user1),&amp;nbsp;//Look up item via an index or other means&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;similarUsers=node(3)&amp;nbsp;/similarUsers here is the result received in the first query above&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;match (similarUsers)-[r:RATED]-&amp;gt;(item)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;where r.rating &amp;gt; 7 and not((me)-[:RATED]-&amp;gt;(item))&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #990000; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: small;&quot;&gt;return item&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;There you go! Of course there&#39;s much more to recommending beers- read more about it in &lt;a href=&quot;http://blog.everymansoftware.com/2012/02/similarity-based-recommendation-engines.html&quot; target=&quot;_blank&quot;&gt;Josh&#39; post&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #232323; font: normal normal normal 13px/normal Arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;-Luanne&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #232323; font: 13.0px Arial; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/4586866331789745257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/4586866331789745257' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4586866331789745257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4586866331789745257'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2012/02/similarity-based-recommendations-with.html' title='Similarity based recommendations with Cypher'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-7255779727443991911</id><published>2012-02-25T10:19:00.002+05:30</published><updated>2012-02-25T23:20:49.383+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="d3.js"/><category scheme="http://www.blogger.com/atom/ns#" term="flavorwocky"/><category scheme="http://www.blogger.com/atom/ns#" term="heroku"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4jchallenge"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>Flavor of the month- Neo4j and Heroku, part 2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Continuing from the previous &lt;a href=&quot;http://thought-bytes.blogspot.in/2012/02/flavor-of-month-neo4j-add-on-for-heroku.html&quot; target=&quot;_blank&quot;&gt;post&lt;/a&gt;&lt;link&gt;&lt;/link&gt;, here are the features we used for the first version of &lt;a href=&quot;http://flavorwocky.herokuapp.com/&quot; target=&quot;_blank&quot;&gt;Flavorwocky&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Set up&lt;/span&gt;:&lt;br /&gt;
When the application starts up, we check if the database is empty. To do this, we perform a &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-traverse.html&quot; target=&quot;_blank&quot;&gt;traversal&lt;/a&gt; from the reference node looking for any categories connected to it. If there are none, then we go ahead and create the set of categories by first &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-nodes.html#rest-api-create-node-with-properties&quot; target=&quot;_blank&quot;&gt;creating their nodes&lt;/a&gt;, and then a &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-relationships.html#rest-api-create-relationship&quot; target=&quot;_blank&quot;&gt;relationship&lt;/a&gt; to the reference node. We also &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-indexes.html#rest-api-create-node-index&quot; target=&quot;_blank&quot;&gt;create the index&lt;/a&gt; &quot;ingredients&quot;, which is used to index ingredient names. Source code: &lt;a href=&quot;https://github.com/luanne/flavorwocky/blob/master/grails-app/conf/BootStrap.groovy&quot; target=&quot;_blank&quot;&gt;https://github.com/luanne/flavorwocky/blob/master/grails-app/conf/BootStrap.groovy&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Add pairing&lt;/span&gt;:&lt;br /&gt;
Adding a pairing involves&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Checking whether either node already exists to avoid recreating it&lt;/li&gt;
&lt;li&gt;Creating both nodes and linking them to their categories in a single transaction&lt;/li&gt;
&lt;li&gt;Creating a relationship between them in the same transaction above&lt;/li&gt;
&lt;/ul&gt;
To accomplish this, we used the &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-batch-ops.html&quot; target=&quot;_blank&quot;&gt;Batch operation&lt;/a&gt; (note, this is still experimental).&lt;br /&gt;
Source: &lt;a href=&quot;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&quot; target=&quot;_blank&quot;&gt;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&lt;/a&gt; (fetchOrCreateNodes())&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Auto complete&lt;/span&gt;: This was just an &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-indexes.html#rest-api-find-node-by-query&quot; target=&quot;_blank&quot;&gt;index lookup&lt;/a&gt; matching the partially entered ingredient by name. Source: &lt;a href=&quot;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&quot; target=&quot;_blank&quot;&gt;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&lt;/a&gt; (autosearch())&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Visualization&lt;/span&gt;:&lt;br /&gt;
We used &lt;a href=&quot;http://mbostock.github.com/d3/ex/&quot; target=&quot;_blank&quot;&gt;d3.js&lt;/a&gt; to provide two visualizations for the search results. The &quot;Explore&quot; visualization is based on the &lt;a href=&quot;http://mbostock.github.com/d3/ex/tree.html&quot; target=&quot;_blank&quot;&gt;Node-Link tree&lt;/a&gt;; we used a &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-cypher.html#rest-api-send-queries-with-parameters&quot; target=&quot;_blank&quot;&gt;Cypher query&lt;/a&gt; to find all ingredients that pair with the searched ingredient up to 3 levels deep, transform it into the appropriate data structure, and render it as JSON. Note, although the visualization interactive, the fetching of data is not. The entire set of data for 3 levels is grabbed at once- a future enhancement would be fetching children only when you expand a node.&lt;br /&gt;
Source: &lt;a href=&quot;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&quot; target=&quot;_blank&quot;&gt;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&lt;/a&gt; (getSearchVisualizationAsTreeJson())&lt;br /&gt;
&lt;br /&gt;
Although the tree is pretty slick, one shortcoming is that it is a tree- so if children are linked to each other, then you see multiple instances of that ingredient in the tree. Hence we tried another visualization to capture the interconnections between ingredients and also surface interesting facts such as flavor trios- there&#39;s a pretty high chance that if you see a triangle in the network visualization, those three ingredients can be combined together well.&lt;br /&gt;
We used the &lt;a href=&quot;http://mbostock.github.com/d3/ex/force.html&quot; target=&quot;_blank&quot;&gt;Force directed graph&lt;/a&gt; for this. Again, a &lt;a href=&quot;http://docs.neo4j.org/chunked/stable/rest-api-cypher.html#rest-api-send-queries-with-parameters&quot;&gt;Cypher query&lt;/a&gt; came to the rescue (this time 5 levels deep to produce a richer model).&lt;br /&gt;
Source: &lt;a href=&quot;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&quot; target=&quot;_blank&quot;&gt;https://github.com/luanne/flavorwocky/blob/master/grails-app/controllers/com/herokuapp/flavorwocky/FlavorwockyController.groovy&lt;/a&gt; (getSearchVisualizationAsNetworkJson())&lt;br /&gt;
&lt;br /&gt;
In both examples, the affinity of the pairing is used to calculate the length of the connector between ingredients, indicating shorter connections have ingredients that pair much better than those with longer connections.&lt;br /&gt;
&lt;br /&gt;
That&#39;s about it! There&#39;s so much more than can be done with this application, but it&#39;s going to have to wait for a bit.&lt;br /&gt;
Again, please &lt;a class=&quot;twitter-share-button&quot; href=&quot;https://twitter.com/share&quot; lang=&quot;hu&quot;&gt;tweet&lt;/a&gt; about &lt;a href=&quot;http://flavorwocky.herokuapp.com/&quot; target=&quot;_blank&quot;&gt;Flavorwocky&lt;/a&gt; if you like it or just want me to win. &lt;a href=&quot;http://gensen.herokuapp.com/show/27&quot; target=&quot;_blank&quot;&gt;Voting&lt;/a&gt; also helps!&lt;br /&gt;
&lt;br /&gt;
-Luanne&lt;br /&gt;
&lt;a href=&quot;https://github.com/luanne/flavorwocky/blob/master/grails-app/conf/BootStrap.groovy&quot;&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/7255779727443991911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/7255779727443991911' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/7255779727443991911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/7255779727443991911'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2012/02/flavor-of-month-neo4j-and-heroku-part-2.html' title='Flavor of the month- Neo4j and Heroku, part 2'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-212487753757707684</id><published>2012-02-25T10:13:00.001+05:30</published><updated>2012-02-25T23:21:13.905+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="flavorwocky"/><category scheme="http://www.blogger.com/atom/ns#" term="heroku"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4jchallenge"/><category scheme="http://www.blogger.com/atom/ns#" term="nosql"/><title type='text'>Flavor of the month- Neo4j add-on for Heroku</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://neo4j.org/&quot; target=&quot;_blank&quot;&gt;Neo4j&lt;/a&gt; launched a challenge earlier this year called &quot;&lt;a href=&quot;http://neo4j-challenge.herokuapp.com/&quot; target=&quot;_blank&quot;&gt;Seed the Cloud&lt;/a&gt;&quot; to get folks to create templates or demo applications on &lt;a href=&quot;http://www.heroku.com/&quot; target=&quot;_blank&quot;&gt;Heroku&lt;/a&gt; using the &lt;a href=&quot;https://addons.heroku.com/neo4j&quot; target=&quot;_blank&quot;&gt;Neo4j add-on&lt;/a&gt;. After much internal debate, I decided to enter, only to be thrown into despair for lack of an idea. The idea came to me while I was doing nothing in particular- to build a simple app that would help one find ingredients whose flavors complement one another.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Basically, you have these ingredients that pair really well together- knowing which ingredients have flavor affinities can produce some amazing new dishes.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
The app allows you to add pairings with an &#39;affinity&#39;- how well they pair together- and search for an ingredient to find others that pair with it. &lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The app is built using Grails 2.0 for the front end, visualizations are the result of the very neat &lt;a href=&quot;http://mbostock.github.com/d3/&quot; target=&quot;_blank&quot;&gt;d3.js&lt;/a&gt; library, and interaction with Neo4j is done using the Neo4j REST Api.&lt;br /&gt;
The entire thing is deployed on Heroku (with the Neo4j add-on), while the source is available on &lt;a href=&quot;https://github.com/luanne/flavorwocky&quot; target=&quot;_blank&quot;&gt;github&lt;/a&gt;&lt;br /&gt;
To get started with Grails 2.0, Neo4j add-on and Heroku, read Aldrins post on the topic:&amp;nbsp;&lt;a href=&quot;http://thought-bytes.blogspot.in/2012/02/grails-20-heroku-and-neo4j-addon.html&quot; target=&quot;_blank&quot;&gt;http://thought-bytes.blogspot.in/2012/02/grails-20-heroku-and-neo4j-addon.html&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
How to deploy Flavorwocky locally as well as on Heroku is documented in the &lt;a href=&quot;https://github.com/luanne/flavorwocky/blob/master/README.md&quot; target=&quot;_blank&quot;&gt;Readme&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The model lends itself very nicely to a graph- as you can see, it is very simple:&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh7RV6jbm-B1UVfqUlGUA7Q2Oh7UGPxUW_u_iG6vwGbpwLRGnXhtw0X4Tq1UcGPuhYDP4J_QAcb9mVqjJMGE7KHpDP1b0yxHRLfIPgZLaKZoClUrf9wxf4LTfK9-E74AypErqHu1hD1yE/s1600/diagram.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5711820038767961122&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh7RV6jbm-B1UVfqUlGUA7Q2Oh7UGPxUW_u_iG6vwGbpwLRGnXhtw0X4Tq1UcGPuhYDP4J_QAcb9mVqjJMGE7KHpDP1b0yxHRLfIPgZLaKZoClUrf9wxf4LTfK9-E74AypErqHu1hD1yE/s320/diagram.png&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 226px; margin: 0px auto 10px; text-align: center; width: 320px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;insert here=&quot;&quot; model=&quot;&quot;&gt;&lt;/insert&gt;&lt;/div&gt;
&lt;div&gt;
Every category is color coded- for convenience, it is stored as a property on the category node, but of course, it doesn&#39;t have to be.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Flavorwocky was also picked as the basis for this challenge because it is a real world use case for a graph, and I wanted this entry to really focus on Neo4j primarily rather than supporting bells and whistles. The features of the Neo4j REST api used in this app will be the topic of the next post.&lt;link&gt;&lt;/link&gt;&lt;/div&gt;
&lt;div&gt;
Gentle reminder: Please &lt;a class=&quot;twitter-share-button&quot; count=&quot;0&quot; hashtags=&quot;neo4jchallenge&quot; href=&quot;https://twitter.com/share&quot; lang=&quot;hu&quot; text=&quot;I love Flavorwocky - Neo4J &amp;amp; Heroku Challenge App&quot; url=&quot;http://flavorwocky.herokuapp.com&quot; via=&quot;luannem&quot;&gt;tweet&lt;/a&gt; about &lt;a href=&quot;http://flavorwocky.herokuapp.com/&quot; target=&quot;_blank&quot;&gt;Flavorwocky&lt;/a&gt; if you like it or just want me to win. &lt;a href=&quot;http://gensen.herokuapp.com/show/27&quot; target=&quot;_blank&quot;&gt;Voting&lt;/a&gt; also helps!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
-Luanne&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/212487753757707684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/212487753757707684' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/212487753757707684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/212487753757707684'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2012/02/flavor-of-month-neo4j-add-on-for-heroku.html' title='Flavor of the month- Neo4j add-on for Heroku'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh7RV6jbm-B1UVfqUlGUA7Q2Oh7UGPxUW_u_iG6vwGbpwLRGnXhtw0X4Tq1UcGPuhYDP4J_QAcb9mVqjJMGE7KHpDP1b0yxHRLfIPgZLaKZoClUrf9wxf4LTfK9-E74AypErqHu1hD1yE/s72-c/diagram.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-1009498958942020528</id><published>2012-02-25T10:07:00.000+05:30</published><updated>2012-03-06T12:09:07.741+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="heroku grails neo4j"/><title type='text'>Grails 2.0, Heroku and Neo4j addon</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
This post will help you get started with Grails 2.0 on Heroku with the Neo4j addon.&lt;br /&gt;
&lt;i&gt;This largely follows the guide at &lt;a href=&quot;http://devcenter.heroku.com/articles/grails&quot;&gt;http://devcenter.heroku.com/articles/grails&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Note: This does not use the Grails Neo4j plugin (&lt;a href=&quot;http://grails.org/plugin/neo4j&quot;&gt;http://grails.org/plugin/neo4j&lt;/a&gt;), since I couldn&#39;t get it working with Grails 2.0 (Will post an update as and when I can)&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;(&lt;b&gt;Update&lt;/b&gt;: here&#39;s the one with the neo4j plugin&lt;a href=&quot;http://thought-bytes.blogspot.in/2012/03/getting-started-with-grails-neo4j.html&quot;&gt;&amp;nbsp;http://thought-bytes.blogspot.in/2012/03/getting-started-with-grails-neo4j.html&lt;/a&gt;)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Create the grails app&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;grails create-app heroku-neo4j&lt;br /&gt;
&amp;gt;cd heroku-neo4j&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Delete the DataSource.groovy&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;del grails-app\conf\DataSource.groovy&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Check into Git&lt;/b&gt;&lt;br /&gt;
Create a .gitignore file for ignored files and check into git&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
*.iws&lt;br /&gt;
*Db.properties&lt;br /&gt;
*Db.script&lt;br /&gt;
.settings&lt;br /&gt;
.classpath&lt;br /&gt;
.project&lt;br /&gt;
eclipse&lt;br /&gt;
stacktrace.log&lt;br /&gt;
target&lt;br /&gt;
/plugins&lt;br /&gt;
/web-app/plugins&lt;br /&gt;
/web-app/WEB-INF/classes&lt;br /&gt;
web-app/WEB-INF/tld/c.tld&lt;br /&gt;
web-app/WEB-INF/tld/fmt.tld&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;git init&lt;br /&gt;
&amp;gt;git add .&lt;br /&gt;
&amp;gt;git commit -m init&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Create a Heroku app&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;heroku create --stack cedar&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;...and deploy&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;git push heroku master&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Check it out in the browser&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;heroku open&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Add the Neo4J addon&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;heroku addons:add neo4j:test&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Install the Grails Rest plugin&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;gt;grails install-plugin rest&lt;/blockquote&gt;
&lt;br /&gt;
Now you can access the Neo4J datastore on Heroku via its REST interface. For example, to create new node from a controller,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
import static groovyx.net.http.ContentType.JSON&lt;br /&gt;
&amp;nbsp; &amp;nbsp; withRest(id: &quot;neo4j&quot;, uri: &quot;&amp;lt;REST-URL&amp;gt;&quot;) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; auth.basic &#39;&amp;lt;login&amp;gt; &#39;, &#39;&amp;lt;password&amp;gt; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def response = post(contentType:JSON, requestContentType:JSON, body: [&#39;name&#39;: &#39;Artichoke&#39;] )&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; render response.status&lt;br /&gt;
&amp;nbsp; &amp;nbsp; render response.data&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;REST-URL&amp;gt;&amp;nbsp;, &amp;lt;login&amp;gt;&amp;nbsp;&amp;nbsp;and &amp;lt;password&amp;gt;&amp;nbsp;&amp;nbsp;with your Neo4J instance&#39;s settings.&lt;br /&gt;
&lt;br /&gt;
-Aldrin&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/1009498958942020528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/1009498958942020528' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/1009498958942020528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/1009498958942020528'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2012/02/grails-20-heroku-and-neo4j-addon.html' title='Grails 2.0, Heroku and Neo4j addon'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-6331943841209148345</id><published>2012-02-07T15:43:00.002+05:30</published><updated>2012-02-07T15:43:55.514+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="maven tips workarounds local repository skiptests"/><title type='text'>Getting Maven to just run - tips, workarounds</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;div&gt;Recently, I was trying to run an inherited project, but couldn&#39;t get maven to compile. Some local libs were not being picked up by maven. I had to add it manually to the local maven repo. So, when you have a library your project is dependent on and you cannot find it on a public maven repository, then you can add it to your local repository as below:&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;i&gt;mvn install:install-file -Dfile=C:\my-awesome-api-1.0.jar -DgroupId=com.awesome -DartifactId=awesome-api -Dversion=1.0 -Dpackaging=jar&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then add a &amp;lt;dependency&amp;gt; to your pom.xml,&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;i&gt;&amp;lt;dependency&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&amp;lt; groupId&amp;gt;com.awesome &amp;lt; /groupId&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&amp;lt; artifactId&amp;gt;awesome-api &amp;lt; /artifactId&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&amp;lt; version&amp;gt;1.0 &amp;lt; /version&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&amp;lt; /dependency&amp;gt;&lt;/i&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once the compilation went through successfully, the test started failing. If you don&#39;t particularly care about the tests, then you can skip it at any time by adding -Dmaven.test.skip=true or -DskipTests=true to the command line,&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;ex. &amp;gt; mvn:package -DskipTests=true&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/6331943841209148345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/6331943841209148345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/6331943841209148345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/6331943841209148345'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2012/02/getting-maven-to-just-run-tips.html' title='Getting Maven to just run - tips, workarounds'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-2686516064693567786</id><published>2011-02-03T13:24:00.011+05:30</published><updated>2011-02-03T14:31:11.444+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="arbor.js"/><category scheme="http://www.blogger.com/atom/ns#" term="graphical org chart"/><category scheme="http://www.blogger.com/atom/ns#" term="graphical organization chart"/><category scheme="http://www.blogger.com/atom/ns#" term="graphs"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="org chart"/><category scheme="http://www.blogger.com/atom/ns#" term="visualization"/><title type='text'>Graph visualization with Neo4J and Arbor.js</title><content type='html'>&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;As you might have gathered from my previous post, I have been tinkering with &lt;/span&gt;&lt;a style=&quot;font-family: georgia;&quot; href=&quot;http://neo4j.org/&quot;&gt;Neo4J&lt;/a&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt; lately and I am beginning to appreciate the power and elegance of graphs.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;I also came across &lt;/span&gt;&lt;a style=&quot;font-family: georgia;&quot; href=&quot;http://arborjs.org/&quot;&gt;Arbor.js&lt;/a&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt; and was bowled over by it. Loved the force directed layouts and the fact that if you are patient, you will watch your nodes traveling far and wide to settle in their final destination. No need to drag, drop or re-organize the graph- what emerges is a visual pattern, obvious to the eye. I can think of tons of usages for such a visualization, but thought I&#39;d start with something simple just to get the feel of it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;I decided to model a simple organization chart or graph. So off I went to create that model in Neo4J, fed data into it, and my graph was ready very quickly.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;On to Arbor.js- I must admit, I was rather stumped, even with the reference doc they publish. I did not know where to start and where to end- of course, my lack of knowledge around jQuery syntax contributed a lot.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;So, I did the next best thing which was to get the &lt;/span&gt;&lt;a style=&quot;font-family: georgia;&quot; href=&quot;https://github.com/samizdatco/arbor/tree/master/docs/sample-project&quot;&gt;sample project&lt;/a&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt; working locally. Tweak main.js to play with the layout and understand what&#39;s really happening. Scroll right down to the $(document).ready function to see the &#39;ParticleSystem&#39; getting initialized. The sample project initializes with three parameters: repulsion, stiffness  and friction. There are more available like frames per second and precision, but I have not tried them yet. Play with those values to see how they affect the graph. I settled on: &lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 153);&quot;&gt;var sys = arbor.ParticleSystem(500, 600, 0.5)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;I also left&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt; gravity=true&lt;/span&gt; since I definitely want the settling graph.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;You can then add edges and nodes to the ParticleSystem object you just initialized.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;Adding a node is as simple as sys.addNode(name,data).&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;The name you supply functions as an identifier of the node and the data is an object you can use to associate any set of parameters with this node. These are especially useful when you need additional information about the node to render it- for example, set its color.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;Adding an edge is just as simple: sys.addEdge(source,target,data). Source and target nodes are identified by their node names, and data again is an object of parameters to associate with the edge.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;Now the sample project displays little black boxes for nodes. I was looking for something more like circular nodes with their labels in them- much like the arbor.js home page.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;&lt;br /&gt;&lt;br /&gt;Just adding nodes and edges does not do anything- the ParticleSystem needs a renderer to well, render the graph. The arbor.js reference will tell you that you need to create an object with two methods- init and redraw, and set your ParticleSystem renderer to this object.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;If you look at &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:georgia;font-size:100%;&quot;  &gt;main&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;.js, this is exactly what it does (viewport is the canvas object in which to render the graph)-&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre  style=&quot;font-family:georgia;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot; class=&quot;nx&quot;  &gt;sys&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot; class=&quot;p&quot;  &gt;.&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot; class=&quot;nx&quot;  &gt;renderer&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot;  &gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot; class=&quot;o&quot;  &gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot;  &gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot; class=&quot;nx&quot;  &gt;Renderer&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot; class=&quot;p&quot;  &gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:100%;&quot; class=&quot;s2&quot;  &gt;&quot;#viewport&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;  style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The init method in this case simply sets up screen dimensions.&lt;br /&gt;The redraw method is the one responsible for painting nodes and edges. You will see those in the&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;nx&quot;&gt;particleSystem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;eachEdge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt; and &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;particleSystem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;eac&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;hNode loops.&lt;br /&gt;&lt;br /&gt;So then this is the place to tweak the actual representation of nodes and edges.&lt;br /&gt;Borrowing from the source of the arbor.js home page, I changed the code to:&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;particleSystem.eachNode(function(node, pt){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;        &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;var w = Math.max(20, 20+gfx.textWidth(node.name) )&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;if (node.data.alpha===0) return&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  if (node.data.shape==&#39;dot&#39;){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      gfx.oval(pt.x-w/2, pt.y-w/2, w, w, {fill:node.dat&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;p&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;a.color, alpha:node.data.alpha})&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      gfx.text(node.name, pt.x, pt.y+7, {color:&quot;white&quot;, align:&quot;center&quot;, font:&quot;Arial&quot;, size:12})&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      gfx.text(node.name, pt.x, pt.y+7, {color:&quot;white&quot;, align:&quot;center&quot;, font:&quot;Arial&quot;, size:12})&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  }else{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      gfx.rect(pt.x-w/2, pt.y-8, w, 20, 4, {fill:node.data.color, alpha:node.data.alpha})&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      gfx.text(node.name, pt.x, pt.y+9, {color:&quot;white&quot;, align:&quot;center&quot;, font:&quot;Arial&quot;, size:12})&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      gfx.text(node.name, pt.x, pt.y+9, {color:&quot;white&quot;, align:&quot;center&quot;, font:&quot;Arial&quot;, size:12})&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;})&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;You will note that the color of the node is pulled from the data object attached to the node.&lt;br /&gt;The font, size, width etc. can all be parametrized by setting them in the data object when you create the node.&lt;br /&gt;This example uses the graphics library, so be sure to include graphics.js in your html.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For the edges, I changed the color and also parametrized the thickness of the connector line by the width parameter.&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;particleSystem.eachEdge(function(edge, pt1, pt2){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;if (edge.source.data.alpha * edge.target.data.alpha == 0) return&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      gfx.line(pt1, pt2, {stroke:&quot;#151B8D&quot;, width:(edge.data.weight/2), alpha:edge.target.data.alpha})&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;       })&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That is sufficient for a basic graph representation. Now to get the data out of Neo4J and into the graph.&lt;br /&gt;The ParticleSystem has a graft method which accepts an object in the form &lt;/span&gt;&lt;code&gt;{nodes:{}, edges:{}}.&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;These nodes and &lt;/span&gt;&lt;/code&gt;edges are added to the particle system.&lt;br /&gt;I navigated through my Neo4J graph and spat out the data in this json like format.&lt;br /&gt;&lt;br /&gt;Then, in the JS, you simply do a&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:85%;&quot;  &gt;var data = $.getJSON(&quot;orgChart.json&quot;,function(data){&lt;br /&gt;  sys.graft({nodes:data.nodes, edges:data.edges})&lt;br /&gt;})&lt;/span&gt;&lt;br /&gt;and you&#39;re done.&lt;br /&gt;Just make sure you enclose each attribute in quotes- for example, color and shape in the code below.&lt;br /&gt;And it also freaks if you supply a .8 instead of a 0.8 for the length attribute in this example.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The final graph rendered in my browser looks like this(click to enlarge)-&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span&gt;&lt;span class=&quot;p&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span class=&quot;p&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span class=&quot;p&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span class=&quot;p&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr7m-U36eUhaII3B1wKjLYrrzJp2xBWO974p54deatWvAK4EPAuDPQcup_5KDKfWgZ6ZGT3n_hlML38R9zovDkAPGCMzatpDpClvo963qqDfH30NABm3eHyLQl5OEOJRiZhoffJn4lXxc/s1600/orgChart.PNG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 482px; height: 207px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr7m-U36eUhaII3B1wKjLYrrzJp2xBWO974p54deatWvAK4EPAuDPQcup_5KDKfWgZ6ZGT3n_hlML38R9zovDkAPGCMzatpDpClvo963qqDfH30NABm3eHyLQl5OEOJRiZhoffJn4lXxc/s320/orgChart.PNG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5569380873195977506&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;This really just scratches the surface of what you can do with arbor.js&lt;br /&gt;Add to it the various types of graphs or models you can extract out of Neo4J, and you could build some great stuff!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;orgChart.json contains the following-&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-size:85%;&quot; &gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;{&quot;nodes&quot;:{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Aidan&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Sofia&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Liam&quot;:{&quot;color&quot;:&quot;GoldenRod&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Charlotte&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Noah&quot;:{&quot;color&quot;:&quot;GoldenRod&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Ava&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Jackson&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Addison&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Ethan&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Olivia&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Kayden&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Amelia&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Mason&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Lily&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Logan&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Isabella&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Jacob&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Emma&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Benjamin&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Abigail&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Caleb&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Scarlet&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Owen&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Audrey&quot;:{&quot;color&quot;:&quot;GoldenRod&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Gavin&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Grace&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Connor&quot;:{&quot;color&quot;:&quot;green&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Claire&quot;:{&quot;color&quot;:&quot;GoldenRod&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Riley&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Emily&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Nolan&quot;:{&quot;color&quot;:&quot;lightblue&quot;, &quot;shape&quot;:&quot;rectangle&quot;, &quot;alpha&quot;:1},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Quinn&quot;:{&quot;color&quot;:&quot;red&quot;, &quot;shape&quot;:&quot;dot&quot;, &quot;alpha&quot;:1}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&quot;edges&quot;:{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Quinn&quot;:{&quot;Liam&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Audrey&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Noah&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Claire&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Liam&quot;:{&quot;Sofia&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Ethan&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Amelia&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Audrey&quot;:{&quot;Aidan&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;               &quot;Ava&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Jackson&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Claire&quot;:{&quot;Charlotte&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Olivia&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Noah&quot;:{&quot;Addison&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Kayden&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Olivia&quot;:{&quot;Mason&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Lily&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Ethan&quot;:{&quot;Logan&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Isabella&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Addison&quot;:{&quot;Jacob&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Emma&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Benjamin&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   &quot;Emma&quot;:{&quot;Abigail&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Caleb&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;    &quot;Logan&quot;:{&quot;Scarlet&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Owen&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Gavin&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;    &quot;Lily&quot;:{&quot;Connor&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Grace&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Nolan&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;    &quot;Connor&quot;:{&quot;Riley&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           &quot;Emily&quot;:{&quot;length&quot;:2.5,&quot;weight&quot;:2}},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:85%;&quot;  &gt;&lt;span class=&quot;p&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;font-size:85%;&quot;  &gt;   &lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/2686516064693567786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/2686516064693567786' title='26 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/2686516064693567786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/2686516064693567786'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2011/02/graph-visualization-with-neo4j-and.html' title='Graph visualization with Neo4J and Arbor.js'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr7m-U36eUhaII3B1wKjLYrrzJp2xBWO974p54deatWvAK4EPAuDPQcup_5KDKfWgZ6ZGT3n_hlML38R9zovDkAPGCMzatpDpClvo963qqDfH30NABm3eHyLQl5OEOJRiZhoffJn4lXxc/s72-c/orgChart.PNG" height="72" width="72"/><thr:total>26</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-4259985205666759511</id><published>2010-12-13T16:52:00.006+05:30</published><updated>2010-12-13T17:00:29.370+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="exceptions"/><category scheme="http://www.blogger.com/atom/ns#" term="neo4j"/><category scheme="http://www.blogger.com/atom/ns#" term="runtime exceptions"/><title type='text'>RuntimeExceptions and Neo4J</title><content type='html'>I&#39;m currently working with Neo4J(&lt;a style=&quot;color: rgb(51, 51, 255);&quot; href=&quot;http://www.neo4j.org/&quot;&gt;http://www.neo4j.org&lt;/a&gt;) - in the evaluation stage really, trying out various use cases. TestNG is my test framework of choice, so most of my work is driven by it.&lt;br /&gt;What really irritated me is the fact that some tests failed. When I looked at the TestNG report, I found that in some cases my test data was bad, so in effect, I was creating a self relationship (which Neo4J frowns upon). There were also cases where, during trial and error, I did not clean the db so I ended up doing a node.getSingleRelationship and instead of one relationship, there were more.&lt;br /&gt;&lt;br /&gt;So why was I irritated? My test cases did fail due to an exception. However, they were Runtime exceptions. When I wrote the code, I did not think they may be thrown- I did not look at the JavaDoc in detail- just used IntelliJ to show me what I could possibly do with Node, and winged it from there. So, when my test failed, I was a bit disbelieving. First checked the exception- and it was a Runtime exception (duh). Then pulled up the JavaDoc and saw that Neo4J does indeed indicate an exception can be thrown in these cases.&lt;br /&gt;This caused me to tweet about Neo4J and their runtime exception philosophy. (Pleasantly surprised to see&lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt; &lt;/span&gt;&lt;a style=&quot;color: rgb(51, 51, 255);&quot; href=&quot;http://twitter.com/emileifrem&quot;&gt;@emileifrem&lt;/a&gt; respond to it)&lt;br /&gt;&lt;br /&gt;Anyway, somewhere in one of many open windows, I happened to search for any such issues related to Neo4J. I came across Stephen Colebourne&#39;s blog instead (&lt;a style=&quot;color: rgb(51, 51, 255);&quot; href=&quot;http://www.jroller.com/scolebourne/entry/checked_exceptions_bijava&quot;&gt;http://www.jroller.com/scolebourne/entry/checked_exceptions_bijava&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;So really, did it matter whether Neo4J threw RuntimeExceptions or not? Apart from the test results, which were surprising because I neglected to read the JavaDoc in detail, I went through some exceptions that Neo4J throws (leaving out the very obvious Runtime exceptions).&lt;br /&gt;Now if a DeadlockDetectedException, HaCommunicationException, NotFoundException(thrown if a request is made to a node, relationship or property that does not exist), NotInTransactionException, ReadOnlyIndexException or TransactionFailureException were thrown, what would I really do about it? Nothing much, unfortunately. There is no way I could be smart and recover from these. At the most I&#39;d log it and re-throw it.&lt;br /&gt;&lt;br /&gt;Now on to the ones I was disturbed with- methods mostly on the Node.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;getSingleRelationship()&lt;/span&gt; which (as the name indicated) returns the only relationship of a given type and direction. Well, the fact that I&#39;m using this method does mean that I really expect there to be just one relationship, so when a runtime exception is thrown, there is no way to recover from it.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;delete() &lt;/span&gt;throws a RuntimeException if it has relationships attached to it. Can I do anything about it? Maybe- depending on functionality, I might attempt to do a cascade delete and re-try the operation. Not sure how many use cases would really want a cascade delete though.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;createRelationshipTo() &lt;/span&gt;throws a RuntimeException if you try to create a self relationship. Note here, that the JavaDoc does not specify this in the Throws, but rather in the description. This arguably could be dealt with by creating an intermediate node- but at the same time, this situation can easily be avoided by defensively coding for it.&lt;br /&gt;&lt;br /&gt;So did it really matter that Neo4J threw Runtime exceptions? After a lot of thought, not really. Why some exceptions are true classes of RuntimeException and why some (the Node exceptions) are just RuntimeExceptions in themselves, I am not sure. The source does not indicate that they do anything over and above being a RuntimeException.&lt;br /&gt;Does it really matter that there is a split convention? I&#39;d think if I needed to recover from a delete exception, then it does matter.&lt;br /&gt;It will be interesting to see as I develop more with Neo4J, how much these Runtime exceptions come into play and whether they are really as disturbing as I initially thought.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;Disclaimer: &lt;/span&gt;I still do not believe that we should do away with checked exceptions altogether :-)</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/4259985205666759511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/4259985205666759511' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4259985205666759511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4259985205666759511'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2010/12/runtimeexceptions-and-neo4j.html' title='RuntimeExceptions and Neo4J'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-1403854574057269240</id><published>2010-04-16T08:47:00.003+05:30</published><updated>2010-04-16T09:12:33.123+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="coding practices"/><category scheme="http://www.blogger.com/atom/ns#" term="coverage"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="testing"/><title type='text'>If you aint going to use it, don&#39;t write it</title><content type='html'>It&#39;s interesting to see how engineers &quot;follow processes&quot; that they don&#39;t agree with. They might not agree with it because maybe they haven&#39;t understood the value it provides to them (after all, they are typically not dumb guys), or they are not provided with adequate time to follow them, or they are just plain stupid (the processes- not the engineers).&lt;br /&gt;&lt;br /&gt;I&#39;ve written about testing before. Once I realized its value, I don&#39;t go anywhere without my tests (so to speak). Now you can preach about it all you want but unless engineers try it, do it properly, and realize the value they lend to our complicated lives, they&#39;re not going to write them. Now take those engineers and tell them that they &lt;span style=&quot;font-style: italic;&quot;&gt;must &lt;/span&gt;write tests. First, everyone ignores the new law. Then they&#39;re reminded and now it&#39;s an exit criteria with one more requirement- coverage numbers.&lt;br /&gt;So, what happens? They produce tests. They run them and get them to pass and management is happy. But what are the value of those tests? Are they maintained? Are they used to help verify that they didn&#39;t break anything when the next feature comes along? There are even interesting cases where tests haven&#39;t been run as part of builds for months on end and nobody noticed. Which says to me &quot;delete those tests&quot;. If nobody cares about those poor things, it is more merciful to end their lives.&lt;br /&gt;&lt;br /&gt;If you&#39;re not going to get value out of code you&#39;ve written, then it is better not to have written it in the first place. I&#39;m sure you can think of better ways to use your time (even if it&#39;s taking a nap).&lt;br /&gt;&lt;br /&gt;-Luanne</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/1403854574057269240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/1403854574057269240' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/1403854574057269240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/1403854574057269240'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2010/04/if-you-aint-going-to-use-it-dont-write.html' title='If you aint going to use it, don&#39;t write it'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-5265388059385037648</id><published>2010-04-01T22:42:00.003+05:30</published><updated>2010-04-01T23:32:29.917+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="annotations"/><category scheme="http://www.blogger.com/atom/ns#" term="design"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="marker interface"/><title type='text'>Marker Interfaces- what are they marking?</title><content type='html'>This might be a controversial statement, but I dislike marker interfaces. Yes, I get that the Serializable marker interface, for example, has a purpose. Let me amend that statement to &#39;I dislike marker interfaces with no clear intent&#39;.&lt;br /&gt;&lt;br /&gt;An interface specifies a contract. &lt;span style=&quot;font-style: italic;&quot;&gt;If you implement me, then you must provide these services. &lt;/span&gt;&lt;br /&gt;An empty interface cannot specify a contract because, well, it doesn&#39;t have one to offer. It is more of a tagging mechanism. It says, if you implement me, then you&#39;re tagged in this manner. But, in most of the cases I&#39;ve seen, nothing is done with this information. OK, so the class is tagged- but what the heck does that mean? Does it mean the class behaves in a certain manner? Does it mean the class can offer these services? Who knows? More often than not, marker interfaces are used as a handy mechanism to refer to classes that implement it, in a uniform manner, without the hassle of inheritance. That&#39;s about it. Which is why you&#39;ll find code riddled with if-then-elses that do an instanceOf. Kind of defeats the purpose.&lt;br /&gt;&lt;br /&gt;What is worse about  these badly designed marker interfaces, is that it&#39;s one large, no-invite-needed party; anyone and their pet elephant can tag along. Not that having the elephant would break up the party. But it isn&#39;t appropriate for the elephant to be there- the party wasn&#39;t really meant for him and passers-by would have a hard time figuring out what exactly was going on.&lt;br /&gt;&lt;br /&gt;Let&#39;s take this very example. Your event planning application has people that are invited to parties. Just as you finish designing your Person class, along comes someone and says, we also invite entertainers to the party. The entire group is to be a single guest. Of course, they&#39;re paid and they&#39;re not expected to eat the snacks, but they&#39;re on the invite list. All your nice API&#39;s that returned collections of Person to represent the entire guest list is now left wondering what to do.&lt;br /&gt;&lt;br /&gt;So what is usually done? Simple, lets introduce this marker interface:&lt;br /&gt;public interface Invitee {} and have Person and EntertainmentGroup implement it. Then all we do is change our API to return Invitees and we&#39;re done.&lt;br /&gt;What does it mean to be an invitee? &lt;span style=&quot;font-style: italic;&quot;&gt;Nothing&lt;/span&gt;.&lt;br /&gt;Now you need to find out how many snacks to order assuming that each person will eat 5. The code I see more often than not is, get a collection of Invitees from the guest list, iterate through them, check if the Invitee is an instanceOf Person- and increment the snack counter by 5.&lt;br /&gt;What did it mean to be an invitee? &lt;span style=&quot;font-style: italic;&quot;&gt;Nothing&lt;/span&gt;.&lt;br /&gt;Tomorrow when the zoo keeper is invited to the party and insists on bringing his pet elephant, what do you do? Simple. Have Elephant implement Invitee. Then when you calculate the amount of snacks to order, you add yet another check to see if the Invitee is an instanceOf Elephant and you add 50 kilos of bananas to the list.&lt;br /&gt;Ideally the Invitee class would specify what it means to be an invitee. It&#39;s behavior is predictable. When the event manager gets rich and decides that only movie stars can attend his parties, then you can no longer have Invitee extend MovieStar, unless you only know elephants that are movie stars.&lt;br /&gt;&lt;br /&gt;Unless you are doing something very concrete with the marker interface, unless you are processing that tag information in some manner, I consider it a Bad Thing.&lt;br /&gt;Tagging can be accomplished using annotations. You can selectively tag classes/methods and actually process them to do or mean something useful.&lt;br /&gt;&lt;br /&gt;What do you think? Do you see marker interfaces being used as convenience mechanisms?&lt;br /&gt;&lt;br /&gt;-Luanne</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/5265388059385037648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/5265388059385037648' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/5265388059385037648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/5265388059385037648'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2010/04/marker-interfaces-what-are-they-marking.html' title='Marker Interfaces- what are they marking?'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-1025620352378595557</id><published>2010-02-10T23:45:00.003+05:30</published><updated>2010-02-10T23:50:19.910+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="appengine"/><category scheme="http://www.blogger.com/atom/ns#" term="gae"/><category scheme="http://www.blogger.com/atom/ns#" term="grails"/><title type='text'>DeadlineExceededException on GAE with Grails</title><content type='html'>Grails on the Google App engine takes substantial time to startup and will probably exceed the hard deadline limit set by GAE. If you see a lot of &quot;DeadlineExceededException&quot; errors in your logs, you should be aware of this. There is a jira for this - &lt;a href=&quot;http://jira.codehaus.org/browse/GRAILSPLUGINS-1736&quot;&gt;http://jira.codehaus.org/browse/GRAILSPLUGINS-1736&lt;/a&gt; . Vote this up if it matters to you.</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/1025620352378595557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/1025620352378595557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/1025620352378595557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/1025620352378595557'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2010/02/deadlineexceededexception-on-gae-with.html' title='DeadlineExceededException on GAE with Grails'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-8028315126278343540</id><published>2010-02-03T17:57:00.007+05:30</published><updated>2010-02-03T18:43:55.800+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="appengine"/><category scheme="http://www.blogger.com/atom/ns#" term="gae"/><category scheme="http://www.blogger.com/atom/ns#" term="grails"/><title type='text'>Notes on Google AppEngine 1.3, Grails 1.2.1, and app engine plugin 0.8.8.</title><content type='html'>Currently in the process of upgrading a grails project to grails 1.2.1. Noted down some observations (and will keep updating as i test stuff)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;1.&lt;/span&gt;&lt;br /&gt;There doesn&#39;t seem to be a need to add the following to the Config log4j anymore (this was needed in grails 1.x see http://jira.codehaus.org/browse/GRAILSPLUGINS-1184)&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&#39;null&#39; name:&#39;stacktrace&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&lt;br /&gt;&lt;/span&gt;Had some trouble with the sessions and kept getting this error&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&lt;br /&gt;&lt;br /&gt;[java] WARNING: Nested in org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.RuntimeException: Session support is not enabled in appengine-web.xml.  To enable sessions, put &lt;/span&gt;&lt;sessions-enabled style=&quot;font-style: italic;&quot;&gt;true&lt;/sessions-enabled&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; in that file.  Without it, getSession() is allowed, but manipulation of sessionattributes is not.:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As advised in the plugin &lt;a href=&quot;http://grails.org/plugin/app-engine&quot;&gt;documentation&lt;/a&gt;, added the following to Config, but it still didn&#39;t work!&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&lt;br /&gt;&lt;br /&gt;google.appengine.sessionEnabled = true&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Had to eventually update the /web-app/WEB-INF/appengine-web.xml file and uncomment the line below&lt;projecthome&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&amp;lt;!-- &amp;lt;sessions-enabled&amp;gt;true&amp;lt;/sessions-enabled&gt; --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/projecthome&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;3.&lt;/span&gt;&lt;br /&gt;Can now user &lt;span style=&quot;font-style: italic;&quot;&gt;grails run-app&lt;/span&gt; to run the development server instead of &lt;span style=&quot;font-style: italic;&quot;&gt;grails app-engine&lt;/span&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;projecthome&gt;&lt;br /&gt;&lt;/projecthome&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/8028315126278343540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/8028315126278343540' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/8028315126278343540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/8028315126278343540'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2010/02/notes-on-google-appengine-13-grails-121.html' title='Notes on Google AppEngine 1.3, Grails 1.2.1, and app engine plugin 0.8.8.'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-693489208147569426</id><published>2007-09-06T14:13:00.000+05:30</published><updated>2007-09-06T17:45:54.027+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="refactoring"/><title type='text'>The Refactoring Quandary</title><content type='html'>&lt;span style=&quot;;font-family:georgia;font-size:100%;&quot;  &gt;&lt;span style=&quot;font-family:arial;&quot;&gt;We all know by now that refactoring is important. The problem is- when do you refactor?&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;In my opinion, the time to refactor is when the thought first crosses your mind.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Let&#39;s say you&#39;re implementing a new feature or fixing a bug. You think &#39;hmm, I seem to be duplicating code&#39; or &#39;looks like we could reorganize a bit of this&#39;. Instead of pushing the thought &#39;this could be refactored later&#39; to the back of your head where it will stay there for a very long time and come back to haunt you once your code is so messy that even you don&#39;t know how it got that way, the answer is to refactor &lt;/span&gt;&lt;span style=&quot;font-style: italic;font-family:arial;&quot; &gt;immediately&lt;/span&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;.  Do what you can to improve your code. If you don&#39;t, then you and everybody else just pass the buck on and say &quot;X will do that someday&quot;, and soon you are in programming hell. Moreover, if you refactor regularly, you most often need to just refactor small areas at a time. It&#39;s much better then saying we&#39;ll refactor this entire application- more often than not, throwing it out and restarting would be more appealing.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Of course there are reasons why people are frightened of refactoring. Acknowledging the need to refactor does not mean saying to the world &quot;I have bad code&quot;. You do not have to have glaring bugs to think of refactoring. Think of it as general housekeeping. Just because the hotel housekeeping staff cleans your room every morning does not mean you left it looking like a pig sty the night before.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Another important reason is the fear of breaking code. Which is why to refactor confidently, you need to be backed by a solid suite of test cases. If you don&#39;t, then this is a very real risk you run.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Refactoring is easier said than done. You rarely find that you&#39;ve been told to spend the next week refactoring. There are always more pressing tangible deliverables. However, it is extremely important to realize that the intangible ones will actually affect your tangible deliverables in the near future. Just as we need to consciously budget time to write  automated tests, refactoring does not happen magically either.  A small bit of effort regularly will go a long way to contributing to better manageable, extensible and flexible code.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;-Luanne&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/693489208147569426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/693489208147569426' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/693489208147569426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/693489208147569426'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2007/09/refactoring-quandary.html' title='The Refactoring Quandary'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-4943175487959523080</id><published>2007-08-24T15:10:00.000+05:30</published><updated>2007-08-24T17:29:34.423+05:30</updated><title type='text'>At the local Udipi...</title><content type='html'>So I&#39;m sitting in this udipi fast food restaurant waiting for my lunch (rawa idli - highly recommended), and I find myself observing the waiters going about their jobs. This is what typically happens:&lt;br /&gt;&lt;br /&gt;1. Customer enters, sits, decides what he wants and tells the waiter.&lt;br /&gt;&lt;br /&gt;2. Customer asks the waiter how long it will takes and the waiter gives an approximate waiting time.&lt;br /&gt;&lt;br /&gt;3. Waiter heads over to the kitchen and bellows the order to the cooks.&lt;br /&gt;&lt;br /&gt;4. If a customer gets impatient, the waiter goes to the kitchen to check and assures the customer &#39;it&#39;s almost done!&#39;.&lt;br /&gt;&lt;br /&gt;5. Once the order is ready, the waiter takes it to the customer&#39;s table and serves it to him.&lt;br /&gt;&lt;br /&gt;6. If the customer didn&#39;t like the meal, the waiter gets a earful. He smiles and goes back and abuses the cook.&lt;br /&gt;&lt;br /&gt;7. Waiter handles many customers at the same time.&lt;br /&gt;&lt;br /&gt;8. Finally the waiter hands over the bill.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;With a start I realise - it&#39;s no different from my current job. I&#39;m sort of a Project Lead. This is what I do:&lt;br /&gt;&lt;br /&gt;1. The client sends me the requirements.&lt;br /&gt;&lt;br /&gt;2. Client asks me how long it would take to deliver it. I estimate and return a figure.&lt;br /&gt;&lt;br /&gt;3. I hand the requirements over to my team, who then start working on it.&lt;br /&gt;&lt;br /&gt;4. Client gets impatient and eager to see &#39;anything&#39;, so I tell them &#39;it&#39;s 90% done!&#39;&lt;br /&gt;&lt;br /&gt;5. When it&#39;s actually done then it&#39;s released to the client&lt;br /&gt;&lt;br /&gt;6. If it&#39;s a poor quality release, then I get a earful from the client and I pass it on to my team.&lt;br /&gt;&lt;br /&gt;7. Many such requirements are being handled simultaneously.&lt;br /&gt;&lt;br /&gt;8. End of the month, I total up the time sheets for the billing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;!!!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I ate quickly, tipped the waiter handsomely and left.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Someday, I want to go back into the kitchen and be the cook...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Aldrin</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/4943175487959523080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/4943175487959523080' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4943175487959523080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/4943175487959523080'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2007/08/at-local-udipi.html' title='At the local Udipi...'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-6939723526593125582</id><published>2007-06-11T09:22:00.000+05:30</published><updated>2007-06-11T15:44:23.870+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="functional test"/><category scheme="http://www.blogger.com/atom/ns#" term="testing"/><category scheme="http://www.blogger.com/atom/ns#" term="unit test"/><title type='text'>How much can we test?</title><content type='html'>A couple of years back, I was introduced to unit testing. At the time, I found it rather tedious. Though it did expose bugs in our code early in the cycle, maintenance of test cases were becoming a nightmare. So the question is, what should you test, and how much should you test it? I&#39;ve formed some opinions along the way- tell me what your experience has been...&lt;br /&gt;&lt;br /&gt;First, every automated test is NOT a unit test. A unit test is simply a test that validates the smallest &quot;unit&quot; in your application. It could be a class, and you would be validating each operation of that class by testing its methods, for example. A test which tries to validate a business operation that spans more than one class would probably be a functional test.&lt;br /&gt;A simple example would be a Shopping Cart class. A unit test could verify that deleting items from an empty cart is not possible. A functional test would be one that validates the shopping process- add items to cart, checkout, verify bill amount.&lt;br /&gt;&lt;br /&gt;Which kinds of tests should you write? Only unit? Functional? Both?&lt;br /&gt;&lt;br /&gt;Well, unit tests are no doubt good. You should ideally write them before you write your actual code. &lt;font style=&quot;font-style: italic;&quot;&gt;Ideally&lt;/font&gt;. In the real world of the services industry at least, there are very many projects whose scope and functionality change so fast that programmers are always playing catch up with unit tests. It is simply not possible to maintain a vast number of test cases. So writing unit tests become an afterthought. And they are the very first thing axed from the budget :-)&lt;br /&gt;If we were to write comprehensive unit tests that really add value, teams would require time to do so. They would also require time to maintain them. That time is rarely granted.&lt;br /&gt;&lt;br /&gt;So, what is the next option? What about writing functional tests? Agreed, they will not provide 100% coverage, but let us assume that we could test major business flows/processes. The amount of test cases decrease, but the ROI is visible earlier on because major flaws can be uncovered before moving into system testing. There will always be bugs. Subtle bugs that even unit tests will fail to pick up. So is it worth spending time trying to think of many, many ways to break the code when the code will certainly break somewhere in a place you did not expect it to?&lt;br /&gt;I personally would write functional tests, and enhance the suite over time. For example, when a bug is reported, a test could be written for it. It could very well be a unit test. But with bugs and change requests, the suite will grow in sensible proportions.&lt;br /&gt;&lt;br /&gt;What do you think?</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/6939723526593125582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/6939723526593125582' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/6939723526593125582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/6939723526593125582'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2007/06/how-much-can-we-test.html' title='How much can we test?'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-268816201480926416</id><published>2007-05-22T08:30:00.000+05:30</published><updated>2007-05-22T14:31:37.495+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="multiple simultaneous user sessions"/><title type='text'>Preventing multiple user sessions with the same user account</title><content type='html'>Often you want to prevent the same user account being used simultaneously in different sessions (business license restrictions being one reason, complex technical synchronisation problems being another)। There are two typical strategies to prevent थिस :-&lt;br /&gt;#1. Prevent any new sessions while a session with the same user account exists.&lt;br /&gt;#2. Allow a new session, but disconnect any previous sessions if they exists.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_0&quot;&gt;Imho&lt;/span&gt;, I think #1 can be very problematic for the user. If the user faces a system crash during his session, his subsequent attempts to &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_1&quot;&gt;login&lt;/span&gt; after recovery will be thwarted. Until his previous session times out, he will be left twiddling his thumbs. Using cookies to maintain the session information would be a good idea here. If you are supporting auto-&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_2&quot;&gt;login&lt;/span&gt;, then you are already doing something like this. A session id stored in the cookie, would be enough clue to server to reconnect to the same session. You need to ensure however, that the user does a proper &#39;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_3&quot;&gt;logout&lt;/span&gt;&#39; - even going to the extent of hooking your &#39;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_4&quot;&gt;logout&lt;/span&gt;&#39; into the body unload event if the user chooses to shut the browser window, without clicking on your &#39;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_5&quot;&gt;logout&lt;/span&gt;&#39; link.&lt;br /&gt;Now what happens when a user logs into your site, shuts his browser, deletes his cookies and tries to &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_6&quot;&gt;login&lt;/span&gt; again, before his session times out ?? Let him suffer, i say ! :)&lt;br /&gt;&lt;br /&gt;#2 is much easier to implement. All you need to do is maintain a Map of user accounts with their sessions in application scope. Add a listener for session timeouts, to remove these entries from the map when the session times out. When a new session if being created, simply look up the map for previous sessions by the user and invalidate them if present and also remove them from the map.&lt;br /&gt;&lt;br /&gt;I&#39;d like to hear your comments on how you &lt;span class=&quot;blsp-spelling-corrected&quot; id=&quot;SPELLING_ERROR_7&quot;&gt;achieved&lt;/span&gt; similar requirements।&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;&quot;&gt;Cheers&lt;br /&gt;&lt;/span&gt;Aldrin</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/268816201480926416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/268816201480926416' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/268816201480926416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/268816201480926416'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2007/05/preventing-multiple-user-sessions-with.html' title='Preventing multiple user sessions with the same user account'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-7337018043206694617</id><published>2007-04-16T11:07:00.000+05:30</published><updated>2007-04-17T09:35:53.818+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="coding"/><category scheme="http://www.blogger.com/atom/ns#" term="ide"/><title type='text'>You minus IDE=helpless?</title><content type='html'>Nowadays, the IDE is your workbench. You can generate your UML, debug, run embedded servers, inspect your code, read the Dilbert strip...all from within a single application.&lt;br /&gt;&lt;br /&gt;With each release boasting nifty features, there is very little reason to leave the comfort of your IDE.&lt;br /&gt;&lt;br /&gt;Or is there?&lt;br /&gt;&lt;br /&gt;In the good old days, we had no such pleasures. I remember writing code in Notepad, and was thrilled when I discovered EditPlus. Debugging meant compiling on the command line, fixing error by error till you had a successful compile, starting tomcat and testing your web app. Today, you can do all this and more at the click of a button.&lt;br /&gt;This is certainly great news for the developer...and a very bad habit as well.&lt;br /&gt;No doubt IDE&#39;s save you a lot of trouble and time. IntelliJ IDEA has increased my productivity tremendously and helps me with a whole lot of things- including reading the Dilbert strip ;-)&lt;br /&gt;But, if I had no IntelliJ for a day, then I would still be able to code in EditPlus and look up the JavaDoc from wherever if need be, deploy my application and debug it. And that is the difference.&lt;br /&gt;&lt;br /&gt;Too often I see IDE whizzes who can do almost anything with CTRL, SHIFT or ALT and one or two keys. But take the IDE away...and they are helpless. This is Bad Thing in my opinion. The fallout of not knowing the basics is terrible. And this doesn&#39;t just apply to software.&lt;br /&gt;&lt;br /&gt;I have seen cases where for some reason, the embedded web server plugin fails for whatever reason. Everyone is examining their code and can find nothing wrong...and they&#39;re re-examining it for hours and hours. I say shut it down and deploy manually...but few know how to :-)&lt;br /&gt;In fact, very few know how to run javac !!! Turns out that the code base is fine...it was the embedded web server....hours and hours of valuable time wasted because we refused to abandon our beloved IDE.&lt;br /&gt;&lt;br /&gt;Consider this scenario- you&#39;ve developed this fantastic application, deployed it using your IDE, debugged it and it runs like a dream. Then you go to install it at the clients site. And horror of horrors, they don&#39;t have your IDE. And won&#39;t let you install it. Now what???&lt;br /&gt;You should be able to say so what? You&#39;d roll up your sleeves, check your code out of CVS or wherever, set your build properties, run ANT, deploy, start your webserver and go home in a couple of hours to have a nice drink.&lt;br /&gt;But if you know no such thing...then you&#39;ll be pleading with IT to install your IDE and when they refuse you&#39;ll have to call someone in your team and have them guide you step by step. And you&#39;ll be drowning your sorrows in many drinks after many, many tense hours. Which is a better option??&lt;br /&gt;&lt;br /&gt;I am not condemning IDE&#39;s. On the contrary. I have used a couple (and IntelliJ by far is THE best...though beware, after using it, like me, you will hate the likes of Eclipse). They are huge help. But use them after you know how to get up and running without their help. If you are developing a simple webapp, can you code a servlet for example, without the IDE? Can you compile it? Can you deploy it? Do you know how to run Tomcat? Where to find the log files?&lt;br /&gt;If yes, then go ahead...open up your IDE and be happy :-)&lt;br /&gt;&lt;br /&gt;-Luanne</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/7337018043206694617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/7337018043206694617' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/7337018043206694617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/7337018043206694617'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2007/04/you-minus-idehelpless.html' title='You minus IDE=helpless?'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8978951075400478206.post-8041330506905710006</id><published>2007-04-03T17:53:00.000+05:30</published><updated>2007-04-04T14:03:26.026+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="EJB3 JPA Hibernate HSQLDB Hello World"/><title type='text'>Hello World with standalone Java Persistence, Hibernate and HSQLDB</title><content type='html'>Lately just started reading (&amp; learning) EJB3. Because of a slow PC at home, I needed to be able to run code for the Java Persistence API in the standalone mode, without the overhead of a huge database or app server. So, I rustled up this guide to get up and running with Java Persistence. Basically all you need is a database and an implementation of the persistence API. We will use HSQL and Hibernate Entity Manager respectively. Hibernate Entity Manager runs on the Hibernate core, so will need that too.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 1: &lt;/span&gt;You will need Java 5. Get it from &lt;a href=&quot;http://java.sun.com&quot;&gt;http://java.sun.com&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://java.sun.com/&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 2:&lt;/span&gt; Download HQSLDB from &lt;a href=&quot;http://hsqldb.org/&quot;&gt;http://hsqldb.org&lt;/a&gt;. Extract into some folder (eg. D:\hsqldb)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 3: &lt;/span&gt;Download the Hibernate Entity Manager from &lt;a href=&quot;http://hibernate.org/&quot;&gt;http://hibernate.org&lt;/a&gt;. Extract into some folder. (eg. D:\hibernate-entitymanager-3.2.1.GA)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 4:&lt;/span&gt; Download the Hibernate Core from &lt;a href=&quot;http://hibernate.org/&quot;&gt;http://hibernate.org&lt;/a&gt;. Extract into some folder. (eg. D:\hibernate-3.2)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 5:&lt;/span&gt; Set up the database&lt;br /&gt;&lt;ul&gt;&lt;li&gt;          Create a new folder for all database related files we will create in this step. Lets call it &#39;db_stuff&#39;.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;          Create a &lt;span style=&quot;font-weight: bold;&quot;&gt;server.properties&lt;/span&gt; file. We will name our database &#39;think&#39;. Configuration parameters should be as below:&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    server.database.0 file:./think&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    server.dbname.0 think&lt;/span&gt;&lt;/blockquote&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;          Start the database in the server mode by running the following from the command line (Better still put this in a batch file)&lt;/li&gt;&lt;/ul&gt;                   &lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&lt;blockquote&gt;java -cp D:\hsqldb\lib\hsqldb.jar org.hsqldb.Server&lt;/blockquote&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;              You can use the HSQLDB DatabaseManager to view this database. Run the following from the command line to invoke the tool.&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&lt;blockquote&gt;    java -cp D:\hsqldb\lib\hsqldb.jar org.hsqldb.util.DatabaseManager&lt;/blockquote&gt;&lt;/span&gt;&lt;blockquote&gt;        In the &quot;Connect&quot; dialog, select the following options:&lt;br /&gt;    Type: &lt;span style=&quot;color: rgb(0, 0, 153);&quot;&gt;HSQL Database Engine Server&lt;/span&gt;&lt;br /&gt;    Driver: &lt;span style=&quot;color: rgb(0, 0, 153);&quot;&gt;org.hsqldb.jdbcDriver&lt;/span&gt;&lt;br /&gt;    URL: &lt;span style=&quot;color: rgb(0, 0, 153); font-weight: bold;&quot;&gt;jdbc:hsqldb:hsql://localhost/think&lt;/span&gt;&lt;br /&gt;    User: &lt;span style=&quot;color: rgb(0, 0, 153);&quot;&gt;sa&lt;/span&gt;&lt;br /&gt;    Password:&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 6:&lt;/span&gt; Now the standalone. Add the following jars to your project classpath:&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;hsqldb.jar&lt;/span&gt; from D:\hsqldb\lib\hsqldb.jar&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;hibernate3.jar&lt;/span&gt; from D:\hibernate-3.2&lt;/li&gt;&lt;li&gt;all jars from D:\hibernate-3.2\lib\&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;hibernate-entitymanager.jar&lt;/span&gt; from D:\hibernate-entitymanager-3.2.1.GA&lt;/li&gt;&lt;li&gt;all jars from D:\hibernate-entitymanager-3.2.1.GA&lt;/li&gt;&lt;li&gt;Whew!&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 7: &lt;/span&gt;Create the persistence configuration&lt;br /&gt;&lt;blockquote&gt;   Create a file named &lt;span style=&quot;font-weight: bold;&quot;&gt;persistence.xml&lt;/span&gt;, the persistence configuration file. This file needs to be within a META-INF folder in your classpath. If you are compiling all your classes into a folder, say &#39;classes&#39;, create a META-INF folder under &#39;classes&#39;, then create the persistence.xml file in META-INF. The file should look like below:&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&amp;lt;persistence xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence&quot; version=&quot;1.0&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  &amp;lt;persistence-unit name=&quot;think&quot; transaction-type=&quot;&lt;span style=&quot;font-weight: bold;&quot;&gt;RESOURCE_LOCAL&lt;/span&gt;&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    &amp;lt;properties&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      &amp;lt;property name=&quot;hibernate.dialect&quot; value=&quot;org.hibernate.dialect.HSQLDialect&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;            &amp;lt;property name=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;update&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;      &amp;lt;property name=&quot;hibernate.connection.driver_class&quot; value=&quot;org.hsqldb.jdbcDriver&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;     &amp;lt;property name=&quot;hibernate.connection.username&quot; value=&quot;sa&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;     &amp;lt;property name=&quot;hibernate.connection.password&quot; value=&quot;&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;     &amp;lt;property name=&quot;hibernate.connection.url&quot; value=&quot;&lt;span style=&quot;font-weight: bold;&quot;&gt;jdbc:hsqldb:hsql://localhost/think&lt;/span&gt;&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;        &amp;lt;/properties&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    &amp;lt;/persistence-unit&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&amp;lt;/persistence&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;Note that the transaction-type is &lt;span style=&quot;font-weight: bold;&quot;&gt;RESOURCE_LOCAL&lt;/span&gt;. This is required for standalone environments. Also note the &quot;hibernate.connection.url&quot; matches the URL you use to connect from the HSQL DB Manager to the database, &lt;span style=&quot;font-weight: bold;&quot;&gt;jdbc:hsqldb:hsql://localhost/think&lt;/span&gt;&lt;/blockquote&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 8:&lt;/span&gt; Create an entity class, &lt;span style=&quot;font-weight: bold;&quot;&gt;BroadcastMessage.java&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;package com.blogspot.thought_bytes;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;import javax.persistence.Entity;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;import javax.persistence.Id;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;@Entity&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;public class BroadcastMessage {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  @Id&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  private long id;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  private String message;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  public long getId() {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    return id;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  public void setId(long id) {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    this.id = id;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  public String getMessage() {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    return message;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  public void setMessage(String message) {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;    this.message = message;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;}&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Step 9:&lt;/span&gt; Create a harness to interact with the persistence layer, &lt;span style=&quot;font-weight: bold;&quot;&gt;ClientHarness.java&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;package client;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;import com.blogspot.thought_bytes.BroadcastMessage;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;import javax.persistence.EntityManager;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;import javax.persistence.EntityManagerFactory;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;import javax.persistence.Persistence;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;import javax.persistence.EntityTransaction;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;public class ClientHarness {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;public static void main(String[] args) {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;//Use the persistence.xml&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;EntityManagerFactory emf = Persistence.createEntityManagerFactory(&quot;think&quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;EntityManager em = emf.createEntityManager();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;//&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;EntityTransaction tx = em.getTransaction();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;tx.begin();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;//Create and initialize an entity instance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;BroadcastMessage mb = new BroadcastMessage();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;mb.setId(1);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;mb.setMessage(&quot;Hello World&quot;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;//Persist using the entity manager&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;em.persist(mb);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;//Save&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;tx.commit();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;em.close();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;emf.close();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 153);font-family:courier new;&quot; &gt;}&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;Run the above.&lt;br /&gt;&lt;br /&gt;Go back to the database manager and refresh the view. You should be able to see a new tabel &quot;broadcastmessage&quot;. If you query this table you should get the following:&lt;br /&gt;&lt;br /&gt;ID   MESSAGE&lt;br /&gt;--   -------&lt;br /&gt;1    Hello World&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;That&#39;s it! And now the real hard work begins... :)&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Aldrin&lt;br /&gt;&lt;br /&gt;&lt;screenshot&gt;&lt;/screenshot&gt;</content><link rel='replies' type='application/atom+xml' href='http://thought-bytes.blogspot.com/feeds/8041330506905710006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8978951075400478206/8041330506905710006' title='36 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/8041330506905710006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8978951075400478206/posts/default/8041330506905710006'/><link rel='alternate' type='text/html' href='http://thought-bytes.blogspot.com/2007/04/hello-world-with-standalone-java.html' title='Hello World with standalone Java Persistence, Hibernate and HSQLDB'/><author><name>Aldrin and Luanne Misquitta</name><uri>http://www.blogger.com/profile/08863619142582168911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMr-dl-eTDBZ3GArDkAzCizI8Z-vEFtILLf5OIwja5iJwXHey7dT_EK_luTudSADnbATuBQyWNfpt2Emmqwx-loo6Ouppl9Exz14uUWYQCq0IazN_tcXtHpaWlvQD2Kg/s1600/*'/></author><thr:total>36</thr:total></entry></feed>