Hi all,
I'm having a hard time building a query with optional relationship using Neo4j 2.3.2.
My query is something like this:
MATCH
(n1:Label1)
WHERE
(n1.propertyA = {param1})
OPTIONAL MATCH
(n1)<-[r:rel1]-(n2:Label2)
WHERE
(NOT (n1)<-[r:rel1]-(n2) OR n2.propertyB = {param2})
RETURN
n1;
My intention is to return all n1 objets that don't have a relationship to n2 or if they have a relationship check for propertyB and filter by that.
What I'm getting is all the n1 even when rel1 exists and propertyB != {param2}
Anyone sees what's the issue in this query? I can't see it...
Thanks,
Matias.