cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

CSV NULL error

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
1 ACCEPTED SOLUTION
5 REPLIES 5

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

i had tried with above code with my data set ,but i am facing this error can you please tell me the solution.
.2X_6_63667b03e6087a45c38ec56334ab927f1010c776.png

Can you put the CSV file (with dummy values if it's sensitive data) somewhere so that I can try to reproduce it?

Perhaps you have certain entries where your row has fewer entries?