'neo4j - puzzling behavior where should be very simple

I'm totally baffled. Have been using neo4j for a while now but my file just got much much bigger (1.4G) and all of a sudden simple queries just don't work anymore. Does cypher break down when the file gets big?

MATCH (n:Node) 
WHERE n.ID = "myid" 

WITH DISTINCT n 

OPTIONAL MATCH (n)-[rel:RELATIONSHIP]->(:Node) 
REMOVE rel.Property 

WITH DISTINCT n 

OPTIONAL MATCH (n)-[rel:RELATIONSHIP]->(other:Node) 
WHERE other.ID in ["this","that"] 
SET rel.Property=true //I added this inside a foreach and both "this" and "that" started getting set properly, but I'm not sure why that would make a difference...

return n, other

This query invariably only sets Property to true for "that" and not "this". I'm totally baffled. When instead I end with RETURN rel {.*}, id(rel) it shows two trues with one of the rel ids 67876, but then when I

MATCH ()-[rel]-() 
WHERE id(rel)=67876
RETURN rel {}

I get {} as a result (ie the property is not there at all!!)

I added foreach but does not seem to really make a difference (nor should it I don't think).

Even more confusing, if I end with WITH DISTINCT n return [(n)-[rel:RELATIONSHIP]->(o) | rel.filter] it will be missing one. However, if I remove the DISTINCT n, I get more than one row and the last ones are correct-- ie in the results the exact same relationship is coming back as having Property first null then true. It's like I've come across Schrödinger's cat.

Could my file be corrupt and how would I fix it? TIA!

Addendum: I got it to work by repeating the match at the end and doing away with comprehensive maps for the return, but I'm still puzzled about why the comprehensive maps are returning incorrect information in first row and correct information in second row - all referring to the same relationship property.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source