Hello team.
I'm using Amazon Neptune with openCypher. Testing queries in Jupyter Notebooks before they're implemented in my app to call an AWS Lambda for submitting queries to the Neptune DB.
I am writing queries but ran into a principal issue: how can I conditionally run or skip certain code blocks in the query, all the way through the final RETURN statement?
The intuitive solution would be using WHERE before a code block, however, when the where clause is false - the query flow terminates and no subsequent code blocks are processed.
Consider the following pseudo-structure, assuming some $params are passed to the query:
...
WITH a, b, c WHERE $code=1 OR $code=2
...do something
WITH a, b, c WHERE $code=1 OR $code=3
...do something else
With a
RETURN a
Or the following structure:
...
WITH a, b, c WHERE $unlinkFirst=true
...detach delete some nodes
WITH a, b, c
...create a new node
RETURN something
Can you please advise, what is the proper way to achieve this in openCypher?
Thanks!