Friday, March 30, 2012

Spring Data Neo4j from Scala

Developers today live in a mix-and-match world, as the Neo4j Heroku Challenge demonstrated with some clever engineering that matched the creative applications. Whether enjoying a clean REST interface from your language of choice, or running on the JVM to tap into the vast libraries available, you can code the way you want without worrying much about being left on an island.

Over at Cake SolutionsJan Machacek decided to reach out to Neo4j through the graceful abstraction provided through Spring Data Neo4j. But, he is coding it up in Scala. While Java is generally accessible from Scala, Jan points out "some of the sticky points" that you need to consider.

The result of a bit of sensible coding is that Spring Data Neo4j provides the baseline object behaviors, with some implicits bringing out the shine of those objects, for clean integration into Scala.

Read all the details in Jan's original post. Be sure to check out his other Scala posts, including an appropriate look at using Scala's Cake Pattern within a Spring application.

Monday, March 26, 2012

Neo4j 1.7.M02 - Cache Cachet, Matching Matchers, and Debian Debs

Neo4j 1.7 Milestone 2 introduces a trio of interesting advances: a new cache scheme, targeted pattern matching in Cypher, and Debian install packages. Faster, smarter, and more accessible. 

Atomic Array Cache - GC resistant, 10x faster, 10x more capacity
Under the hood, Neo4j runs on the JVM (that’s the ‘J’ in ‘Neo4j’). And as every java developer knows: the Garbage Collector is your friend, the Garbage Collector is your enemy. The Garbage Collector (GC) helpfully relieves the developer from worrying about memory management.  Unhelpfully, garbage collection introduces unpredictability in an application’s responsiveness. While partial garbage collection can be a nuisance,  full garbage collection can be disastrous, pausing an application for uncomfortably long durations (from a few to far too many seconds). Sadly, there are no really good solutions to consistently avoid full GC pauses or to even prevent the GC from kicking in at inconvenient times.

Neo4j tweaks the impact of garbage collection with cache strategies suited for different scenarios (see the manual section on caches). Our newest innovation under the hood is the Atomic Array Cache (AAC), designed to keep GC troubles at bay. The ‘Array’ part occupies a fixed amount of Java heap space, managed with concurrency friendly ‘Atomic’ operations. In action, the AAC prevents GC from collecting anything in the cache without explicit management by Neo4j.

The AAC is compact, fitting 10x more primitives into the same memory as the other cache types. And the performance is very exciting, up to 10x faster. Best of all, when configured correctly there will be no GC pauses.

Want to give it a try? Grab the 1.7.M02 release, then check the docs for proper configuration of the caches. Let us know your experiences, whether woo-hoo or oh-darn moments.

Cypher matching matchers
By describing what you want and leaving the how-to-do-it up to someone else, a declarative language like Cypher presents many opportunities for optimizations. Our brilliant Michael Hunger recently joined Cypher master Andres Taylor for a hard look at pattern matching, initiating a classification of common use cases. Then the duo targeted different pattern matcher implementations to fit each type of query. The results are promising. 

CypherQueryWithAggregationCase :
start a=node(*) where a.value? < 5 
    return coalesce(a.value?,0), count(*) 
    order by count(*) desc limit 10
Before => 25 ops/s
After  => 31 ops/s

start a=node({ids}) 
    match a-[:`0`]->b<--d-->a 
    return b
Before => 2 ops/s
After => 44 ops/s

start a = node(0)
    match a-[:AB]->b-[:BC]->c-[:CD]->d-[:DE]->e 
    return e
Before => 1 ops/s
After => 7 ops/s

Considering use cases, Cypher now has support for multiple relationship types within a single relationship segment, so you can express things like:
START person=node(3)
    MATCH (person)-[:LIVES_IN|WORKS_IN]->(city)
    RETURN city
Please report back on your performance impressions of 1.7.M02, so we can continue to expand our use case coverage. 

Got Debian? apt-get neo4j
Ops people rejoice, because Neo4j is now a simple `apt-get` away for any Debian-based Linux distro (like the ever popular Ubuntu). The debian installer is now part of the regular build and deploy chain, pushing out to our own debian repository. See for details, following these steps to install:

$ sudo -s
$ echo 'deb binary/' >> /etc/apt/sources.list.d/neo4j.list
$ aptitude update
$ aptitude install neo4j-enterprise neo4j-coordinator

To see a list of resolved issues and minor additions included in 1.7.M02, refer to the github issues. Many of these originate from community reporting, so don’t be shy: let us know about any problems you encounter.

Thanks again to everyone in the community for contributing to the conversation in our google group, particularly when helping out new graphistas. We often hear kind compliments about how thoughtful, helpful, and outright attractive our community is. Absolutely agreed, you all are remarkable.

OK, time to download Neo4j 1.7.M02 to enjoy the fresh new abilities. 


Friday, March 23, 2012

Tasting the Flavor Graph

Luanne & Aldrin Misquitta
Flavorwocky, an amusing name for a clever idea that highlights the connectedness of everyday life. With a little bit of coding, the simple idea about related flavors became Luanne Misquitta's winning entry for the Neo4j Heroku Challenge. What was her recipe for success?

It Starts With an Idea
"The idea came to me while I was doing nothing in particular," Luanne explains in her blog, "to build a simple app that would help one find ingredients whose flavors complement one another." Foodies everywhere will recognize the classic "pairing of flavors" whether wine with an entree, or cross-cultural fusion recipes. Luanne focused on the generalized notion for ingredients, because "knowing which ingredients have flavor affinities can produce some amazing new dishes."

Why Flavorwocky? Luanne had asked her husband, "what should I call the app?", and he suggested "jabberwocky." Appreciating the playfulness, she adapted it to the domain, exclaiming  "behold — Flavorwocky."

NewImageTo the Whiteboard!
Luanne elaborated on the idea, realizing that "a graph is a good fit for this domain, so, using Neo4j, we model the way ingredients in a great dish pair together based on their flavor affinity." Sketching out the domain was easy, translating directly into the graph. There are high-level Categories for groups like vegetables, spices, and dairy.  Ingredients are related to the category first, then to each through a weighted PAIRS_WITH relationship.  For convenience (anticipating the fun visualization) the Categories also have a color property.
Chicken affinities

The Implementation
To implement the application, Luanne decided on Grails 2.0, using straight-up REST calls to Neo4j. Her husband Aldrin has a nice blog post detailing how to get started with a project using Neo4j+Grails running on Heroku.
To provide a nice user experience, Luanne turned to the d3.js library to visualize the related ingredients.

The result, is a "version of this app [which] captures flavor pairings and how well ingredients pair together, and then allows one to search by ingredient and view complementary combinations. Needless to say, this just scratches the surface of the possible features for an app like this."

Agreed, Luanne. It's insight like yours that inspires new possibilities. Thanks for sharing your work, and congratulations on winning the Challenge.

Monday, March 19, 2012

Neo4j Heroku Challenge Winner and Finalists

Allison Sparrow @ Cloudstock 2012

The entries have been entered, the votes have been cast and now it is time to announce the winners of the Neo4j Heroku Challenge
What more appropriate time or place for the announcement than here at's Cloudstock in San Francisco.

I met with Heroku's Principal Developer Evangelist James Ward amidst a cluster of bean bags where we chilled, chatted and played with strange camera angles for the interview.

James' Developer Keynote presentation focused on Java, and how to make your applications quickly available on the web. During our conversation, James mentioned that all of these cloud advances have shifted the way people are building and developing software. From this new type of thinking, developers are looking to take it a step further, to see how this can be applied to their data as well.

Neo4j shares the same passion for getting our users into the cloud. While recognizing the importance of Java for getting the OK from your boss, we see great adoption across different languages, many highlighted in the Challenge entries.

Here's the full interview:

Da Winner!

We had some amazing entries from all over the globe and from a diverse set of languages, and we
thank everyone for participating. The overall winner will recieve the new iPad, and the language winners receive $100 to ThinkGeek.

The proud new owner of a new iPad, and our overall winner of the Neo4j Heroku Challenge is...

Flavorwocky won the most votes among the Neo4j community and highest ranking on Gensen, recognized for creativity, useability, and all around awesomeness. A big congrats from the whole Neo4j community to you Luanne - we are trying to get that iPad to India as soon as possible!

Language Winners

FlattrWhat - Ruby by Simon Gate
The "Flattr what?" application is a super simple recommendation engine for Flattr users, a micro-payment/tipping system for bloggers and other content creators.

FrostyMug - PHP by Josh Adell
Frosty Mug helps navigate the vast ocean of beers on tap at a proper brew pub. Start with a beer you like, then Frosty Mug will recommend similar beers.

Neoflix: Browser - Javascript by Max de Marzi
In a great spin on the classic Neo4j dataset, Neoflix explores a movie database with D3-powered visualizations to make film recommendations.

Node Neo4j Template - Node.js by Aseem Kishore
The Node template demonstrates how easily Node.js developers can tap the power of Neo4j for creating a social graph.

Flask Demo App - Python by Carson McDonald
The app is a simple data explorer with bookmarking ability, using user-generated content from Stack Exchange.

Scala Plays with Neo4j - Scala by Andy Petrella
With this through-the-web edited social graph, Andy demonstrates how easy it is to get access Neo4j from Scala while running on the Play framework.

GraphTag - Clojure by Aran Elkington
Graphtag is a Clojure application which monitors twitter mentions against a custom account "GraphTag" and inputs the content of those tweets into neo4j as a node.

Neo4jOrbust - C# by Romiko Derbynew
Neo4j or Bust is an impressive mashup of Heroku (to access Neo4j) and AppHarbor (to host the .NET application), to discover and follow interesting people.

NeoQuotes - Java by Tomás Müller
NeoQuote delivers a stock-exchange symbol lookup application, with integrated voice search!

Lightbulb is a a Git-powered, Neo4j-backed blog engine for Heroku, using James' own excellent Bulbs framework for graph databases.

Coderwall Badges

On top of the sweet prizes, all winners and participants in the challenge will receive Coderwall badges in recognition of their prowess. Coderwall has also introduced a special badge for general Neo4j achievements. We are always grateful for all our community contributions, and now you will be publicly recognized for helping make the world a better place for graphs.

Remember, all challenge entries have full source available and are listed at Gensen, so go clone your favorite and start coding away.

Props to all
I have to give a shout out to the Neo4j Community Team and our friends at Heroku for this awesome contest, and for all of the great work put in. The participants' awesome efforts mean that there will be more fun challenges coming up in the future!


Corrections! With apologies to James Thornton, there was a mixup in the vote counting, which should have resulted in Lightbulb being awarded the Python prize. Both Carson and James have been given the award. Congrats gentlemen, and sorry about the mistake.

Friday, March 16, 2012

Neo4j 1.7.M01 - "Bastuträsk Bänk"

With the release train now headed to Bastuträsk Bänk, we are excited to present the first milestone of the Neo4j 1.7 series.

Cypher evolution

The Cypher language continues to evolve nicely, incorporating insightful feedback from real world use cases. This version adds new concepts, and make minor adjustments to existing syntax, to make things easier, more powerful and clear.
You will surely enjoy these changes:
For all the details about the updated syntax, please see the full Cypher section in the authoritative manual.

SSL Support, wildcard rules for Neo4j Server

In environments where it is beneficial, you will appreciate SSL Support for Neo4j server, encrypting access across standard HTTPS (details in the documentation).
A nice complement is that security rules can now use wildcards, like:
public String forUriPath()
    return "/protected/*";
For documentation about authorization rules, see… the manual section about that. (Yes, this post is just a highlight reel of the manual. Would you be interested in a full-length book about Neo4j? Let us know. )

Documentation goodies

We have been working on improving the documentation in various places and structures, moving interesting parts to more prominent places. Also, we started to improve the readability of the automatically generated graphviz-graphs by assigning automatic color schemes to relationships as a first step, see the below graph, linked from The Cypher Cookbook.

Before (1.6.1):
After (1.7.M01)

High Availability improvements

On the HA side, a number of issues have been improved, which also led to the maintenance releases 1.5.2 and 1.6.1 (you should upgrade if you are running these major versions). Btw, if you want to set up Neo4j HA in less than 5 minutes on your local machine, try out

git clone git://
cd neo4j-enterprise-local-qa
rake setup_cluster

And you should have a local cluster running.

Blueprints 1.2, Gremlin 1.5

Following the recent update of the excellent Tinkerpop stack, we have updated Neo4j to work with the newest stable releases, which fixes a number of bugs around cleaning the database and index handling through Gremlin.

Bugs? Nah - issues!

Also, there has been a slew of fixes related to Cypher, the REST API, documentation and the Webadmin, see Github changelog for a full list of high-level code changes.

As always, please report any issues you have, enjoy coding and thanks to all core contributors, and all of you making this an awesome community to change the world. Get the milestone here while it's hot :)

/peter neubauer

Thursday, March 8, 2012

How to set up a maven project with Neo4j in Eclipse

Hi all,
repeatedly there are questions on how to set up Neo4j with Eclipse and the Maven integration for it .

Here is the short version:

First, choose to create a new maven project:

Second, choose the default maven quickstart archetype for it:
Now, after choosing a package namespace and project artifact id, wait for the project to created and go to the dependency tab of the pom.xml. Here, add the relevant neo4j dependency by searching for "neo4j":
Finally, after saving the pom.xml, you should see all the imported and mounted dependencies in your project:
Here you go, happy hacking!

Special thanks to Mahdi Negahi for bringing this up

/peter neubauer

Thursday, March 1, 2012

Heroku Challengers - Vote Now

The Neo4j Heroku Challenge has closed, leaving a brilliant collection of projects to highlight developing with Neo4j using a broad range of languages and frameworks. With the challenge closed to entries, it is time for the voting! Let's take a look at the challengers to see who deserves your support.

Every Vote Counts

A lot of creativity and love was poured into these projects. Now it's your turn to participate. After investigating the projects, you've got three ways to vote:

1. Use the Tweet buttons below the projects to cast your vote on twitter with the project in question.
2. Cast your vote by tweeting #neo4jchallenge and the url to the project's github repository
3. Login to Gensen and add star rating to the project

Some deserving developer is going to get an iPad3 thanks to your support!
Neo4j Chord Diagram Example 2

D3 Followers Visualizer

Neography on Sinatra in Ruby
by Max de Marzi

Graph visualization doesn't have to be just circles and arrows, as Max demonstrates with this easily grokable project that uses the D3.js library to display a chord diagram of [:follows] relationships in the graph.
Read more about it in Max's blog post.

Neo4j Force Collapsible Example

D3 Network Visualizer

Neography on Sinatra in Ruby
by Max de Marzi

Following up with a more traditional graph representation, Max's Network Visualizer project shows how organic a graph visualization can be. With a color palette evocative of Gensen, Heroku and Neo4j, this sample could the official challenge flower.
Read more in Max's other blog post.

Flattr What

Flattr what?

Neography on Sinatra in Ruby
by Simon Gate and Joel Hansson

The "Flattr what?" application is a super simple recommendation engine for Flattr users, a micro-payment/tipping system for bloggers and other content creators. The demo app starts with a user, then scrapes the Flattr API to recommend other things to flattr.
Read all the details at Simon's project repository.



Grails in Groovy
by Luanne Misquitta

Flavor-what-now? This amusingly named app models ingredient pairs or flavor affinities, allowing you to search by ingredient and view complementary combinations. I didn't see "Bacon and Avocado" so a quick click of the "Add Pairing" button later and I've contributed to the crowd sourced edible wisdom.
Luanne has a great write-up that tells the whole story.

FrostyMug  Beer Ratings and Recommendations

Frosty Mug

Neo4jPhp on Silex in PHP
by Josh Adell

Frosty Mug helps navigate the vast ocean of beers on tap at a proper brew pub. Start with a beer you like, then Frosty Mug will recommend similar beers. This app might need a mobile version UI so we can use it at Neo4j Meetups to help order beers in a graph-like way. Cheers.
Peruse the github repository to see under the covers.


Bulbs in Python
by James Thornton

A git-powered, Neo4j-backed blog engine running on Heroku. A headless application? Yes! With Lightbulb, you can use your favorite text editor, then push the content to Heroku, where Lightbulb will extract the entry metadata, save it to Neo4j, then serve it up in convenient chunks. By focusing on serving up custom data endpoints, a client-side application can easily incorporate the blog fragments.

The Bulbflow website has all the details.

NeoBlog Main


Py2Neo on Flask in Python
by Matt Williams

Neo Blog is a simple blog engine written in Python, backed by Neo4j. This app demonstrates that your application doesn't have to be overtly graphy to benefit from developing with a graph database. A blog platform is so familiar, it's easy to forget the incredible connectedness of all the content, and the comments, and tag clouds.
Check out the implementation at the project repository.

Play 2 0 And Neo4J

Scala Plays with Neo4j

Neo4j REST through Play in Scala
By Andy Petrella

With this through-the-web edited social graph, Andy demonstrates how easy it is to get access Neo4j from Scala while running on the Play framework. Down in the guts, he uses the Databinder Dispatch library to set up a Neo4jRestService which pipes all the data from the Neo4j server.
To go along with it, Andy has written a great series about Neo4j on his blog.


Neocons on Ring in Clojure
By Aran Elkington

With Graphtag, Aran has created a Clojure application which monitors twitter mentions against a custom account "GraphTag" and inputs the content of those tweets into neo4j as a node. The individual that made the tweet is also stored in Neo4j and links are created from their node to any tweets they mention "GraphTag" in.
Without a distracting UI, Graphtag capably demonstrates how naturally Neo4j integrates with Clojure, providing a solid starting point for developing your own applications.
Read more about Graph tag at Aran's github repository.

Neoflix 1


Neography on Sinatra in Ruby
by Max de Marzi

In a great spin on the classic (for Neo4j) dataset, Neoflix explores a movie database with great D3-powered visualizations to make recommendations about other films you might want to watch.
You should read everything Max writes, including a post about this project.

Node Neo4j Template

Node-Neo4j Template

Node-Neo4j in JavaScript
By Aseem Kishore

Node-Neo4j.js really seems like it could be named Relationship.js, doesn't it? Regardless, it's an easy to use library that lets Node.js developers work with a full Neo4j graph. Aseem's template project demonstrates the essential operations of working with Neo4j, implementing a social network with [:follows] relationships.
Read the details on Aseem's project website.

NEO4J Demo  Python

Python, Flask, Neo4j Demo App

Py2Neo on Flask in Python
by Carson McDonald

The app is a simple data explorer with bookmarking ability to show off some of the features of Neo4j. A subset of data from a Stack Exchange CC data dump, specifically Programers Stack Exchange, is used to populate a sample database. The bookmarking feature allows for weights to be added for later use in recommendations.

Neo4j Grails Demo

Grails Neo4j plugin on Grails in Groovy
By Stefan Armbruster

When you want to get right to coding up your great application idea, having a clean project template with all the bits in place helps enormously to get you started. Stefan has provided that here for Grails developers.
Read more about Neo4j for Grails at the project repository and Stefan's blog about Grails Neo4j.

Home Page  FrictionFree org

Neo4j or Bust

.NET Neo4jClient in ASP.NET via Sinatra and Ruby proxy on Heroku
By Romiko Derbynew

Neo4j or Bust (aka is an impressive integration of Heroku (to access Neo4j) and AppHarbor (to host the .NET application), to create a website that lets you discover and follow interesting people. This is classic social networking: based on who you know and driven by your interests, you use your network of connections to find new people.
Learn all of Romiko's secrets in his blog post about the project.
NeoQuotes application by Tomás Augusto Müller  Neo4j Challenge  Seed the cloud


Spring Data Neo4j on Sinatra in JRuby
By Tomás Müller

Assembling an ambitious stack of technology, NeoQuote delivers a stock-exchange symbol lookup application, with integrated voice search! Yes, I know you want to try it right away. Open a new window, we'll wait.
From idea to implementation, you can follow the step-by-step development in Tomás' blog post.

Neo4j example with Scalatra

Scalatra Neo4j

Neo4j REST on Scalatra in Scala
By Hannu Leinonen

Ruby's Sinatra has inspired many other lightweight web frameworks to take the stage. Scalatra is Scala's implementation. With Scalatra Neo4j, Hannu shows how to take that easy development style one step further to integrate with Neo4j, quick-stepping past boilerplate code to get right to dancing in your application domain.
Dig the details at Hannu's github repository.

Want to learn more, or hear from the developer's themselves? We're having a "virtual meetup" voting party next week to hear from the project authors and vote. Authors and voters, join us.