nosql - Cypher query to create multiple nodes and relationships -


i'm trying write cypher query create multiple nodes , relationships in 1 query. documentation on using create clauses in cypher states it's not possible create multiple nodes of different types in singular create clause.

however hints should able break multiple create's. couple of similar answers have read point same solution well. i've tried doing , keep getting response error.

error: if create multiple elements, can create 1 of each. 

here brief outline of i'm trying do.

  1. create item node.
  2. create multiple representation nodes.
  3. create relationship between created item node , existing stack node.
  4. create multiple relationships between created item node , created representation nodes.

this query i'm using attempts break individual parts of create process individual steps.

start stack=node({stack}) create (item {item})  create (representations {representations}) create (stack)-[:item]->(item) create (item)-[:representation]->(representations) return item, representations 

i've tried several variations of above query, including putting creation of item , representation nodes @ beginning of query.

i appreciate advice. don't want resort making multiple database calls if can avoided.

is representations list ? can have single create statement.

i assume neo4j 1.9 syntax.

what can though use foreach

start stack=node({stack}) create (item {item})  create (stack)-[:item]->(item) foreach (r in {representations} :     create (representation {r}), (item)-[:representation]->(representation) ) match (item)-[:representation]->(representations) return item, representations 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -