3
votes

When I write a simple Cypher query like this:

MATCH (r:Person {name:'Jon'})
MATCH (s:Person {name:'Ana'})
CREATE UNIQUE (r)-[:FRIEND_OF]->(s)

I'm receiving an alert messsage in the Neo4j browser. The alert message says:

The RULE planner is not available in the current CYPHER version, the query has been run by an older CYPHER version. CREATE UNIQUE is unsupported for current CYPHER version, the query has been execute by an older CYPHER version

Here a print screen of the alert message:

Alert message

I searched by this message in the Neo4j Github and did not find anything. Also the docs has no mention to any depreciation.

My question is: Is CREATE UNIQUE deprecated? Why?

I'm using Neo4j 3.2.1.

Thanks.

PS: I know my query can be refactoring. It is only an example. Also all refactoring made in the query using CREATE UNINQUE show the same alert message in the Neo4j browser.

2
I can't answer your question, but as an FYI (and you may already be aware) but I think you can refactor your query like so MATCH (r:Person {name:'Jon'}), (s:Person {name:'Ana'}) CREATE UNIQUE (r)-[:FRIEND_OF]->(s) (aka get ride of the second match and replace with a ,)John

2 Answers

6
votes

CREATE UNIQUE is set to be completely replaced by MERGE. So your syntax would be :

MATCH (r:Person {name:'Jon'})
MATCH (s:Person {name:'Ana'})
MERGE (r)-[:FRIEND_OF]->(s)

Regards, Tom

0
votes

Try this

MATCH (lft:Person {name:'Jon'}),(rgt)
WHERE rgt.name IN ['Ana']
CREATE UNIQUE (lft)-[r:KNOWS]->(rgt)
RETURN r

note that you can search for multiple names too like this

MATCH (lft:Person {name:'Jon'}),(rgt)
WHERE rgt.name IN ['Ana','Maria']
CREATE UNIQUE (lft)-[r:KNOWS]->(rgt)
RETURN r