Re: Relationship(s) for human family structure

From: Neo <>
Date: Fri, 17 Aug 2007 17:50:28 -0000
Message-ID: <>

> I have a database with individuals in it, and I'd like to store their
> kin relationships also.
> A quick, clumsy way of doing it would be to have three columns:  two
> for individuals, and the third expressing their relationship (e.g. 'a
> is sibling of b', 'a is parent of b', etc).
> But that's clumsy and has redundancies.
> Does anyone know of a clean, efficient way to store this information?
> (I assume it would involve modelling a tree or graph.)

Below is an example script to do the above with dbd, a lightweight, memory-resident db which stores data as a network of nodes where each node is equivalent to an AND gate. It removes redundancies automatically.

(new 'john 'person)
(new 'mary 'person)
(new 'bob 'person)

(new 'wife 'relationship)
(new 'husband 'relationship)
(new 'brother 'relationship)
(new 'sister 'relationship)

(set john wife mary)
(set mary husband john)

(set mary brother bob)
(set bob sister mary)

(; Get john's wife's brother)
(; Following expression gets bob)
(get (get john wife *) brother *)

For related example, see Received on Fri Aug 17 2007 - 19:50:28 CEST

Original text of this message