Relationship Merge creating unintended nodes

Hi,

I am attempting to do so NLP follow work. Take documents find root term and part of speech (pos), and the sequence of words. I have seemed to get the base documents Patents) in ok as well as the words with their terms and pos and I am now trying to link the words to the host document which is a field in the csv. I need to convert it to integer, but that is straight forward.

When I run the following cypher it says it has created 2675 nodes along with 16000+ relationships. When I ask for example Word I see the base relationships and when expanded it shows the nodes but those nodes have no node label, just an id.

What is the error in my ways?
Andy

LOAD CSV WITH HEADERS FROM 'file:///ulvac_abstract.csv' AS row 
MATCH (a:patent{patNum:ToInteger(row.patent)})
WITH split(row.sentence," ") as text,split(row.pos," ") as POS 
UNWIND range(0,size(text)-2) AS i 
MATCH (w1:Word{term:text[i],pos:POS[i]}) 
MATCH (w2:Word{term:text[i+1],pos:POS[i+1]}) 
MERGE (w1)-[:Is_in]->(a)
MERGE (w2)-[:Is_in]->(a)

The file basically looks like this.

sentence	pos	patent	org
display device drive thin film transistor high brightness provide	NOUN NOUN VERB ADJ NOUN NOUN ADJ NOUN VERB	7999464	ulvac
low voltage drive inorganic luminescent layer control transistor form substrate	ADJ NOUN VERB ADJ ADJ NOUN NOUN NOUN VERB NOUN	7999464	ulvac

Hi @andy.hegedus,

You should add a to the pipeline. So...

LOAD CSV WITH HEADERS FROM 'file:///ulvac_abstract.csv' AS row 
MATCH (a:patent{patNum:ToInteger(row.patent)})
WITH split(row.sentence," ") as text,split(row.pos," ") as POS , a
UNWIND range(0,size(text)-2) AS i 
MATCH (w1:Word{term:text[i],pos:POS[i]}) 
MATCH (w2:Word{term:text[i+1],pos:POS[i+1]}) 
MERGE (w1)-[:Is_in]->(a)
MERGE (w2)-[:Is_in]->(a)

H

Thank you very much!

All for the want of "a".

Sometimes the little things trip you up.

Andy