cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Invalid input 'x': expected 'n/N' (line 1, column 227 (offset: 226))

I am new to NEO4j and have been getting many errors and trouble while trying to learn cypher.
How can I learn cypher properly?

I have been facing error while trying to load a csv file can anyone tell me what i have been doing wrong?

LOAD CSV WITH HEADERS FROM "file:///C:/Users/sitas/AppData/Local/Neo4j/Relate/Data/dbmss/dbms-a5c6a64c-958c-47c9-9068-d1e74d5258ca/import/Experiment_Design.csv" AS line with line merge(Aid:AIdNode{Name:line.analytical_sample external_id}) merge(Sid:SIdNode{Name:line.subject external_id}) merge(g2:G2Node{Name:line.grouping2}) merge(g1:G1Node{Name:line.grouping1}) merge(Bid:BIdNode{Name:line.biological_sample external_id});

Error:

Invalid input 'x': expected 'n/N' (line 1, column 227 (offset: 226))
"LOAD CSV WITH HEADERS FROM "file:///C:/Users/sitas/AppData/Local/Neo4j/Relate/Data/dbmss/dbms-a5c6a64c-958c-47c9-9068-d1e74d5258ca/import/Experiment_Design.csv" AS line with line merge(Aid:AIdNode{Name:line.analytical_sample external_id}) merge(Sid:SIdNode{Name:line.subject external_id}) merge(g2:G2Node{Name:line.grouping2}) merge(g1:G1Node{Name:line.grouping1}) merge(Bid:BIdNode{Name:line.biological_sample external_id}) ;"
1 ACCEPTED SOLUTION

Hi,

Ah, I see. Another approach which can be helpful is to enclose property names in backticks, like this...

merge(Aid:AIdNode{Name:line.`analytical_sample external_id`})

Best,
ABK

View solution in original post

4 REPLIES 4

Hi @sitashmarajbhandari7 ,

A great way to learn Cypher is to take the free online Graph Academy courses. They can take you all the way from the fundamentals to advanced modeling techniques. Well worth the time.

For your particular query, the error is pointing to the letter 'x' in this part of your query...

merge(Aid:AIdNode{Name:line.analytical_sample external_id})
                                               ^

The parser is confused by external_id. You may be missing a property name and full reference to the input. Guessing, it could be something like EID assigned to a value line.external_id from the CSV...

merge(Aid:AIdNode{Name:line.analytical_sample EID:line.external_id})

Spotting those errors can be tricky with a long line of text. If you're using Neo4j Browser, you can switch into multi-line mode by pressing <shift-return> where you'd like to have a line break. Once you're in multi-line mode, pressing <return>will just add newlines. To run the query you'd need to either type <cmd-return> or click on the "play" button.

Best,
ABK

Hello sir,

  1. Thank you so much for the reference to the graph academy. I will be surely taking this course.

  2. The csv file I am using had the property name with the space

I am guessing now that Neo4j browser is not able to parse property name with space therefore will edit the file.

Thank you for your quick response

with regards,
Sitashma Rajbhandari

Hi,

Ah, I see. Another approach which can be helpful is to enclose property names in backticks, like this...

merge(Aid:AIdNode{Name:line.`analytical_sample external_id`})

Best,
ABK

Hello Andreas Kollegger,

It worked! thank you so much!!

with regards
Sitashma