user3485451
user3485451

Reputation: 1

NEO4J execute severals statement

How it's possible to run a collection of query like this (came from a spreadsheet copy) directly in one cypher query? one by one it's ok, but need 100 copy/paste

*******************************
MATCH (c:`alpha`)
where c.name = "a-01"
SET  c.CP_PRI=1, c.TO_PRI=1, c.TA_PRI=2
return c ;

MATCH (c:`beta`)
where c.name = "a-02"
SET  c.CP_PRI=1, c.TO_PRI=1, c.TA_PRI=0
return c ;

and 100 other lines ...

*********************************

Upvotes: 0

Views: 96

Answers (2)

MarcoL
MarcoL

Reputation: 9989

Talking about the REST API you can use the transactional endpoint in Neo4J 2.0, or the batch endpoint in Neo4J 1.x.

If you want to use the shell, have a look to the import page, in particular the neo4j-shell-tools where they're importing massive quantity of data batching multiple queries.

Upvotes: 1

Dan G
Dan G

Reputation: 1118

you may try the 'union' clause, which joins the results of queries into one big-honkin result set:

http://docs.neo4j.org/chunked/milestone/query-union.html

That said - the root behavior of what you are trying to do could use some details - maybe there's a better way to write the query - you could use Excel to 'build' the unified query via calculations / macros, you could possibly write a unified query that combines the rules you are trying to follow, there's a lot of options, but it's hard to know a starting direction w/o context....

Upvotes: 2

Related Questions