Head's Up! Site maintenance this Wednesday, February 1. Disruptions expected as we migrate the forums.
β06-26-2022 07:57 PM
Hi, I'm new to Cypher and I'd like to create a couple hundred new nodes from a CSV file and branch these off from a single parent node. What Cypher statement can I use to create the single parent node and then upload and link the CSV data? I'm thinking something like this: LOAD CSV FROM 'https://data.neo4j.com/bands/artists.csv' AS line CREATE (n:Artists)-[:ARTIST]->(:Artist {name: line[1], year: toInteger(line[2])})
Am not sure how to create the single parent node and relationships which the CSV data will create?
β06-27-2022 01:49 AM
You could create the node before the import and βmatchβ to retrieve it in the query, or βmergeβ it in the query to βcreateβ it if it doesnβt exist and match it to retrieve it
Try the following, assuming it was already created and has βidβ property of 100. Substitute any predicate that works.
Match (n:Artist{id:100})
with n
LOAD CSVFROM 'https://data.neo4j.com/bands/artists.csv'AS line
merge (n)-[:ARTIST]->(:Artist{name: line[1], year: toInteger(line[2])}
All the sessions of the conference are now available online