“Kiruna Stol” 1.4 – Milestone 4

Hi everyone,

We’re on the fast track to the next major Neo4j release, “Kiruna Stol”. With today’s milestone, we’ve added some brand new features, some experimental aspects that we’re looking for feedback on and of course numerous enhancements to everyone’s favorite graph database.

Cypher – An expressive graph query language

To allow expressive and efficient querying of the graph store without having to write traversers in code, we’re releasing the first iteration of a new query language, code-named “Cypher”.
Cypher is designed to be a humane query language, suitable for both developers and (importantly, we think) operations professionals who want to make ad-hoc queries on the database. Its constructs are based on English prose and neat iconography, which helps to make it (somewhat) self-explanatory.
For example, here’s a query which finds a user called John in an index and then traverses the graph looking for friends of John’s friends (though not his direct friends) before returning both John and any friends-of-friends that it found.

In this next example, we take a list of users (by node ID) and traverse the graph looking for those other users that have an outgoing follows relationship, returning only the followed users who are older than 18.

The Cypher documentation is growing even at this early stage, available in its own section of the Neo4j Manual.

This is how it looks in the webadmin console:

Batch-oriented REST API

The Neo4j Server now contains a new (and experimental) REST API to support batching of REST operations. With this API it’s possible to upload many commands to the database simultaneously and have them executed as part of a single transaction – reducing both network and transactional overheads.
The API is activated by POSTing JSON encoded requests to https://…/db/data/batch
An example HTTP entity body for the request is shown below, containing a list of commands to execute:

Request results are returned as a JSON array, each element of which contains the return data, status code, originating request and the specified request id of the related command. Any erroneous commands stop the execution and roll back the transaction. When this happens, the HTTP response provides feedback on the command that caused the problem.

Documentation and Tutorials

The Neo4j documentation project continues at pace. The site at https://docs.neo4j.org has become the authoritative place for all Neo4j documentation, some of which is even being generated automatically from running code to ensure it’s up to date and consistent.

To help get to grips with Neo4j, we’re also publishing tutorials to the docs site, so get stuck in!

Faster, Better, Smarter

As always, we’ve looked for opportunities to make our footprint smaller and our code run faster. In this iteration, we’ve lowered the memory profile of nodes, relationships and properties so they use less of that valuable heap space. Also, the BatchInserterIndex now keeps its memory usage in-check with batched commits of indexed data using a configurable batch commit size.

With the addition of relationships that can refer to the same start and end node (loops), we gained significant modelling expressivity. In this milestone we’ve shrunk the memory overhead on loop relationships so that it only takes up extra space for those nodes that actually have loops on them.
For traversals, we’ve built in some caching optimizations that yield useful traversal performance improvements. For even more performance (and less memory overhead), we’ve also removed some unnecessary checks and object allocations during traversal.

Bug Bashing

We’ve been busy refining the code and ironing out kinks in this iteration. We’ve fixed several issues that can arise in highly concurrent scenarios, together with a list of fixes for other annoyances that we think will add real value for our community:

  • Database locks are now released on Transaction afterCompletion(). This means that database objects can be used as monitors in a distributed environment such as HA setups.
  • Added directions on how to configure garbage collection logging.
  • Fixed a bug where the RRDB (the store where metrics data is kept) was not shutdown properly, causing problems on Windows machines.

Start your engines!

The release is now available in Maven central, and bundled up on the Web ready to download here.

Happy hacking!

Your Neo4j team and Andres “Cypher” Taylor.

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