A few unrelated queries in Neo4j Cypher?

Does http://localhost:7474/browser/ support multiple unrelated requests

This code:

 MATCH (a {cond:'1'}), (b {cond:'x'}) CREATE a-[:rel]->b MATCH (a {cond:'2'}), (b {cond:'y'}) CREATE a-[:rel]->b MATCH (a {cond:'3'}), (b {cond:'z'}) CREATE a-[:rel]->b 

causes an error:

WITH required between CREATE and MATCH

But since my queries are unrelated, I don't think I need WITH .

How can I do this without having to enter it one at a time?

+11
neo4j cypher
source share
4 answers

In recent releases, developers have added an option in the Neo4j browser to perform multiple requests.

Open your browser’s settings and click on β€œ Enable Query Editor with multiple claims . ”

Then just put a semicolon at the end of each request and add them to your browser console.

Screenshothot

This is how it looks

Screenshothot

+1
source share

How work around you can do:

 MATCH (a {cond:'1'}), (b {cond:'x'}) CREATE a-[:rel]->b WITH 1 as dummy MATCH (a {cond:'2'}), (b {cond:'y'}) CREATE a-[:rel]->b WITH 1 as dummy MATCH (a {cond:'3'}), (b {cond:'z'}) CREATE a-[:rel]->b 

See also import blog post: http://blog.neo4j.org/2014/01/importing-data-to-neo4j-spreadsheet-way.html

+16
source share

I do not know how to send several unrelated requests at once through the Neo4j browser. However, at the REST level, this is entirely possible using a transactional HTTP endpoint .

+3
source share

You can send multiple requests to Neo4j using the cypher-shell command-line tool:

 cypher-shell --format plain < query.txt 

where query.txt contains several independent queries separated by half-columns. It also works interactively as soon as you run cypher-shell.

+3
source share

All Articles