Released back in 2012, Neo4j 1.8.M03 introduced the RELATE clause, a two-step dance of MATCH or CREATE. Also, new Transaction support in the shell lets you call for a do-over in case you misstep.

RELATE, a Subgraph Match-Maker

A RELATE clause looks a lot like a MATCH clause — the ASCII-art of graph traversals — but behaves differently when there isn’t a satisfying subgraph. When there is no match, RELATE will create the needed Relationships and even intervening Nodes. RELATE ensures that the subgraph exists.
So, I just fetched myself a coffee. Let’s say I want to keep track of how often I visit 3 Bees Coffee. I could carve notches on my desk, but I’ve already ruined one Ikea desk that way. Being graph-minded, I immediately realize that I’ll be curious about deeper questions regarding all the places I visit. I will, of course, evolve a graph mini-app.
Neo4j 1.8.M01 introduced the CREATE clause, so I’ll create me and the coffee shop:

Leave a Reply

Your email address will not be published. Required fields are marked *