age icon indicating copy to clipboard operation
age copied to clipboard

Mandatory Match

Open JoshInnis opened this issue 1 year ago • 6 comments

The MANDATORY MATCH clause, a variant of MATCH, forces a match in cases where there is an expectation of matching at least one node complying with a given pattern. If no match is found, the query will fail.

Introduction MANDATORY MATCH matches patterns against the graph database, just like MATCH does. The difference is that if no matches are found, the query will fail.

When writing applications using Cypher, many queries will start off by looking up multiple individual nodes based on an unique id with the implied expectation of matching exactly one node. When that expectation is not fulfilled (either due to sending a wrong id or the node having been deleted) it becomes important to identify which lookup failed. Achieving this currently is not well supported by Cypher. A frequent use case in many applications is one in which there is an expectation that a particular node, identified by some unique id, exists in the graph. This node is usually used as a starting point, from which traversals are undertaken to retrieve related information.

JoshInnis avatar Sep 07 '22 01:09 JoshInnis

Add the Keyword Mandatory before Match

JoshInnis avatar Sep 07 '22 01:09 JoshInnis

Note: needs to be rebased and formatted

JoshInnis avatar Sep 07 '22 01:09 JoshInnis

@JoshInnis any progess on this?

Dzordzu avatar Sep 28 '22 16:09 Dzordzu