I have the following params in my Neo4J:
{
"lists": [
{
"from": "someone",
"to": "somebody"
}
]
}
And the following query:
MATCH (c:Concept{name:'infranodus'}) WITH c, $lists AS list
UNWIND CASE WHEN list = [{}] THEN [null] ELSE list END AS l
WITH l
MATCH (cp1:Concept{name:l.from})
WITH cp1
MATCH (cp2:Concept{name:'somebody'})
RETURN cp1,cp2;
The query above will work.
However, if I replace l.from
with a non-existent parameter, e.g. l.about
, then — as the match doesn't happen —?the second cp2
match doesn't fire.
How can I change this behavior and continue executing this query even if cp1
is not found? Maybe there's a way to pass on a dummy variable as a result?
MATCH (c:Concept{name:'infranodus'}) WITH c, $lists AS list
UNWIND CASE WHEN list = [{}] THEN [null] ELSE list END AS l
WITH l
MATCH (cp1:Concept{name:l.about})
WITH cp1
MATCH (cp2:Concept{name:'somebody'})
RETURN cp1,cp2;
question from:
https://stackoverflow.com/questions/65600229/how-to-continue-executing-a-neo4j-cypher-request-after-match-is-not-matched 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…