Hello everyone,
I'm working on a website for a kennel, most of it will be done of nodes with infos about every dog (description, awards, some photos...), its pedigree (ancestors) and its progeny (descendants).
The owner asked me if I could create some kind of relationship between nodes related in a ancestor-descendant way. I though that book nodes will do it, if just each node could have not one but two parents (dad and mom!), any idea how I could get something similar?

Maybe modifying the book module? I just started learning PHP, so in this case I need some suggestion where to begin and some encouragement...

thanks in advance
gerlos

Comments

dman’s picture

Book is not designed for that. It would hurt.
nodereference within CCK may be able to help, however.
Or maybe you want to go the whole way and try running the entries like an actual family tree.
Maybe not. Your own custom content type with nodereference is probably a good start.

marcvangend’s picture

In fact, the book module does not store a parent-child relationship between nodes; it defines parent-child relationships between menu-items and makes that available on the node form. That works perfectly for books, but it isn't what you need here.
Try the CCK module and create a 'dog' content type with two node reference fields called 'mom' and 'dad' or something. You can even configure those node reference fields so that the mom- and dad-fields can only reference female and male dogs respectively.
In data models you should always avoid duplicate data, so i think it's not a good idea to store both parents and children in one dog node. The child->parent relation is already stored in the child's node, so you shouldn't duplicate that information by storing the parent->child relation in the parent's node.

t.lan’s picture

Hi, that's what I also found out. And it works well even with Lookup during Editing. But now I'm starting with the views... Is there a tip how to make it looking like a pedigree?

So I have one person/animal on the left and want to show in a table construct (or what ever suits) mother/father, grandmothers/grandfathers, grand-grandmothers/grand-grandfathesr etc. Approx. 63 person/animals will be in the resulting construct showing 6 generations.

I can think of it using iterarative method calls. But how to solve it using Views (or something else that helps?)

Kind Regards,
Thomas

marcvangend’s picture

I just read about this module: http://drupal.org/project/noderelationships. Might be interesting for solving this kind of issues.

t.lan’s picture

So I looked for a long time at the Views. And I think I really need a tip, how to get this done.

I would like to display an Ahnentafel/Pedigree (see: http://de.wikipedia.org/wiki/Ahnentafel) where one node item (Person/Animal) is the starting point and its ancesters will be displayed over generations.

For the moment each node has a CCK-relational field "mother" and "father" pointing to another node in the same content type (self referencing). It also could be arranged with one multi-field "parents" containing two references to the same content type.

Maybe there is (beside the views) a better way to recursively call a rendering template. But there I have even less a clue how to do it.

Thomas

kbellcpa’s picture

Hi Thomas,
Did you ever figure out how to do this?