I'm having a bit of difficulty "getting" how to model a model's relationships to more of its own kind. So :
- Person (child) has 1 , father
- A Father who is a Person has many children
- A person has many siblings
- A person has one Godfather , and a Godfather only has one god child
So if I were NOT to think ORM/ DataMapper , I would assume the following:
- a person would have a father reference i.e. father id , so to determine one's father one would query Person table where id = my father id
- To know one's children one would query person table where father_id = my id
- So for father/child , child/father, I see no need to create a secondary table i.e. should be able to rely just on Person table with the inclusion of the father_id column
- No idea how to represent that in DM
____________________________________________________________________________________________________________
- A person has 1 or more siblings
- I would need A Siblings table where my id would be associated to another id i.e. my sibling, if I had 4 siblings there would be 4 records etc
- This looks like the Friendship example on the DM doc page
_________________________________________________________________________________________________________________
- A person only has one Godfather , and a person only has one god child
- Here I could keep in the Person table reference to my godfather and reference to my godchild by maintaining a god_father_id, and god_child_id
- So like the above case i.e. 1:n , n:1, no need for an additional table, querying would be as straightforward
- No idea how to represent this in DM
So I believe I have some basic misunderstanding of how this is meant to work with DM so kindly help me clear my confusion.
Much appreciated,
-Charles