From: Lars Kr.L. <gr...@lk...> - 2004-08-03 14:18:02
|
On Fri, Jul 30, 2004 at 12:23:46PM -0500, Alex Roitman wrote: > It seems to me that, if A and B have no common ancestor then we > cannot determine their relationship at all. Are you sure about this? Let us take a simple example: A and B have no known common ancestor. A is the maternal grandfather of C. B is the paternal grandfather of C. The parents of C are not married. Given A and B the relationship-calculator of GRAMPS would currently bail out with something to the effect: A and B are not related. Surely the internal data structure of GRAMPS would allow a function to examine any children of person X. By repeated calls to this function it could be determined that A and B are related through their grandchild C (and possibly through additional grandchildren). It is basically the same approach as for finding a closest common ancestor, except that the two trees that need to be traversed are not binary. I have been looking at the python code and thought more about the internal representation of the relationship path. When GRAMPS searches for a common ancestor of A and B, I can see how it is natural to represent each of those two paths with the [fmp] characters (denoting one of father, mother or parent with unknown gender). Suppose GRAMPS keeps the [fmp] characters to build the two relationship paths towards the common ancestor. Then we could use the characters [sdc] (son, daughter or child) to represent the two relationship paths towards a common descendant. I made a proposal to use a meta-character to describe the common ancestor(s). If we adopt this approach, we could use meta-characters for the common descendant(s) as well. For the common descendant(s) GRAMPS could use as meta-characters a sequence of one of S: for a son as common descendant D: for a daughter as common descendant C: for a child (with unknown gender) as common descendant So in the above example the relationship can be described by the two paths "d" and "s" with "C" as meta-character. If A and B are both grandfathers of two sons and a daughter their relationship could be described by "d", "s" and "SSD", to describe that from A the relationship goes to a daughter to her son + son + daughter back to their father to B. (I consider this relationship stronger than the one where two children of A and B are married, but without children). The translator of some language XYZ could then say: "Aah, but in my language two grandfathers who share exactly two sons and one daughter are each others <some rare relationship term> so I will put that term in rel_XYZ.py" That would be pretty neat. The next step could be the relationship that is not through a common ancestor nor through a common descendant, but though a (childless) marriage. If we introduce another meta-character to represent marriage, f.ex. "=" (a non-letter because there is no individual in this point of the path), we can represent relationships like: My grandsons wifes grandfather with "cs" and "cd" (with "=" as meta-character). The paths "pm", "pf" and "=" would mean that A's grandmother married (someone else than A's grandfather) and that B is the grandson of that husband. Next kind of relationship could be through an ancestor back to a marriage and then further back trough some other ancestors, f.ex. my grandfathers (second) wifes grandfather. That would be represented as one path consisting of [fmp] characters and one with [sdc] characters. Construction of such two paths would require the traversal of A's ancestor tree and the traversal of B's descendant tree (or vice-versa) until a marriage between two persons was found. The two paths would then match [fmp]* and [sdc]* (with "=" as meta-character). F.ex. if B is A's grandsons wifes grandson the two paths would be "cs" and "mp" (with "=" as meta-character). In case someone is still reading: Let us try to imagine a hardcore relationship calculator that simply does not want to call A and B unrelated, even though none of the above applies. Suppose the relationship cannot be described by two relationship paths separated by a meta-character(-string). One way to represent more general relationships could be with three relationship paths separated by two meta-character(-string)s. This would be required to express f.ex. B is A's cousins father-in-law. This could be generalized to N+1 relationship paths separated by N meta-character(-string)s. In large datasets the search for such relationships could require the traversal of not just one pair of ancestor/descendant-trees, but _many_ such pairs. Anyway, I cannot see anything that would keep us from implementing that one day... > > Now that I started, how about more tricky relationships > > like the following: > > A and a are sisters and > > B and b are brothers. > > > > A and B have a child C, and > > a and b have a child c. > > > > Now C and c are cousins through all 4 of their grandparents! > > > > How would we handle that? (The above "double cousinship" is actually not that rare). Once a closest ancestor is found, determining whether or not there are more equally close common ancestors requires some additional (but limited) checking that can be added at a later stage. -Lars Lundin. -- GEDCOMP: An extensive and free database for genealogists with interest in Denmark: http://www.lklundin.dk/gedcomp/ |