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")While Cypher can’t yet mutate graphs, it’s a really powerful and interesting way of exploring, and drawing business intelligence of your data.
Automatic IndexingNeo4j’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. And 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:
AutoIndexerNow any nodes with the property called “model” will appear in the auto-index. This auto-index can be accessed and queried in a similar way to regular indexes:
nodeAutoIndexer = graphDb.index().getNodeAutoIndexer();
nodeAutoIndexer.startAutoIndexingProperty( "model" );
nodeAutoIndexer.setEnabled( true );
ReadableIndexAnd while we’ve only shown node indexes here, of course the same functionality applies to relationships.
autoNodeIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
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 have lobbied about this, and we’ve listened. So, from this release Neo4j supports relationships whose start and end nodes are the same. So for those lucky people who are their own boss, you can now express subgraphs like:
Albert-BOSS_OF->AlbertAnd 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 forwards. To that end, we now have batch behaviour 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 a par with the embedded indexes, and 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.