1
votes

This is for Neo4j Milestone Release 2.1.0-M01. I have been trying to import this small .csv file:

Google Doc

I have tried four different formats for column D.

  • type: "club"
  • type: club
  • type:club
  • club

My Cypher query:

LOAD CSV FROM "file:<PATH_TO_FILE>/Soccer_players.csv" AS line
MERGE (p:Player {name: line[0]})
MERGE (t:Team {name: line[1]})
CREATE (p)-[:PLAYS_FOR {type: line[3]}]->(t)

When I don't include "{type: line[3]}", it imports fine. When trying to add this relationship property I get the error message

[null] is not a supported property value

Yes, I can import as a node, but why doesn't it work to set a property on a relationship in this way.

2

2 Answers

1
votes

I changed the fourth column back to club/national, and also your query to get team name from the third column and didn't have any problems.

See Google Doc for a copy of your sheet updated, and my Cypher:

LOAD CSV FROM "file:filepath/Soccerplayers.csv" AS line
MERGE (p:Player {name: line[0]})
MERGE (t:Team {name: line[2]})
CREATE (p)-[:PLAYS_FOR {type: line[3]}]->(t)

neo4j-sh (?)$ match n-[r:PLAYS_FOR]->m return n.name,r.type,m.name limit 5;
+------------------------------------------------------------+
| n.name            | r.type     | m.name                    |
+------------------------------------------------------------+
| "Sergio Romero"   | "club"     | "Monaco"                  |
| "Sergio Romero"   | "national" | "Argentina National Team" |
| "Mariano Andœjar" | "club"     | "Catania"                 |
| "Mariano Andœjar" | "national" | "Argentina National Team" |
| "Agust’n Ori—n"   | "club"     | "Boca Juniors"            |
+------------------------------------------------------------+
0
votes

I had the same problem. If the CSV file has 4 columns and you are pulling data from all the 4 its gives the null property error. Hence the easy solution for me was to add a dummy 5th column in the end and load.

Maybe the importer is looking for some EOL character or something.