Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cyper - odd error when creating relationship

Tags:

neo4j

cypher

I've got the following query, which responds with the very cryptic error message of

"Invalid input 'H': expected 'i/I' (line 2, column 2)"

Here's the query:

CREATE UNIQUE (c:AccountCharge)-[:ACCOUNT_CHARGED]->(a:Account)
WHERE (a.ID = "a7f7def6-8f2b-4b21-bfac-dab2f6e6eaae")
AND (c.ID = "666b1865-e29d-455b-abb0-50d679952543")

Both the nodes exist, and I can't see where there's a break anywhere, but Neo4J does not like it at all.

The query's being created by C# Neo4JClient, but even retyping it manually I still get the same error, so it's not a hidden character or anything.

like image 964
Mathieson Avatar asked Jun 14 '15 06:06

Mathieson


1 Answers

WHERE can only be used with the MATCH clause.

The expected I is because for cypher the possible clause after a CREATE is a WITH clause, so the second letter is a I instead of a H.

You should then first MATCH the two nodes and create the unique relationship afterwards

like image 129
Christophe Willemsen Avatar answered Oct 06 '22 19:10

Christophe Willemsen