I am trying to create graph from the sample data below. I am new to cypher and learned new things from tutorial and stack help. I am stuck at the problem below. I am trying to create nodes from nested arrays for multiple properties.
Following the link: UNWIND multiple unrelated arrays loaded from JSON file
Sample Data:
[ { 'organization': ['MIT','Univ. of CT'],
'student_names': ['Adam Smith'],
'unique_id': 'ABC123'},
{ 'organization': ['Harvard'],
'student_names': ['Adam Smith', 'Cate Scott'],
'unique_id': 'ABC124'},
{ 'organization': ['Harvard'],
'student_names': ['Mandy T.', 'Bob Smith'],
'unique_id': 'ABC125'}]
Here is what I tried:
CALL apoc.load.json('file:///test2.json') YIELD value AS class
MERGE (c:Class {name: class.name})
SET
c.organization = class.organization,
c.student_names = class.student_names
WITH c, class
UNWIND class.organization AS org
MERGE (o:Organization {name: org})
MERGE (o)-[:ACCEPTED]->(c)
WITH c, class
UNWIND class.student_names AS student
MERGE (s:StudentName {name: student})
MERGE (s)-[:ATTENDS]->(o)
I keep getting error Neo.ClientError.Statement.SemanticError: Cannot merge node using null property value for name
. I don't see any null values in the data. What is causing this? How can I fix this? Thanks!!!