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?
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.
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 :)
Related
I have created a graph database within Neo4j Desktop (version 1.1.10) I wish to export that as a Cypher file.
How do I do that? I can't see any command within the app for export a Cypher file.
You can try following the documentation here: Neo4j - Export a (sub)graph to Cypher script and import it again
First, install the apoc procedure library, and add it into the plugins directory.
Second, run Neo4j as an administrator. If not, Neo4j doesn't have permission to write files.
Before starting Neo4j, edit the neo4j.conf file and add this line:
apoc.export.file.enabled=true
Then, start Neo4j, and in the Neo4j browser, execute the following command:
CALL apoc.export.cypher.all("export.cypher",{})
This will store the whole database in the file "export.cypher".
After upgrading from Neo4j 2.2.5 to Neo4j 2.3.1 on Windows Server 2012 R2 with Java 8.45, we encountered a problem with file handles. When running the command shown at the bottom of this post using either the web interface or neo4jshell.bat, the cypher completes successfully and a process monitor trace confirms that Java successfully closed the file. However, I am unable to move that csv file because the file is open in another process. Handle.exe confirms that Java still has a read-write handle on that file.
When I run the same process against a Neo4j 2.2.5 graph on the same machine with the same file, Java does not retain the read-write handle on the csv file. We will need to revert to 2.2.5 until this issue is resolved. The only application change we made during the upgrade from 2.2.5 to 2.3.1 was to accommodate the new file reference format (file:///x://filename.csv vs. file:x:/filename.csv).
Are there other actions we can take short of restarting the service or stopping and starting the drive to force Java to close this file? I understand that Neo4jShell.bat is deprecated in favor of the powershell commands, but ultimately the issue is that Java is retaining the file handle, so changing the method of delivering the cypher command can't improve the way Java is handling the csv file. I've run the same cypher from both the web interface and neoj4shell.bat and gotten the same result.
USING PERIODIC COMMIT 3000
LOAD CSV WITH HEADERS
FROM "file:///x://filename.csv"
AS line
MATCH (a:node {id : line.id}), (b:othernode {id : line.other_id})
WITH a, b
WHERE shortestPath((a)-[:PREVIOUS]->(b)) is null
CREATE (a)-[:PREVIOUS]->(b);
I can't find the neo4j-shell after installing the community edition on Windows. Am I missing something. I wanted to use it to run in a batch of cypher statements.
For Version 2.2.0 in Windows, go to the Neo4j Community Launcher, then click options, click on Command Line tools/ Command Prompt, then type Neo4jShell. You can paste sequences of queries into the shell, very convenient to load a series of CSV imports for instance..
Install the binary from here: http://www.neo4j.org/download/other_versions
Then navigate to the bin folder and run Neo4jShell.bat.
I am new to Neo4j.I downloaded the software from www.neo4j.org and I was able to create the Movie graph which came with the download.
Now I am trying to export data from spreadsheet into Neo4j.Here is the procedure I am following
I was stuck at the last step - THEN EXECUTE THE FOLLOWING COMMAND, making sure that Neo4j is NOT running:
cat import.txt | <neo4j directory>/bin/neo4j-shell -config conf/neo4j.properties -path <neo4j directory>/data/graph.db
I am not sure where to find neo4j-shell and conf/neo4j.properties.I don't have these folders in my download.Then I found that I have to download ne04j-community-2.0.1-windows.
I downloaded it and I see neo4j-shell and also conf/neo4j.properties.Now that I have all the things requires to execute the above statement, I am not sure where to execute it.
I am using windows and I am not familiar with scripting.Can you guide me how and where to execute the command so that I can see the nodes and relationships created in Neo4j.
Thankyou!
On the Windows with the installer the shell is not officially installed.
See this blog post for an explanation: http://java.dzone.com/articles/solving-problems-neo4j-shell
C:\Program Files\Neo4j Community>jre\bin\java -cp bin\neo4j-desktop-2.0.0.jar org.neo4j.shell.StartClient
Btw. for other cool examples check out http://blog.bruggen.com
When you install 1.9.4 using the new Windows installer, from where does one launch the Neo4j-Shell (previously found in bin)?
The neo4j-shell isn't currently shipping with the neo4j desktop but you can launch it by running the following command from 'C:\Program Files\Neo4j Community\' (or equivalent location:):
jre\bin\java -classpath bin\neo4j-desktop-1.9.4.jar org.neo4j.shell.StartClient
I'm not sure whether there are plans to include it in the next release, I'll check.
You can uninstall your neo4j windowns instalation version, so you can download an zip file with contains the neo4j binary version for Windows at http://www.neo4j.org/download. Using this version, you can find the bin, conf and lib folder. Besides that, you can find the Neo4jShell.bat. This file is the shell.
I believe the stand alone Neo4j-Shell isn't included in the installer for 1.9.4, but there is the Power tool console in the web interface, and you can also use the shell from the 1.8.3 package. I have no idea if it's supported though, but it seems to work.
For future googlers who end up here, there is a cypher shell at <neo4_dir>\bin\cypher-shell.bat. Neo4j-CE-3.1.0