1

I have a set of nodes created using file_A which contains a column with the 'id' of each node. It has been created using this Cypher query (in Java):

USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM 'file:file_A' AS line FIELDTERMINATOR '\t'
CREATE (c:Node {nodeId:line.id})

Now I have another file (file_B) which contains four columns: id, description, prop2 and prop3. I need to assign a description (property 'nodeDesc') to each of the nodes created before. These descriptions will be read from the 'description' column of file_B. Moreover, to assign this value to the 'nodoDesc' property of the node, both 'prop2' and 'prop3' must be equal to '1'. For this purpose I use this Cypher query:

USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM 'file:file_B' AS line FIELDTERMINATOR '\t'
MATCH (c:Node)
WHERE c.nodeId=line.id AND line.prop2='1' AND line.prop3='1'
SET c.nodeDesc = line.description

file_B contains some descriptions for each node, but only one of them has both 'prop2' and 'prop3' equal to '1'. And that is the one I want to assign to the property of the node.

The problem I obtain after executing the previous query is that some of the nodes don't have description. After performing several tests, I have verified that it doesn't do the MATCH of the 'nodeId' with the column 'id' of file_B, but in that column it is the 'nodeId', and both 'prop2' and 'prop3' are equal to 1'.

Note: file_A has 400.000 rows aprox., and file_B has 1.300.000 rows aprox.

Thanks.

Vicente
  • 35
  • 5

1 Answers1

0

You may want to make sure you aren't comparing integers to strings. That can often be the source of mismatches like these.

And if both values are strings, then you may want to check to see if one string or the other has trailing (or preceding) spaces.

InverseFalcon
  • 29,576
  • 4
  • 38
  • 51
  • Hello, thank you for your answer. Values are all string. And there is no trailing or preceding spaces. In fact, if I manually delete all rows of file_B except one of those which are not matched, then it is matched if I execute de cypher query (the second one). – Vicente Feb 08 '17 at 14:28
  • It also matches if I cut one of the rows which are not matched and pasted as the first position of the rows on file_B. Strange behaviour... – Vicente Feb 08 '17 at 15:12