The Neo4j 2.3.0 Milestone 3 Release Is Now Available

Senior Developer Advocate, Neo4j
3 min read


Better Recommendations with Triadic Selection
(What is a triadic selection, you ask?) The foundation of all recommendations is a simple pattern of looking at triangles in a graph, then suggesting new ones to complete. It looks something like this:
A
, follow relationships outward to find B
and C
. Because B
and C
are also connected, we have a triangle that suggests strong relationships, even without looking at any properties. Thus, the natural recommendation.
To demonstrate, let’s use the Movie Graph example included with Neo4j to create a professional actor’s network, connecting Persons who have worked on a Movie together:
MATCH (a:Person)--(:Movie)--(other:Person) MERGE (a)-[:KNOWS]-(other)Now, we could recommend new people for Tom Hanks to work with, by looking for the people he knows, then the other people they know that Tom doesn’t know:
EXPLAIN MATCH (a:Person {name:"Tom Hanks"})-[:KNOWS]->(b:Person)-[:KNOWS]->(c:Person) WHERE NOT (a)-[:KNOWS]->(c) RETURN c.nameWe’ve used
EXPLAIN
to display the execution plan, where you’ll notice the new TriadicSelection operator, which optimizes the solution to this query.
Property Must Exist
In large organizations, it’s common to have multiple applications accessing the same database. That’s when constraints are helpful to supplement application-level conventions. Sticking with the Movie Graph, we could insist that thetitle
property exists on all Movies:
CREATE CONSTRAINT ON (m:Movie) ASSERT exists(m.title)(This Property Must Exist constraint is exclusive to Neo4j Enterprise Edition.)
Delete
Removing a node along with any existing relationships is such a common operation that we’ve added a special variation onDELETE
which concisely expresses just that.
For instance, we could remove a mistakenly added Person from the Movie Graph:
MATCH (a:Person) WHERE a.name = "Emil Eifrem" DETACH DELETE a
Windows Power!
Windows users can now use a full complement of Powershell scripts for managing Neo4j, making it convenient to orchestrate the management of Neo4j.Query Warnings in the Neo4j Browser
To help you write the best queries possible, Cypher now reports warnings about queries which might be less-than-awesome. In the Neo4j Browser, you may notice a little yellow warning sign pop up when something about your query could be improved. Click on the warning, and you’ll get a nice explanation about the concern, such as this explanation about calculating a Cartesian product:
More Features
The Milestone 3 release also includes a number of other new features, such as:- Range queries can now be solved using index seeks
- Function
exists()
may use index scan LIMIT
influences planning costs- Inequality predicates can now be chained on the form
0 < n.prop < 10