Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help using Gedcom.pm

4 views
Skip to first unread message

Jutta Wrage

unread,
May 4, 2017, 11:45:03 PM5/4/17
to perl-...@perl.org
Hi!

I hope this it the right place to get some help using the module.

I have written a little perl program to extract all persons from an exported Gedcom file to a tab delimited list. That works well so far.

My problem now is how to get out the marriage names for persons who are marriaged.
Is it possible to extract them from the gedcom file using gedcom.pm?

Jutta

--
http://www.witch.westfalen.de

Nigel Horne

unread,
May 5, 2017, 8:00:02 AM5/5/17
to perl-...@perl.org
On 5/4/17 11:32 PM, Jutta Wrage wrote:
> Hi!
>
> I hope this it the right place to get some help using the module.
>
> I have written a little perl program to extract all persons from an exported Gedcom file to a tab delimited list. That works well so far.
>
> My problem now is how to get out the marriage names for persons who are marriaged.
> Is it possible to extract them from the gedcom file using gedcom.pm?

This snippet is from Gedcom::Individual::as_string in gedcal and
ged2site. I hope it helps to give you an idea on how to do it.

my $surname;
my $sex = get_value({ person => $self, value => 'sex' });
if(defined($sex) && ($sex eq 'F')) {
if(my $husband = $self->husband()) {
$surname = $husband->surname();
$has_maiden_name = 1;
} elsif(my $spouse = $self->spouse()) {
if($opts{'f'}) {
die 'married, but no husband relationship';
}
if($opts{'w'}) {
red_warning({ person => $self, warning => 'married,
but no husband relationship' });
}
$surname = $spouse->surname();
$has_maiden_name = 1;
}
}
>
> Jutta
>
Regards,

-Nigel

--
Nigel Horne
Conductor: Rockville Brass Band, Washington Metropolitan GSO
@nigelhorne | fb/nigel.horne | bandsman.co.uk | concert-bands.co.uk | www.nigelhorne.com

Unless it's for my eyes only, please use "reply all"

Jutta Wrage

unread,
May 5, 2017, 11:15:03 AM5/5/17
to perl-...@perl.org
Am 05.05.2017 um 13:47 schrieb Nigel Horne:

> my $surname;
> my $sex = get_value({ person => $self, value => 'sex' });
> if(defined($sex) && ($sex eq 'F')) {
> if(my $husband = $self->husband()) {
> $surname = $husband->surname();
> $has_maiden_name = 1;
> } elsif(my $spouse = $self->spouse()) {
> if($opts{'f'}) {
> die 'married, but no husband relationship';
> }
> if($opts{'w'}) {
> red_warning({ person => $self, warning => 'married, but no husband relationship' });
> }
> $surname = $spouse->surname();
> $has_maiden_name = 1;
> }
> }

This does not work for me. Too many errors.

I have this code snippet included for testing purposes now:

my $surname;
if(my $husband = $i->husband()) {
$surname = $husband->get_value(["name", 1], "surn");
} else {
$surname = "";
}

I get a surname now for married people there. But if there are more than one partners it is always the very first one taken there, it seems, even if a loose partnership without marriage.

For example Anna Fehrs has three partners
1. Schadendorf - father of the first child only - no marriage
2. Hüttmann - he died and left additional children to her - marriage
3. Thomsen - some more children - marriage

As "surname" I get Schadendorf, which never has been her name.

And even if I want to add a list of names there for all partners, I do not hnow how to get all ob them.
What bores me: she has a name, wen born, and she has another name to search for death records.
My list is used as a working table to see which records from church books and "Standesamt" I still need to get.

If I cannot get a list of all of her surnames (Name fields) from the gedcom export: Maybe I can get a list of her husbands using get_record or something like that?

If that matters: Gedcom file is VERS 5.5.1.


Regards,

Jutta


--
http://www.witch.westfalen.de

Ron Savage

unread,
May 6, 2017, 9:15:02 PM5/6/17
to perl-...@perl.org
Hi Jutta

See below.

On 06/05/17 00:57, Jutta Wrage wrote:
> Am 05.05.2017 um 13:47 schrieb Nigel Horne:
>
>> my $surname;
>> my $sex = get_value({ person => $self, value => 'sex' });
>> if(defined($sex) && ($sex eq 'F')) {
>> if(my $husband = $self->husband()) {
>> $surname = $husband->surname();
>> $has_maiden_name = 1;
>> } elsif(my $spouse = $self->spouse()) {
>> if($opts{'f'}) {
>> die 'married, but no husband relationship';
>> }
>> if($opts{'w'}) {
>> red_warning({ person => $self, warning => 'married, but no husband relationship' });
>> }
>> $surname = $spouse->surname();
>> $has_maiden_name = 1;
>> }
>> }
>
> This does not work for me. Too many errors.
>
> I have this code snippet included for testing purposes now:
>
> my $surname;
> if(my $husband = $i->husband()) {
> $surname = $husband->get_value(["name", 1], "surn");
> } else {
> $surname = "";
> }
>
> I get a surname now for married people there. But if there are more than one partners it is always the very first one taken there, it seems, even if a loose partnership without marriage.

I suspect the reason you get 1 is that you have my $husband in scalar
context. Try storing the return value in an array and see if you get the
others.

> For example Anna Fehrs has three partners
> 1. Schadendorf - father of the first child only - no marriage
> 2. Hüttmann - he died and left additional children to her - marriage
> 3. Thomsen - some more children - marriage
>
> As "surname" I get Schadendorf, which never has been her name.
>
> And even if I want to add a list of names there for all partners, I do not hnow how to get all ob them.
> What bores me: she has a name, wen born, and she has another name to search for death records.
> My list is used as a working table to see which records from church books and "Standesamt" I still need to get.
>
> If I cannot get a list of all of her surnames (Name fields) from the gedcom export: Maybe I can get a list of her husbands using get_record or something like that?
>
> If that matters: Gedcom file is VERS 5.5.1.
>
>
> Regards,
>
> Jutta
>
>

--
Ron Savage - savage.net.au

Jutta Wrage

unread,
Jun 8, 2017, 4:00:02 PM6/8/17
to perl-...@perl.org
Hi!

Am 07.05.2017 um 02:56 schrieb Ron Savage:

>>
>> I have this code snippet included for testing purposes now:
>>
>> my $surname;
>> if(my $husband = $i->husband()) {
>> $surname = $husband->get_value(["name", 1], "surn");
>> } else {
>> $surname = "";
>> }
>>
>> I get a surname now for married people there. But if there are more than one partners it is always the very first one taken there, it seems, even if a loose partnership without marriage.
>
> I suspect the reason you get 1 is that you have my $husband in scalar context. Try storing the return value in an array and see if you get the others.

I still do not get anything useful working.

For now I am near to parse the gedcom file myself to get what I want for my table.

What I really want is:

(a) either get all surnames of a person
(b) or get all parnter names
(c) or get all names of married partners (wich is the same als the Family names in (a) - if my entries have been made correctly

Here an example of an individual:

0 @I48949664@ INDI
1 NAME Anna Margareta/Hüttmann/
2 GIVN Anna Margareta
2 SURN Hüttmann
1 SEX F
1 NAME Anna Margaretha/Hüttmann/
2 TYPE 6
2 GIVN Anna Margaretha
2 SURN Hüttmann
1 NAME /Wrage/
2 TYPE 3
2 SURN Wrage
1 NAME /Kruse/
2 TYPE 3
2 SURN Kruse

She has been married first to Wrage and got that Name until second marriage with Kruse.

Her name when she died was in short:

Anna Margareta Kruse, geb. (born) Hüttmann

long:

Anna Margareta Kruse, geb. Hüttmann, gesch. (divorced) Wrage.

Whatever I do can be a workaround only:

- Sometimes I may forget to add the new mariage name instead of adding it.
- MacStammbaum (MacFamilytree now I guess) produces a Gedcom file where each Family has a husband. It does not have families with a man just being father of a so called child.

In the table I will mark things like "have birth record church/administration" "have marriage record 1 2 3" and so on.

Maybe I will move the marriage record overview to a second tage just with all families but for now I need the marriage names added anyway.
signature.asc

Ron Savage

unread,
Jun 12, 2017, 4:00:02 AM6/12/17
to perl-...@perl.org
Hi Jutta

I patched your ged data to make it validate, and wrote a little script
to get you going. See:

o https://savage.net.au/misc/jutta.ged

o https://savage.net.au/misc/jutta.log

o https://savage.net.au/misc/jutta.sample (Rename to jutta.pl)

My web hosting company will not let me upload files with names like:

o jutta.pl

o jutta.pl.txt

Jutta Wrage

unread,
Jun 12, 2017, 9:45:02 AM6/12/17
to perl-...@perl.org

Am 12.06.2017 um 09:51 schrieb Ron Savage:

> I patched your ged data to make it validate, and wrote a little script to get you going. See:
>
> o https://savage.net.au/misc/jutta.ged
>
> o https://savage.net.au/misc/jutta.log
>
> o https://savage.net.au/misc/jutta.sample (Rename to jutta.pl)
>
> My web hosting company will not let me upload files with names like:


Thanks for you help!

Just before getting you mail I have found a solution yesterday after creating a family table with information whether married or not.

My code to get the names in the individual table now is:

my @families = $i->fams;
my $sex = uc $i->sex;
if ($sex eq "F") {
my $firsthusband = 1;
for my $f (@families) {
if (my $marriage = $f->marr()) {
if(my $husband = $f->husband()) {
my $husbname = $husband->get_value(["name", 1], "surn");
if ($firsthusband) {
$surname .= "$husbname";
$firsthusband = 0;
} else {
$surname .= ", $husbname";
}
}
}
}
}

This way I get only the new surnames for women if they are married.

And that matches to the information in the names section I have had already in my data and which I did not know, how to access using the gedcom modules. The only thing to do was adding marriage records without data everywhere, where I know they where married but had no data for the marriage.

My sources hav names like "HRE K NAME" for marriage entries in church books and so I can analyze automatically, where I have the original data and not only second level information already for birth, marriage and death.

Once one gets an idea how to use the modules, they are really great.

Ron Savage

unread,
Jun 12, 2017, 7:00:02 PM6/12/17
to perl-...@perl.org
Hi Jutta

OK. Glad your problem is solved.
Ron Savage - savage.net.au
0 new messages