Thursday, August 8, 2013

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.

Cypher


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.


Syntax
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 n.foo? and n.foo! has been removed. Non-existent properties now return null by default, which covers the n.foo! =”bar” case. Meanwhile  n.foo?=”bar” should now be written as (not(has(n.foo)) OR n.foo=”bar”).

However, please check that’s what you really intended. As we found many users were writing n.foo? where they expected the behaviour of n.foo!.


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 | n.name)
  • 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 neo4j.org/download, 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

7 comments:

Wes Freeman said...

Awesome!

Paul Hester said...

Just started playing with 1.9, awesome product! But 2.0 looks like it will be spectacular!!

We're at the start of a new project, trying to decide to build with 1.9 or latest 2.0 M. Understanding it's software and 'it always takes longer than it takes':
1) how stable is 2.0 M04? could we go to production with it?
2) when is the 'planned' release date of 2.0?

Thanks so much for building such a killer product.

-paul hester

Chris Leishman said...

Hi Paul!

Thanks for your interest in Neo4j, both versions 1.9 and our upcoming 2.0, and for the great feedback.

That said, we really mean it when we say it's a development release. Don't put this is production. We're still testing this out ourselves!

And whilst we'd love to give everyone a concrete release date for 2.0, we're just not quite ready for that yet. I can say that we're aiming to have it stable and ready as soon as we can, and that'll likely be well before Christmas, but I have to say that we're also still working on a bunch of cool (and necessary) things to make that happen.

Stay tuned though! And please share any other feedback you have about this release.

Cheers,
Chris

JK said...

Hi, will a new visualization console also be part of the 2.0 release?

Andreas Kollegger said...

@JK

Hey,

We are considering a few improvements to the user interface, including visualization. Stay tuned for any progress in that area.

Cheers,
Andreas

bastien.vigneron said...

"Cypher and the REST-API open their own transactions, so this will only affect users of the embedded Java-API."

The problem is : it seem the transactions are not automaticaly open in neo4j-shell. If make a "cd something" by using TAB to autocomplete you get a "org.neo4j.graphdb.NotInTransactionException" ...

Angel Cervera Claudio said...

What is about performance with respect to 1.9.2 version?