Hey guys,
Wanted to share this before we make a release out of it.
An important feature for Cypher is to permit idempotent queries. Instead of checking the current state of the graph and then deciding which changes to do, we want users to specify the desired outcome, and leave it up to Cypher to figure out what needs doing to make that outcome real.
An example of that is when you want a pattern to be unique. Between the Andrés node and the Mimi node, there should only be a single MARRIED relationship. Another example is the get-from-index-or-create-and-insert-into-index.
RELATE does not reflect this strongly enough, and I keep seeing people on the mailing list and on Stackoverflow that misunderstand what RELATE is and how it's intended to be used.
So, the plan is to use the same clause for get-or-creating unique nodes, and for get-or-creating unique patterns in the graph. The new keyword will be CREATE UNIQUE.
It works just as RELATE did (it's only a parser change), but it more clearly expresses the uniqueness constraint. CREATE UNIQUE does a lot more checks and locking than CREATE does, and this change should make that a lot clearer.
I'm really sorry that this comes so late in our release cycle for 1.8 - I didn't understand enough sooner to realize this. At the same time, I really don't want to make a public stable release with RELATE and then change it in the first milestone.
Like always - any and all feedback is most welcome.