# Family tree relationship mapping

**URL:** <https://community.neo4j.com/t/family-tree-relationship-mapping/4302>\
**Category:** Cypher\
**Created:** [January 10, 2019, 12:51pm UTC](https://community.neo4j.com/t/family-tree-relationship-mapping/4302 "2019-01-10T12:51:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mail.adam.braun](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/mail.adam.braun/32/2799_2.png) [@mail.adam.braun](https://community.neo4j.com/u/mail.adam.braun)\
**Post date:** [January 10, 2019, 12:51pm UTC](https://community.neo4j.com/t/family-tree-relationship-mapping/4302/1 "2019-01-10T12:51:01Z")

</div>

I'm wondering whether someone has already mapped family tree relationships?

E.g.

```auto
create 
  (Joe:Male { name: 'Joe' }),
  (Jane:Female { name: 'Jane' }),
  (Joe)-[:PARENT]->(Jane),
  (Dave:Male { name: 'Dave' }),
  (Jane)-[:Parent]->(Dave)

```

My goal is to have something like `dave's grandfather` to be parsed as `match (:Male {name: 'Dave' })<-[:PARENT]-(parent)<-[:PARENT]-(grandfather:Male) return grandfather`

---

<div class="post-metadata">

**Author:** ![liebig](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/liebig/32/2964_2.png) [@liebig](https://community.neo4j.com/u/liebig)\
**Post date:** [January 22, 2019, 3:09pm UTC](https://community.neo4j.com/t/family-tree-relationship-mapping/4302/2 "2019-01-22T15:09:57Z")

</div>

If you want to label the grandfathers of Dave you could simply tag them:

```auto
match (:Male {name: 'Dave' })<-[:PARENT]-(parent)<-[:PARENT]-(grandfather:Male)
set grandfather:GrandfatherOfDave

```

Be careful, however, if you have more than one of this procedural inference rules. If they depend on each other (think of a :SON relationship that implies a reverse :PARENT relationship) you have to take care of their execution order, check of termination, etc.

What you describe might require the RDFS/OWL model and reasoning:

> **[GitHub - neo4j-labs/neosemantics: Graph+Semantics: Import/Export RDF from...](https://github.com/neo4j-labs/neosemantics)**
>
> Graph+Semantics: Import/Export RDF from Neo4j. SHACL Validation, Model mapping and more.... If you like it, please ★ ⇧ - GitHub - neo4j-labs/neosemantics: Graph+Semantics: Import/Export RDF from Ne...

> **[Neo4j: A Reasonable RDF Graph Database & Reasoning Engine \[Community Post\]...](https://neo4j.com/blog/neo4j-rdf-graph-database-reasoning-engine/)**
>
> Discover how Neo4j and the Cypher graph query language perform together as a graph reasoning engine and how GraphScale makes it all possible.

---

<div class="post-metadata">

**Author:** ![genealogy](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/genealogy/32/19823_2.png) [@genealogy](https://community.neo4j.com/u/genealogy)\
**Post date:** [September 16, 2021, 6:29am UTC](https://community.neo4j.com/t/family-tree-relationship-mapping/4302/3 "2021-09-16T06:29:29Z")

</div>

Check out the project I'm working on at [http://gfg.md/blogpost/7](http://gfg.md/blogpost/7) and [https://github.com/waigitdas/Neo4j-Genealogy-PlugIns](https://github.com/waigitdas/Neo4j-Genealogy-PlugIns). Collaborators welcome!
