lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




2016-06-26 9:32 GMT+02:00 Dirk Laurie <dirk.laurie@gmail.com>:
A genealogical graph has two kinds of node: 'person' and 'family'.
In graph theoretical lingo, it is a simple directed two-coloured graph.
That is to say, persons connect only to families, families only to
persons, in both cases there is only one connection if any, and that
connection is one-way.

Inspired by the format that LHF's 'lxml' returns, I plan to represent
them as Lua arrays as follows:

Persons: negative numbers key families in which the person is
a child, positive numbers key families in which the person is
a parent.

Families: negative numbers key parents in the family, positive
numbers key children.

In both cases, [0] keys a unique identification string, and
table-valued keys are used to invert the mapping given by
the numerical keys.

An index table with pairs '[node[0]]=node' can be constructed.

Up to this point, 'child' and 'parent' are abstract terms.

String-valued keys and zero remain available to be used as
needed in the application. For example, node[node[0]] might
be a table containing extra information not important enough
to justify reserving keys for it.

I have not been able to find any useful reference on the Internet
to the use of Lua in Genealogy (the 'real' genealogy).


Just for input, I remember having read this stack overflow question and its answers some time ago regarding genealogic graphs:

http://stackoverflow.com/questions/6163683/cycles-in-family-tree-software

Just let me quote from the question to illustrate the problem: "I am the developer of some family tree software (written in C++ and Qt). I had no problems until one of my customers mailed me a bug report. The problem is that the customer has two children with their own daughter, and, as a result, he can't use my software because of errors."

I am not sure if this would be a problem with your data description format. Though cycles in graphs can be a bit nasty...
Anyhow, I found an approach interesting that one of the answer givers described: "We have modeled our family tree to what happens in the real world: Events (for example, births, weddings, engagement, unions, deaths, adoptions, etc.). We do not put any restrictions on these, except for logically impossible ones (for example, one can't be one's own parent, relations need two individuals, etc...)"

Thought you might find this interesting.

Cheers, 
Eike