I'm new to neo4j
. So I was making my family tree on neo4j and have a 'Person' node which has properties related to a person such as a name, date of birth, place of birth, etc. It also has an array property called medical history which will have an array of diseases.
Now I want to check if any disease has been passed on to a person from his family. So I have a query,
MATCH p=(k:Person{name :"kristy frank"})-[r:FATHER_OF | MOTHER_OF *1..7 ]-(l:Person)
where SINGLE(x IN l.diseases WHERE x = "diabetes")
RETURN k,r,l
This returns all the nodes in my family that have diabetes. But there's a probability that one or two nodes in between may not have diabetes. So I want the query to be generic to search along the family tree and find the nodes that could have diabetes as a property even if 2-3 nodes in between are skipped.