1

I'm following this guide to create a graph dataset. Now I have to import a CSV file in Neo4j. To do this I'm using this script where I have edited only the paths to the CSV file.

When I execute it in Neo4j shell I get this error:

Neo.ClientError.Statement.SyntaxError: Invalid input 'R': expected 'e/E' 
(line 23, column 2 (offset: 1116))
"DROP CONSTRAINT ON (a:PERSON) ASSERT a.number IS UNIQUE;"

Also, these lines are underlined with error:

extraneous input

ON CREATE SET a.first_name = line.FIRST_NAME, a.last_name = line.LAST_NAME, 
a.full_name = line.FULL_NAME
ON MATCH SET a.first_name = line.FIRST_NAME, a.last_name = line.LAST_NAME, 
a.full_name = line.FULL_NAME
...
ON CREATE SET c.start = toInt(line.START_DATE), c.end= toInt(line.END_DATE), 
c.duration = line.DURATION
MERGE (d:LOCATION {cell_tower: line.CELL_TOWER})
ON CREATE SET d.address= line.ADDRESS, d.state = line.STATE, d.city = 
line.CITY
...

Instead, this line gets this error message:

Missing ';' at DROP

DROP CONSTRAINT ON (a:PERSON) ASSERT a.number IS UNIQUE;
1
  • Rather than repeating the same things in ON CREATE SET and ON MATCH SET, just use these for properties that are specifically in one or the other, not both. Then use a normal SET for properties that you want set in any case. Commented May 15, 2018 at 17:34

2 Answers 2

2

First, you should put your CSV file in the Neoj4 import directory. If you are using a Windows desktop community edition version, this directory is %APPDATA%\Neo4j Community Edition\import (see file location docs).

Then change your LOAD CSV statement to:

LOAD CSV WITH HEADERS FROM "file:///call_records_dummy.csv" AS line
Sign up to request clarification or add additional context in comments.

2 Comments

In windows i can't find this file. I've neo4j dekstop v1.1 in linux i edited conf file to load file from everywhere but i've same errors
stupid question: can i insert all istructions in one shot o do i have to insert one instruction per time?
0
  1. Adding ID field in dataset
  2. rename field "cell_site" in "cell_tower" in dataset
  3. Open .conf file and allow to load file from everywhere
  4. execute istructions in block, not in the same command.

1 Comment

Is this the step-by-step procedure you followed to solve your issue?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.