Vishal Jain
Vishal Jain

Reputation: 11

CSV import to Neo4j

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!

Upvotes: 1

Views: 623

Answers (1)

Mattias Finné
Mattias Finné

Reputation: 3054

I've identified a number of problems here:

Nodes

-nodes:Cust C:\Neo4j\AUData\AUCustHeader.csv, C:\Neo4j\AUData\AUCust.csv

Should be either quoted or the space after the comma removed. Why not both: e.g.

-nodes:Cust "C:\Neo4j\AUData\AUCustHeader.csv,C:\Neo4j\AUData\AUCust.csv"

Relationships (1)

--relationships: SENT_TO C:\Neo4j\AUData\AUTxnsHeader.csv, C:\Neo4j\AUData\AUTxns.csv

Have the same problem.

Relationships (2)

Additionally

--relationships: SENT_TO
should have no space there, e.g.
--relationships:SENT_TO

Upvotes: 1

Related Questions