// 1. have import files car.csv and persons.csv in the ../import directory and // // in neo4j.conf set and then restart Neo4j // dbms.security.allow_csv_import_from_file_urls=true // 2. Load CSV files and create nodes // Load persons data and create Person nodes LOAD CSV WITH HEADERS FROM "file:///persons.csv" AS row MERGE (p:Person {id: toInteger(row.ID)}) SET p.name = row.NAME, p.address = row.ADDRESS; // Load cars data and create Car nodes LOAD CSV WITH HEADERS FROM 'file:///cars.csv' AS row MERGE (c:Car {id: toInteger(row.ID)}) // Ensure unique Car nodes by ID SET c.type = row.TYPE, c.model = row.MODEL, c.owner = toInteger(row.OWNER_ID); // Use OWNER_ID temporarily // 3. Create relationships between nodes // Match each car with its owner using the OWNER_ID property MATCH (c:Car), (p:Person) WHERE c.owner = p.id MERGE (c)-[:OWNER]->(p); // 4. Remove foreign key (OWNER_ID) from Car nodes // The owner property is no longer needed as we have established relationships MATCH (c:Car) REMOVE c.owner;