I am trying to make a word-pair frequency query
I'm getting this error:
Neo.ClientError.Statement.SemanticError: Cannot merge node using null property value
I tried to fix it with
where not text.content is null
But then I get a syntax error
Here is my code:
USING PERIODIC COMMIT
LOAD CSV FROM "file:///check.csv" AS text
FIELDTERMINATOR ' '
UNWIND range(0,size(text)-2) AS i
MERGE (w1:Word)
where not text.content is null
ON CREATE SET w1.content=text[i]
ON CREATE SET w1.count=1
ON MATCH SET w1.count=w1.count+1
MERGE (w2:Word)
where not text.content is null
ON CREATE SET w2.content=text[i+1]
ON CREATE SET w2.count=1
ON MATCH SET w2.count=w2.count+1
MERGE (w1)-[r:NEXT]->(w2)
ON CREATE SET r.count=1
ON MATCH SET r.count=r.count+1
RETURN text
You need to use this syntax: MERGE (node:Label {key: value}) where key-value are your merge attributes that identify your nodes uniquely.
So in your case:
USING PERIODIC COMMIT
LOAD CSV FROM "file:///check.csv" AS text
FIELDTERMINATOR ' '
WITH text where not text.content is null
UNWIND range(0,size(text)-2) AS i
MERGE (w1:Word {content:text[i]})
ON CREATE SET w1.count=1
ON MATCH SET w1.count=w1.count+1
MERGE (w2:Word {content:text[i+1]})
ON CREATE SET w2.count=1
ON MATCH SET w2.count=w2.count+1
MERGE (w1)-[r:NEXT]->(w2)
ON CREATE SET r.count=1
ON MATCH SET r.count=r.count+1
RETURN text