Cypher 'Node There is already a problem with MERGE

I succeeded in why I am having a problem with this Cypher status when I have a unique restriction on the node location address, but I use a merge that should find that if it exists and returns only the identifier for the rest of the statue. What am I missing?

Here is my statement:

MERGE(l:Location{location_name:"Starbucks", address:"36350 Van Dyke Ave", city: "Sterling Heights",state: "MI", zip_code:"48312",type:"location",room_number:"",long:-83.028889,lat:42.561152})
CREATE(m:Meetup{meet_date:1455984000,access:"Private",status:"Active",type:"project",did_happen:"",topic:"New features for StudyUup",agenda:"This is a brainstorming session to come with with new ideas for the companion website, StudyUup. Using MatchUup as the base, what should be added, removed, or modified? Bring your thinking caps and ideas!"})
WITH m,l 
MATCH (g:Project{title_slug:"studyuup"}) MATCH (p:Person{username:"wkolcz"})
WITH m,l,g,p  
MERGE (g)-[:CREATED {rating:0}]->(m)
MERGE (m)-[:MEETUP_AT {rating:0}]->(l)-[:HOSTED_MEETUP]->(m)
MERGE (m)<-[:ATTENDING]-(p)
RETURN id(m) as meeting_id

I get:

Node 416 already exists with label Location and property "address"=[36350 Van Dyke Ave]
+4
source share
1 answer

You are faced with a widespread misunderstanding MERGE. MERGEunited in everything that you indicated in one sentence MERGE. Thus, the order of operations:

  • Find a :Locationnode with all the properties you specified.
  • If found, return node.
  • , node.

3. node , 3 node . , .

, , , SET . :

MERGE (l:Location {address:"36350 Van Dyke Ave"})
SET l.location_name = "Starbucks",
     l.city = "Sterling Heights"
...

, . , . :

MERGE (node1:Label1 {unique_property: "value"})
MERGE (node2:Label2 {unique_property: "value"})
MERGE (node1)-[:REL]-(node2)
+8

Source: https://habr.com/ru/post/1628643/


All Articles