Error loading data when using

I'm creating new relationships between existing nodes by importing a CSV file. I had done queries to import csv for specific types of relationships and now , I trying to parse a mixed type CSV using but problem appears while starting the first non-header row:

Failed to invoke procedure Caused by: java.lang.NullPointerException (Failure when processing file '/home/bmalbusca/Applications/neo4j-community-4.1.3/import/rel-complex-waternodes.csv' on line 2.)

I'm literally using the other singular relationships queries inside . I'm missing somethig? This is the file rel-complex-waternodes.csv:

"CONNECTED,5,6,AduaĆ§Ć£o Blocos de Rega,Gravidade,"

And here is the query:

LOAD CSV WITH HEADERS FROM "file:///rel-complex-waternodes.csv" as row
WITH row
CALL[row.relation = "CONTAINED",'MATCH (s:Station{id:row.start}), (w:WaterNode{id:row.end}) CREATE (s)-[r:CONTAINED]->(w) RETURN r', 
				   row.relation = "RELATED",'MATCH (n), (f:Feature{id:row.end}) WHERE (n:WaterNode OR n:Station) AND CREATE (n)-[r:RELATED]->(s) RETURN r',
                   row.relation = "REPRESENTED",'MATCH (w:WaterNode{id:row.start}), (f:Feature{id:row.end}) CREATE (w)-[r:REPRESENTED]->(f) RETURN r',
                   row.relation = "CONNECTED",'MATCH (n1), (n2) WHERE (n1:WaterNode OR n1:Station)  AND (n2:WaterNode OR n2:Station) AND AND 
                    			   CREATE (n1)-[r:CONNECTED {type: row.type, subtype: row.subtype, flow_rate: toFloat(row.flow_rate)}]->(n2) RETURN r']
             	  ,'',{row:row}) YIELD value
Return count(value.r)

It complains about line 2 of the csv. As a test if you remove line 2 from the csv does it still fail?

Also is each line in the csv wrapped in " characters ? If you remove the leading and trailing " characters does it still fail ??

1 Like