Hi, I'm working on a query to find probable siblings of a person in a family tree.
MATCH (p: Person) WHERE id(p) = 892
OPTIONAL MATCH (p)-[:IS_CHILD_OF]->()<-[:IS_CHILD_OF]-(prop)
OPTIONAL MATCH (p)-[:IS_SIBLING_OF]-(actualSibling)-[:IS_SIBLING_OF*1..4]-(prop2)
RETURN DISTINCT collect(prop) + collect(prop2)
For this database state:
The query above executed for Harry returns William two times. How so? I think I used DISTINCT to make it return unique nodes. It seems that "prop" returns William twice, but if I had William in prop2, I would also want it to figure only once.
Could you explain why DISTINCT does not work and how could I return only unique nodes from this query?