Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to execute a list of Cypher statements in Neo4j via the admin interface

Tags:

neo4j

I have a file that contains a long list of Cypher statements, something like:

create (n:oeuvre {ide12:"41",numpers:[87603],titre:"JE PARS"});
create (n:oeuvre {ide12:"151",numpers:[395225,364617,396308,306762],titre:"I DID IT FOR LOVE"});
create (n:oeuvre {ide12:"67",numpers:[54001],titre:"GRAND PERE N AIME PAS LE"});
create (n:oeuvre {ide12:"80",numpers:[58356],titre:"MON HEURE DE SWING"});
create (n:oeuvre {ide12:"91",numpers:[58356],titre:"AU QUATRIEME TOP"});

When I drag my file on the Cypher admin console area "Drop a file to import Cypher or Grass" and then click on the little play icon, I get the message "Expected exactly one statement per query but got: 1405".

Is there a way to batch execute Cypher requests via the admin console? The wording "Drop a file to import Cypher" seems to suggest so.

Thanks

Yann

like image 824
Yann Avatar asked Apr 14 '15 13:04

Yann


People also ask

How can you run CQL commands in Neo4j?

“$” prompt is used to run CQL commands in Neo4j.

What Neo4j Browser command do you use to access a Browser guide?

The guide drawer contains interactive Neo4j Browser guides for learning concepts and tools with Neo4j. Show the guide drawer with a specific Neo4j Browser guide. The name can be specified with or without the Hyphen ( - ) character, e.g, :guide movie-graph or :guide movie graph .

How do you perform an aggregation in Cypher?

The Cypher query offers aggregation similar to GROUP BY offered by SQL. The aggregate function can take multiple values and can calculate the aggregated values for them. In this recipe, we will learn the common aggregation techniques, with the help of examples.


1 Answers

Yeah, the console just let's you run one statement at a time. Fortunately a statement can have multiple CREATE clauses, so if you just remove the semi-colon characters it should work.

Alternatively you can use the neo4j-shell command with the -file argument to run a cypher script file. This method allows for scripts with multiple commands separated by semi-colons.

like image 118
Brian Underwood Avatar answered Sep 26 '22 21:09

Brian Underwood