Using Neo4j version 1.8.1, I'm trying to make use of the "cypher" REST entry point to insert many relationship (the query must insert the relationship, and only if necessary the destination node). I found this possibility through http://christophewillemsen.com/streemz/8/importing-initial-data-with-the-neo4j-rest-api blog post.
It works well if I create only one relationship but it fails as soon as I try several.
The JSON used to make the call for one relationship which is working :
{"query":"START n=node:node_auto_index(UserId='21000001') CREATE UNIQUE n-[:KNOWS{Label:'Friend'}]-(m{Users})", "params":{"Users" : [{"UserId":"21000003"}]}}
The one I tried to make 2 relationship which is failing :
{"query":"START n=node:node_auto_index(UserId='21000001') CREATE UNIQUE n-[:KNOWS{Label:'Friend'}]-(m{Users})", "params":{"Users" : [{"UserId":"21000002"},{"UserId":"21000003"}]}}
The error Retunred by the REST call is :
{
"message": "The pattern CreateUniqueAction(List(m-[:`LOVES`]-n)) produced multiple possible paths, and that is not allowed",
"exception": "UniquePathNotUniqueException",
"stacktrace": "..."
}
Not knowing how exactly my query is transformed inside Neo4j it's hard to find how I must change my query.
I thought that Neo4j would do 2 queries, but by the errors it seems that it is doing kind of IN statement for the other node end.
I also tried to make params as a list but it did not worked.
Thank you for your help