Neo4j 1.4 “Kiruna Stol” GAOver the last three months, we’ve released 6 milestones in our 1.4 series. Today we’re releasing the final Neo4j 1.4 General Availability (GA) package. We’ve seen a whole host of new features going into the product during this time, along with numerous performance and stability improvements. We think this is our best release yet, and we hope you like the direction in which the product is heading.
Cypher Query LanguageFor some time now, Neo4j has supported the Gremlin query language for traversing graphs. To complement that, we’ve introduce a new language called “Cypher” which provides humane, DBA-friendly syntax for graph queries. With Cypher, queries can often be easily expressed. For example, this Cypher query finds friends-of-friends concisely:
START user = (people-index, name, "John") MATCH user-[:FRIEND_OF]->()-[:FRIEND_OF]->fof RETURN fof
While Cypher can’t yet mutate graphs, it’s a really powerful and interesting way of exploring and drawing business intelligence of your data.
Neo4j’s index framework is powerful and tightly integrated with the database, but there are times when you’d gladly trade some of that power for a little less effort. That’s where auto-indexing comes in. With a little configuration, the auto-indexing framework will take care of managing the lifecycle of index entries so that they’re consistent with the data in the graph.
The auto-indexing framework allows us to declare that specific properties in nodes and relationships should be indexed. As those properties are created, updated and removed, so too the corresponding entries in the index change.
To create an auto-index in code:
AutoIndexer nodeAutoIndexer = graphDb.index().getNodeAutoIndexer(); nodeAutoIndexer.startAutoIndexingProperty( "model" ); nodeAutoIndexer.setEnabled( true );
Now any nodes with the property “model” will appear in the auto-index. This auto-index can be accessed and queried in a similar way to regular indexes:
ReadableIndex autoNodeIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
And while we’ve only shown node indexes here, the same functionality applies to relationships.
Index ImprovementsIn this release, we’ve taken the opportunity to upgrade to Lucene 3.1. This means index operations will be faster, thanks to the hard work of the Lucene community. However, the transition to Lucene 3.1 indexes means an irreversible change to index stores, so ensure you’re ready to upgrade your indexes before switching to the 1.4 GA release and keep a backup of your data!
Self RelationshipsWhen modelling domains, entities which refer to themselves are somewhat common. For example, the self-employed are their own bosses. In previous versions of Neo4j, we’d model that with two relationships and a (dummy) node. It worked, but it was less expressive than we liked.
Our community has lobbied about this and we’ve listened. So from this release, Neo4j supports relationships whose start and end nodes are the same. For those lucky people who are their own boss, you can now express subgraphs like:
The database will happily persist that structure and make it available for traversals.
Performance ImprovementsDown in the engine room our kernel hackers have been busy. Our boffins have implemented new directional caching strategies and tweaked the code path to make small transactions (especially) much more efficient. This all adds up to a substantial performance improvement and a database engine that feels a whole lot snappier.
REST API ImprovementsIn the Neo4j server, we’ve been pushing the REST API forward. To that end, we now have batch behavior exposed so that large bundles of commands can be executed efficiently on the server, thereby paying the network penalty only once.
We’ve also included a paging mechanism for traversers. Any traversals that you execute on the server can return their results in pages rather than as a single large chunk. This means traversers can be terminated early (when enough results have been gathered) and provides more manageable chunks of data to work with, making the server more efficient (as well as taking the pressure off clients).
Finally, we’ve made REST indexes on par with the embedded indexes. From this release the same arbitrary queries and index management supported in the Java APIs are available to our community of RESTafarians too!
Webadmin ImprovementsOur browser-heads have been plugging away, knee-deep in coffeescript and CSS, and the results show. The Webadmin tool that comes with the server is looking better than ever. With this release, there’s a new index manager tab that allows DBAs to fully control indexes on the graph with a friendly point-and-click interface.
We’ve also expanded the set of consoles available. To compliment the existing Gremlin console, we’ve added a Cypher console. This means to get up and running with Cypher, it’s as simple as downloading Neo4j, running the server and opening a Web browser!
For our RESTafarian friends, we’ve also created a neat HTTP console that allows users to create simplified curl-like commands that can be executed against the server. This is extremely useful as a REPL for exploring the REST API and testing extensions and plugins.
New Server Management ScriptsEver since we first released the Neo4j server, we’ve used 3rd party libraries and scripts to help users manage the service. Unfortunately, both of the 3rd party wrappers we’ve used have been painful for everyone concerned. So late in the 1.4 release cycle, we switched out those wrappers and provided much simpler bash (if you’re on a Unix variant) and command scripts (if you’re on Windows) instead – much nicer!
Ready to go!The 1.4 GA release is now available through our download page, and the components have been pushed out to the Maven central repository. Remember, we always value your feedback over on the community mailing list, but in the meantime we wish you all happy hacking! 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