| 1 |
/* |
| 2 |
* @progname interestset.li |
| 3 |
* @version 1.0 |
| 4 |
* @author Vincent Broman |
| 5 |
* @category |
| 6 |
* @output indiset function value |
| 7 |
* @description Extracts subset of the database which are close to direct ancestors |
| 8 |
*/ |
| 9 |
|
| 10 |
|
| 11 |
/* |
| 12 |
* Return the set of people who are wide-sense ancestors |
| 13 |
* of the given individual, plus the children of these wide-sense ancestors, |
| 14 |
* where a wide-sense ancestor is either the given individual himself/herself, |
| 15 |
* or a parent or step-parent of a wide-sense ancestor. |
| 16 |
*/ |
| 17 |
func interestingforebearsof( indi) { |
| 18 |
indiset( res) |
| 19 |
addtoset( res, indi, key( indi)) |
| 20 |
|
| 21 |
set( pf, parents( indi)) |
| 22 |
if( not( pf)) { return( res) } |
| 23 |
|
| 24 |
if( h, husband( pf)) { |
| 25 |
set( res, union( res, interestingforebearsof( h))) |
| 26 |
families( h, f, sp, ctf) { |
| 27 |
if( sp) { |
| 28 |
set( res, union( res, interestingforebearsof( sp))) |
| 29 |
} |
| 30 |
children( f, ch, ctc) { |
| 31 |
addtoset( res, ch, key( ch)) |
| 32 |
} |
| 33 |
} |
| 34 |
set( hk, key( h)) |
| 35 |
} else { |
| 36 |
set( hk, "") |
| 37 |
} |
| 38 |
if( w, wife( pf)) { |
| 39 |
families( w, f, sp, cth) { |
| 40 |
/* add only husbands not the father */ |
| 41 |
if( and( sp, nestr( hk, key( sp)))) { |
| 42 |
set( res, union( res, interestingforebearsof( sp))) |
| 43 |
} else { |
| 44 |
children( f, ch, ctcc) { |
| 45 |
addtoset( res, ch, key( ch)) |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
return( res) |
| 51 |
} |