"""Queries for label participant nodes.""" merge_lp_nodes = """ MATCH (masterNode:LabelParticipant {uuid: $master_node_uuid}) MATCH (childNode:LabelParticipant) WHERE childNode.uuid IN $child_node_uuids OPTIONAL MATCH (childNode)-[:CREATED_FROM]->(o) CALL apoc.util.validate( o IS NOT NULL, "A child node is still related in Art Relations: %s id %s", [labels(o)[0], o.id] ) OPTIONAL MATCH (childNode)-[gpRel]-(:GlobalParticipant) DELETE gpRel WITH DISTINCT masterNode, childNode OPTIONAL MATCH (childNode)-[labelRel]-(:Label) DELETE labelRel WITH masterNode, COLLECT(DISTINCT childNode) AS childNodes CALL apoc.refactor.mergeNodes( [masterNode] + childNodes, { properties: "discard", mergeRels: false } ) YIELD node RETURN 0 """