0
votes

I have been using Neo4j for several months now and am getting pretty exasperated. It appears that every new version breaks the previous one. I have multiple Cypher Load scripts that I can no longer run via the command line.

I can run the following from the Browser:

USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///person.csv" AS csvLine
MERGE (p:Person {sysurn                     : csvLine.urn})                     
ON CREATE SET p.dob = trim(csvLine.dob)
ON CREATE SET p.forename = trim(csvLine.forename)
ON CREATE SET p.surname =  trim(csvLine.surname );

Previously in version 3.0.3 (Community Edition) I ran the following:

java -cp "C:\Program Files\Neo4j CE 3.0.3\bin\neo4j-desktop-3.0.3.jar" org.neo4j.shell.StartClient -file "D:/nosql/Load data/load_person.cql"

This no longer works in 3.1.1:

java -cp "C:\Program Files\Neo4j CE 3.1.1\bin\neo4j-desktop-3.1.1.jar" org.neo4j.shell.StartClient -file "D:/nosql/Load data/load_person.cql"

I get a Java Error. The general consensus is to run the full .tar version, so I installed that.

I can now run the Cypher from the browser or using cypher-shell. However this is of no use as there is no way to call an external script, so I have to do this for possibly hundreds of scripts.

Recommendation is to use ne04j-shell (now deprecated!) I try neo4j-shell. This doesn't accept spaces in the path!

I move the file and try to run the following:

"C:\Program Files\neo4j-community-3.1.1\bin\neo4j-shell"  -path "D:/nosql/neoDB/databases/graph.db" -config "neo4j.conf" -file "D:/nosql/Loaddata/load_person.cql"

I get the following error:

ERROR (-v for expanded information):
    Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory,

D:\nosql\neoDB\databases\graph.db

I have tried various combinations including adding the host name as prompted:

non-JRMP server at remote endpoint

I try adding the -config param, however this again doesn't allow spaces!

With every new version it seems to get more difficult to actually import data into Neo4j.

My question is, Is it possible in version 3.1.1 to run more than one cypher script at a time without manually running every one? Is it possible to use neo4j-shell in version 3.1.1?

2

2 Answers

0
votes

Try using the APOC procedure apoc.cypher.runFile from within cypher-shell. Here is an example (with a file URL formatted for Windows):

CALL apoc.cypher.runFile("file:d:/nosql/Load data/load_person.cql");

If the space in the path still presents problems, you could rename the "Load data" folder to "LoadData" and modify the above query accordingly.

0
votes

Well I have managed to find a workaround.

  • Install neo4j 3.1.1
  • Create a database
  • Uninstall Neo4j
  • Install neo4j 3.0.8
  • Run my Cypher scripts

e.g. java -cp "C:\Program Files\Neo4j CE 3.0.8\bin\neo4j-desktop-3.0.8.jar" org.neo4j.shell.StartClient -file "D:/nosql/Load data/load_person.cql"

  • uninstall neo4j
  • install neo4j 3.1.1

I don't think this is going to cut it in a production environment though :)