Ok,in super bad taste to reply to my own posts but I would like to add that I checked out the dm-is-tree and that works perfectly for my needs i.e. to model father child/sibling relationships, I'm still having issues with the god_father relation i.e. a 1:1 self referential thing.
thanks On Wednesday, June 19, 2013 1:19:24 PM UTC-4, Charles Monteiro wrote: > > I'm having a bit of difficulty "getting" how to model a model's > relationships to more of its own kind. So : > > > 1. Person (child) has 1 , father > 2. A Father who is a Person has many children > 3. A person has many siblings > 4. 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: > > *1:n , n:1* > > > > 1. 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 > 2. To know one's children one would query person table where father_id > = my id > 3. 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 > 4. No idea how to represent that in DM > > > ____________________________________________________________________________________________________________ > > *n:n* > > > > 1. A person has 1 or more siblings > 2. 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 > 3. This looks like the Friendship example on the DM doc page > > > _________________________________________________________________________________________________________________ > > *1:1 * > > > > 1. A person only has one Godfather , and a person only has one god > child > 2. 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 > 3. So like the above case i.e. *1:n , n:1, *no need for an additional > table, querying would be as straightforward > 4. 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 > > > -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/datamapper. For more options, visit https://groups.google.com/groups/opt_out.
