The query below works, and I wish to run the query repeatedly for as long as it has results. Eventually, as I am setting the processed property to 1 on b:MAINS_CS with every iteration, the query will return zero records. I am interested in all records returned by all queries.
I've tried using variable length relationships but the query then seems to run very slowly.
Is there some way to achieve this in cypher without having to manually execute the query each time? I am trying to achieve this in Neo4j browser.
MATCH (a:MAINS_CS)-[:Connects]-(joint:MAINS_JOINT)-[:Connects]-(b:MAINS_CS {cs_source_way_id:a.cs_source_way_id})
WHERE a.cs_source_way_id > 0 AND a.processed = 1 AND b.processed <> 1
SET b.processed = 1
RETURN
a.node_number as parent_spid,
b.node_number as child_spid,
joint.node_type as joint_type