Web based family history software

Question Identities in gedcom file

  • sevtor
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago #1 by sevtor
Identities in gedcom file was created by sevtor
I converted my family tree to version 2.0.1. When I started to add things i found out the the raw gedcom information is strange.
All new persons, families, sources, ... get an id "X" plus a number, not Innn, Fnnn, Snnn as I had expected. All works fine and
I can import such gedcom files to webtrees 1.7.16.

Question: is this really according to the standard? Does it work to import into other software?

webtrees 2.1.18, php 8.1.27, torstendahl.se/demo/
Attachments:

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago #2 by fisharebest
Replied by fisharebest on topic Identities in gedcom file
> Question: is this really according to the standard?

Yes. The standard says that these "XREF"s can be made from any character (except "@").

> Does it work to import into other software?

Yes.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago - 4 years 2 months ago #3 by Andreas
Replied by Andreas on topic Identities in gedcom file
I noticed in V2.0.1 that all new XREFs start with an X

Please tell me the way where I can adjust the old behavior, that the XREFs stay as follows
I=Individual
F=Family
S=Source
M=Media
N=Note
R=Repository

Both MAUPILLÉ & RAUHUT families are using webtrees V2.1.18
Last edit: 4 years 2 months ago by Andreas.

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Away
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
4 years 2 months ago - 4 years 2 months ago #4 by bertkoor
Replied by bertkoor on topic Identities in gedcom file
You can try the following changes in Tree.php


Change the function getNewXref (line 516) to accept a prefix instead of declaring it as static 'X' (remove line 524) and also keep the function without parameters to call it with 'X':
Code:
/** * Generate a new XREF, unique across all family trees * * @return string */ public function getNewXref(): string { return this->getNewXref('X'); } /** * Generate a new XREF with given prefix, unique across all family trees * * @param string $prefix * * @return string */ public function getNewXref(string $prefix): string { // Lock the row, so that only one new XREF may be generated at a time. DB::table('site_setting') ->where('setting_name', '=', 'next_xref') ->lockForUpdate() ->get(); $increment = 1.0;

Then adjust the calls to that function.
  • function createFamily: $xref = $this->getNewXref('F');
  • function createIndividual: $xref = $this->getNewXref('I');
  • function createMediaObject: $xref = $this->getNewXref('M');


It's a start, other object types are created in such a manner that I don't see a quick way to let them get their own prefixes again.

And then there's the function renumberAction in AdminTreesController.php.
There you coud do something like:
Code:
foreach ($xrefs as $old_xref => $type) { switch ($type) { $new_xref = null; case Individual::RECORD_TYPE: $new_xref = $tree->getNewXref('I'); DB::table('individuals') ... case Family::RECORD_TYPE: $new_xref = $tree->getNewXref('F'); DB::table('families') ... case Source::RECORD_TYPE: $new_xref = $tree->getNewXref('S'); DB::table('sources') ... case Repository::RECORD_TYPE: $new_xref = $tree->getNewXref('R'); DB::table('other') ... case Note::RECORD_TYPE: $new_xref = $tree->getNewXref('N'); DB::table('other') case Media::RECORD_TYPE: $new_xref = $tree->getNewXref('M'); DB::table('media') ... default: $new_xref = $tree->getNewXref(); DB::table('other') ...

stamboom.BertKoor.nl runs on webtrees v1.7.13
Last edit: 4 years 2 months ago by bertkoor.

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago - 4 years 2 months ago #5 by Andreas
Replied by Andreas on topic Identities in gedcom file
Thank you for your proposition. I will have a closer look and see if I will be able to make the modifying.

Greg proposed to do so in another thread
But without understanding the reason for that Greg removed the speaking XREFs, I fear that this will create more trouble than benefit.

In addition I learned in the past that it's no a good idea to modify code of an application, because on the next release my change file will be erased.

I may prefere to live with the different behavior, but I would like to understand the reason for that the XREF must always start with a "X".

In an other thread I asked why V2.0.x will not have an user-configurable option.

Both MAUPILLÉ & RAUHUT families are using webtrees V2.1.18
Last edit: 4 years 2 months ago by Andreas.

Please Log in or Create an account to join the conversation.

  • norwegian_sardines
  • Offline
  • Platinum Member
  • Platinum Member
More
4 years 2 months ago - 4 years 2 months ago #6 by norwegian_sardines
Replied by norwegian_sardines on topic Identities in gedcom file
Greg gave an explanation HERE.

Ken
Last edit: 4 years 2 months ago by norwegian_sardines.

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago - 4 years 2 months ago #7 by Andreas
Replied by Andreas on topic Identities in gedcom file

bertkoor wrote: You can try the following changes in Tree.php
Change the function getNewXref (line 516) to accept a prefix instead of declaring it as static 'X' (remove line 524) and also keep the function without parameters to call it with 'X':


Please don't laugh, but I started coding with FORTRAN 4 and VB.
I'm not used to write php code.

Is it possible to have two functions with the same name, once with and once without parameter ?

bertkoor wrote: Then adjust the calls to that function.

  • function createFamily: $xref = $this->getNewXref('F');
  • function createIndividual: $xref = $this->getNewXref('I');
  • function createMediaObject: $xref = $this->getNewXref('M');

And how will I find all occurrences of calls to getNewXref() ?
I'm thinking also about Sources, Notes and Repositories

bertkoor wrote: It's a start, other object types are created in such a manner that I don't see a quick way to let them get their own prefixes again.
And then there's the function renumberAction in AdminTreesController.php.

This only for the case if I would like to use this functionality !!

Both MAUPILLÉ & RAUHUT families are using webtrees V2.1.18
Last edit: 4 years 2 months ago by Andreas.

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago - 4 years 2 months ago #8 by Andreas
Replied by Andreas on topic Identities in gedcom file
Thank you Ken

norwegian_sardines wrote: Greg gave an explanation HERE.


I read this and it doesn't convince me. I thought it has a real reason, like simplify coding or reduce response time on requests.

It would be better to restrict the starting letter to the letters of the alphabet except I, O and S, to prevent confusion.

When I use an ID to reuse it on another form, then I make a cut&paste and don't copy it with my pencil.
But when merging double individuals, or families I cut the IDs and paste them into the fields of the merging page.

If XREFs of individuals as well as families start both with X I will have problems with merging double records.

Both MAUPILLÉ & RAUHUT families are using webtrees V2.1.18
Last edit: 4 years 2 months ago by Andreas.

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Away
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
4 years 2 months ago - 4 years 2 months ago #9 by bertkoor
Replied by bertkoor on topic Identities in gedcom file
> I fear that this will create more trouble than benefit.

I agree, definitely. Especially since you're not supposed to see these ID's anywhere and use them sparsely in actions. Which by the way also could be an argument to keep the convention we were used to. We never talk about them, they are only copy-pasted from the url to another input field.

I'm still using v1.7, and even there are some dialogs (eg change family members - add) where the xref cannot be used to find the person you need. So I use work-arounds like first edit the name and put in a suffix "!" for me to know which one it is.


> but I would like to understand the reason for that the XREF must always start with a "X".

Technical simplification. First there was a counter for each record type for each tree. Then the separation per tree vanished, and even in v1.7 there might now be just one global counter.

So I stopped caring, it's just an xref, but it itches for the OCD part in me.

> I'm not used to write php code.

Neither am I. Last time I counted it was 14 languages (in 3 decades) and php is not one of them. I might have missed a $ here or there.


> Is it possible to have two functions with the same name, once with and once without parameter ?

I jusr googled "php function overloading" and you're right! Functions are unique by name, not by their argument count or type. So throw away my attempt, it's no good.


> If XREFs of individuals as well as families start both with X I will have problems with merging double records.

No, in case you erroneously try to merge X123 with X345 where they don't are of the same type, a merge attempt would (should) not be accepted. Also you can have F123 and X123. They are unique, not only their numerical part but including the alphabetic prefix.

stamboom.BertKoor.nl runs on webtrees v1.7.13
Last edit: 4 years 2 months ago by bertkoor.

Please Log in or Create an account to join the conversation.

More
4 years 2 months ago #10 by Andreas
Replied by Andreas on topic Identities in gedcom file
Good morning,
Thank you for trying to give an explication and be so honest.

By the way, what's your personal reason to stay with 1.7.x ?

My opinion is, never touch a running system.
But as no new features will be added in v1.7.x and even certain bugs are not elimininated, my break even reached.

Both MAUPILLÉ & RAUHUT families are using webtrees V2.1.18

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Away
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
4 years 2 months ago #11 by bertkoor
Replied by bertkoor on topic Identities in gedcom file
No particular reason, mostly cold feet.
I expected the difference between 1.7 and 2.0 to be mainly internal and technical. But visually it's rather a step, and functionally I read about some surprises.
But maybe I should just try...

stamboom.BertKoor.nl runs on webtrees v1.7.13

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
}