CSV import to Neo4j

101 views
Skip to first unread message

vishal jain

unread,
Mar 29, 2016, 8:31:48 PM3/29/16
to Neo4j
Hi

I've recently installed the community version of Neo4j on my 32 bit(Windows7) machine. I'm trying to use the Neo4jImport tool to upload csv data but have been unsuccessful. Below are the details of the data and the script:

Data (stored at C:\Neo4j\AUData):

"AUCustHeader.csv" has just one row as below

customerId:ID,:LABEL

"AUCust.csv" has ~150k rows in the below format (no header)

100539589,Customer
111738174,Customer
115191760,Customer
117774313,Customer
119793144,Customer

"AUTxnsHeader.csv" has just one row as below

START_ID,Txns,:END_ID,:TYPE

"AUTxns.csv" has ~98k rows in the below format (no header)

100539589,1,7000000000587269043,SENT_TO
100539589,1,7000000000621301017,SENT_TO
111738174,2,7000000000565458678,SENT_TO
115191760,1,7000000000341672243,SENT_TO
115191760,1,7000000000399157660,SENT_TO

Below is script I'm executing on the powershell: 

PS C:\neo4j\bin> C:\Neo4j\bin\Neo4jImport --into C:\Neo4j\AUData\AU.db --nodes:Cust C:\Neo4j\AUData\AUCustHeader.csv, C:\Neo4j\AUData\AUCust.csv --relationships: SENT_TO C:\Neo4j\AUData\AUTxnsHeader.csv, C:\Neo4j\AUData\AUTxns.csv

Running this gives me the below message:

WARNING! This batch script has been deprecated. Please use the provided PowerShell scripts instead: http://neo4j.com/docs/stable/powershell.html
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/neo4j/tooling/ImportTool : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: org.neo4j.tooling.ImportTool.  Program will exit.

I've also tried executing this on the Neo4j prompt which gives a slightly (but an error message nevertheless) different message :

WARNING! This batch script has been deprecated. Please use the provided PowerShell scripts instead: http://neo4j.com/docs/stable/powershell.html
Input error: Expected '--relationships' to have at least 1 valid item, but had 0 []
Caused by:Expected '--relationships' to have at least 1 valid item, but had 0 []

java.lang.IllegalArgumentException: Expected '--relationships' to have at least 1 valid item, but had 0 []
        at org.neo4j.kernel.impl.util.Validators$4.validate(Validators.java:114)

        at org.neo4j.kernel.impl.util.Validators$4.validate(Validators.java:108)

        at org.neo4j.helpers.Args.validated(Args.java:627)
        at org.neo4j.helpers.Args.interpretOptionsWithMetadata(Args.java:595)
        at org.neo4j.tooling.ImportTool$7.apply(ImportTool.java:706)
        at org.neo4j.tooling.ImportTool$7.apply(ImportTool.java:702)
        at org.neo4j.tooling.ImportTool.main(ImportTool.java:316)
        at org.neo4j.tooling.ImportTool.main(ImportTool.java:279)

Can someone please guide me as to what is it that I'm doing wrong ?

Thanks in advance!

Michael Hunger

unread,
Mar 29, 2016, 8:42:44 PM3/29/16
to ne...@googlegroups.com
It seems you have multiple issues:

1. Java version mismatch, try to run with Java7
2. a space in here --relationships: SENT_TO remove it after the colon
3. You don't have to use the label IN the CSV and ON the command-line, the latter is good enough
4. Check out the powershell scripts: Start-Neo4jImport http://neo4j.com/docs/stable/powershell.html#powershell-advanced-examples

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Vest

unread,
Mar 30, 2016, 7:55:59 AM3/30/16
to ne...@googlegroups.com
You Java version is too old. Neo4j has required Java 7 since 2.0, and will require Java 8 from 3.0.

--
Chris Vest
System Engineer, Neo Technology
[ skype: mr.chrisvest, twitter: chvest ]


Reply all
Reply to author
Forward
0 new messages