Neo4j Cypher: How to stop duplicate SET if multiple CREATES -


i have complex cypher query creates multiple nodes , increments counters on nodes. sake of example here simplified version of trying do:

start = node(1), e = node(2) create a-[r1]->(b {})-[r2]->(c {}), e-[r3]->b-[r4]->(d{}) set a.first=a.first+1, e.second=e.second+1 return b 

the issue because there 2 create commands set commands run twice , values incremented 2 instead of 1 intended. have looked see if can merge multiple create statements , cannot.

my initial idea separate out different creates batch query, wondering if there option.

where executing query? version of neo4j using?

i went console.neo4j.org , ran following , correctly added 1 both a.first , e.second:

start = node(1), e = node(2)  create a-[r:knows]->b-[r2:knows]->c, e-[:knows]->b-[:knows]->d  set a.first=a.first+1, e.second=e.second+1  return b 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -