Neo4j 2.0 GA – Graphs for Everyone
A dozen years ago, we created a graph database because we needed it. We focused on performance, reliability and scalability, cementing a foundation for graph databases with the 0.x series, then expanding the features with the 1.x series. Today, we announce the first of the 2.x series of Neo4j and a commitment to take graph databases further to the mainstream.
Neo4j 2.0 has been brewing since early 2013, with almost a year of intense engineering effort producing the most significant change to graph databases since the term was invented. What makes this version of Neo4j so special? Two things: the power of a purpose-built graph query language, and a tool designed to let that language flow from your fingertips. Neo4j 2.0 is the graph database we dreamed about over a dozen years ago. And it’s available today!
Let’s take a look at what’s new in 2.0…
Play along
Go get
Neo4j 2.0
. If you’re a lucky Windows user, you’ll get an early incarnation of our binary packaging. On other platforms, be sure to install
JDK 7.0
before running Neo4j. Launch a
modern web browser
, then open Neo4j’s new web interface, available by default at
https://localhost:7474
. Ready? OK…
A shiny new tool for developers
We paid careful attention to how you work with Neo4j, from learning about graphs, to initial experimentation, and finally developing your own applications. Then, we completely rewrote our user interface to create the
Neo4j Browser
as a fluid developer workbench.
We think you’ll love the clean UI, with helpful guides, reference topics and even a mini graph app about Movies and Actors to help you get started. Once you experience the powerful combination of a multiline Cypher query editor with insightful visualizations, tabular representations, drag-and-drop support and export features, we’re confident it’ll become your daily companion.
A language for graphs
What began as a convention for describing graphs in email has become a natural way to “think in graph” — Cypher, a graph query language. With Neo4j 2.0, we’ve discussed and considered, and argued our way to a more complete Cypher. It has even influenced the graph model itself.
Nodes can have labels
Early on, it became apparent that we needed a way for Cypher to refer to subsets of nodes in a graph. So for the first time since 2002, we changed the graph model, adding the concept of a node label. Labels simply mark a node as belonging to a group. They’re optional, and you can have as many labels on each node as you’d like.
For example, consider the Persons, Actors, Directors, and Movies in this graph:

A graph model with labels.
Labels enable a little schema
“Wait, what?!?” we hear you say. Schema in a NOSQL database? It’s not like returning to relational schemas, rather being able to provide some additional meta-information to make your queries run better and keeping your data more consistent.
Uniqueness constraints set expectations
A very common pattern when working with any data is to make sure certain entities exist only once in your database, known as
Uniqueness Constraints
. Neo4j now supports this thanks to labels, defined like so:
This ensures that you won’t be able to create a second
Person
node with the same
name
property value. Such a query would fail.
Automatic Indexes
With the Labels in place, we can provide indexing meta-information, solving some of the most common indexing patterns in a nice way – the
Automatic Index
. You now can declare an automatically indexed property on a labeled node
like this in Cypher
:
This index will index the existing data in the background. After becoming ONLINE it is transactionally updated. The index is then automatically used by the database in a query such as this:
New Cypher clauses
OPTIONAL MATCH
When any part of a pattern isn’t required, extend a MATCH with an
OPTIONAL MATCH
. Everything in the required MATCH pattern must be found, but the optional part may be missing and will return a null.
A classic example is the statement to delete all nodes and relationships in the database:
Because ‘n’ is in both matches, it is mandatory, but ‘r’ may be null so ‘n’ doesn’t have to have a relationship to be included in the result. Make sense?
MERGE
This is the equivalent of “Get or Create” semantics. If a node with this pattern already exists, it is matched and returned, otherwise a new one is created. These two options are exposed and can be acted on, like the following:
Larger patterns with relationships can also be MERGE’d. As with a single node pattern, it’s all or nothing – the entire pattern is found, or it is created. This clause is provisional; we expect it to be enhanced and refined based on how you use it. Let us know.
Literal node patterns
Mirroring other pattern-based clauses, MATCH can now include properties directly in the pattern, indicating exact value matches. This improves readability and consistency. For example, matching a simple node with a “name” property can look like this:
Returning literal maps and collections
This is a very convenient way to return JSON-documents as results from a Cypher query, making client-side parsing much easier. Any expression (including paths), collections and even nested maps can be used and returned. Here is an example:
Will return:
All the details
This fantastic release has so much more depth. For details, check out:
-
The dedicated
Upgrade FAQ
document
Of course the
Neo4j Manual
has been updated to reflect all the changes and the
Cypher Reference card
too.
Graphs for everyone
Lovingly refined since we began, Neo4j has become an awesome tool used by graph pioneers around the world for a
stunning diversity of projects
. Today, centuries of graph theory can be yours with just a few simple lines of Cypher. Neo4j 2.0 claims the awesome power of graphs away from academia, sneaking past the hackers, delivering a graph database that anyone can use. This is just the beginning.
We have graphs for everyone.
We are extremely excited about this Neo4j release and really want your feedback, comments and contributions to our beloved graph database project and its wonderful community.
Enjoy Neo4j 2.0, and Happy Coding and Happy Holidays!
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.