//graphql-neighbouring-rights/src/cypher/ownership-rules/update-monetize-rules-for-territory.cypher MATCH(p:NrProduct:NrOwnership)-[:INCLUDES]->(t:NrTrack)-[IS_PLACEMENT_OF]->(sr:NrSoundRecording:NrOwnership)-[rm:HAS_OWNERSHIP_RULE_MONETIZE]-(s:NrOwnershipService) WHERE p.upc = $input.upc AND rm.vendorId = toInteger($input.vendorId) AND s.territory = $input.territory WITH collect(rm) as existingMonetizeRules, date() as ruleDate UNWIND existingMonetizeRules as existingMonetizeRule MATCH ()-[mRuleToUpdate:HAS_OWNERSHIP_RULE_MONETIZE]->(s) WHERE mRuleToUpdate.id = existingMonetizeRule.id SET mRuleToUpdate.startDate = ruleDate, mRuleToUpdate.lastModifiedAt = datetime(), mRuleToUpdate.lastModifiedBy = "graphql-neighbouring-rights/updateOwnershipNrCarveoutRules/" + $input.identityId RETURN collect({id: mRuleToUpdate.id, type: type(mRuleToUpdate)}) AS rules;