Summer Release – Neo4j 2.0 Milestone 4

Perfectly suited for your summer holiday exploration, we are proud to present the Neo4j 2.0 Milestone 4 release (2.0.0-M04).
In working towards a major 2.0 release with some outstanding new functionality, this milestone contains many beneficial and necessary changes, some of which will require changes in the way Neo4j is used (see: deprecations).

New Requirement: Java  7

Starting with this milestone Neo4j 2.0 requires Java 7 to run. This is because Java 6 reached public end of life in February 2013 and is no longer supported by Oracle. As such Java 6 will substantially decrease in popularity as a production choice and so it’s time for Neo4j to follow that movement.
Starting Neo4j with Java 6 will cause errors during startup.

Mandatory Transactions

Previously it was considered good practice to wrap read operations inside a transaction. The 2.0.0-M04 release makes this recommendation mandatory. Any attempt to execute operations on the database outside of a transaction will now throw a NotInTransactionException. Enforcing this idiom allows Neo4j to reclaim resources much more efficiently leading to a database that will handle much more load. Cypher and the REST-API open their own transactions, so this will only affect users of the embedded Java-API.


Our query language Cypher got its fair share of changes too, both in syntax and behavior. We’ve learned a lot about how Cypher is being used. We want to use the opportunity of a new major release to get this knowledge back into the product, so that you are on firm footing in 2.0 and beyond.
As Cypher has grown, we’ve seen a few syntax anomalies that sometimes caused confusion for Cypher users, especially those starting out with the language. We saw those both on the feedback channels (StackOverflow and the Neo4j Google group) but also in our Neo4j Intro Tutorials.
Due to the bigger changes to the data model in Neo4j 2.0 we felt that we should make the query language more consistent at the same time, keeping the changes in a single major version of the database so that the fluctuation is limited. If you rely on a compatible parser behavior you can always enforce the 1.9 syntax (with prefix or configuration of cypher 1.9).
The syntactic sugar property handling for and! has been removed. Non-existent properties now return null by default, which covers the! =”bar” case. Meanwhile”bar” should now be written as (not(has( OR”bar”).
However, please check that’s what you really intended. As we found many users were writing where they expected the behaviour of!.
Removing properties is now consistent with labels, use REMOVE n.prop to remove a property, while continuing to use DELETE n,r for nodes and relationships.
Due to an ambiguity that was introduced with the n:Label syntax we’ve changed the separator for collection functions (comprehensions) from a colon “:” to a pipe “|” symbol. (the old syntax is still supported but deprecated).
Some examples:
  • EXTRACT(n IN nodes |
  • FILTER(n IN nodes | n.age > 18)
  • FOREACH(value IN names | CREATE ({name:value}))

Lots of new Math Functions

This milestone also introduces an expanded set of math functions, giving you the convenience to do some lightweight math calculations in Cypher (of course, you should probably consider doing those in your client application first). These functions were contributed by our outstanding community member, Wes Freeman.

A New Cypher Parser

As Cypher becomes a more and more important part of Neo4j, we’ve taken the time to revisit the internal architecture of the parser, with an eye towards efficiency, correctness in the grammar and improved usability. For those of you that are really adventurous, you can give us the first round of feedback for a new Cypher version that we’re working on (still very experimental in this release). Just add cypher experimental in front of your Cypher statements and tell us if something doesn’t work as expected.
As always the new version is available for download from, it has been pushed to Maven central and all the changes are reflected in the updated Neo4j Manual and the change log.

Please test it out and give us your feedback.

Chris Leishman for the Neo4j Team

Want to learn more about graph databases? Click below to get your free copy of O’Reilly’s Graph Databases ebook and discover how to use graph technologies for your application today.

Download My Ebook