How to perform bulk operations in Cypher

79 views
Skip to first unread message

Johnny Luu

unread,
May 30, 2012, 3:34:02 AM5/30/12
to Neo4j Google Groups
I usually have single operations like an addPicture query.

Instead of 10 Cypher requests when adding 10 pictures I want to have an addPictures query where I only make one HTTP request.

How do you loop a parameters value that is an array (consisting of the names of every picture I wanna add).

Here is my current addPicture query I wanna transform:

START root = node(0)
RELATE (root)-[:PICTURE]->(picture {name: {name}})

Johnny

Sent from my iPad

Michael Hunger

unread,
May 30, 2012, 3:35:57 AM5/30/12
to ne...@googlegroups.com
> START root = node(0)
FOREACH (name in {names} : RELATE (root)-[:PICTURE]->(picture {name: name}) )

names being a parameter containing a list/array (Iterable) of name's.

Michael

Johnny Weng Luu

unread,
May 30, 2012, 4:10:00 AM5/30/12
to ne...@googlegroups.com
Didn't know it could be used for parameter array values.


I guess I just have to wait for https://github.com/neo4j/community/issues/567 to be in the latest Heroku Neo4j version :)

Johnny
Reply all
Reply to author
Forward
0 new messages