1
votes

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;
2
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.InverseFalcon

2 Answers

2
votes

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
0
votes
  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.