« Morrissey Writes Lyrics? | Main | Go C3P0 »
Sunday
Jun062004

Database Modeling Genealogical Relationships

Warning...Geek post...I've sort of volunteered to help develop a contact manager application for the York County Democratic party. One of the items they would like to track is family relationships among contacts. This got me thinking of a question that I was asked in a job interview ... how to represent family relationships in a data model.

OK, you've definitely got a contacts table. And you could have a relationships lookup table (Father, Son, Brother Sister, etc.). And I guess you have a table with a contact ID, a relationship ID, and the contact ID of the related person. This would tell you, for example, how x is related to y. It would also tell you that y is related to x, but not how. You could insert two records for each (a brother record for x and a sister record for y).

I was thinking that it could also be modeled in the typical hierarchical relationship method (record, parentID), but that doesn't allow for modeling of sibling relationships.

This particular app doesn't have to be too sophisticated - it really just needs to be able to link contacts with other contacts - but I still wonder the best way to model genealogical realtionships...

By the way, I didn't get that job.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>