I have been rethinking my approach to common gedcom tags such as notes and media, and the fact that media can have notes, to rework some of my logic. There is an old premise that the simple solutions are the best and when the logic of ones code is looking overtly complicated, it is sadly time to rethink, replan and redo ones work. My recoding approach has worked well for header and submitter tags, and tomorrow, I will brace myself for the more complex nature of redoing individuals tags (and latter still, families, repository, sources, events, media etc).
I have updated the entity relationship diagram as it contains a consolidated event files.
****************************************************************** * โโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโ * * โ Individual โ โ Event โ โ Citation โ * * โโโโโโโโโโโโโโค โโโโโโโโโโโโโโค โโโโโโโโโโโโโโค * * โId (PK)โโโโฌโโ>โคId+No. (PK)โโโโโโ>โคId+No. (PK)โ * * โName โ โโโ>โคId+Tag (SK)โโโโโโ>โคIdTagEv#(SK)โ * * โSex โ โ โDate โ โSource Id โโโโโโ* * โBirth Date โ โ โPlace โ โDetails โ โ* * โDeath Date โ โ โDetails โ โApid โ โ* * โโโโโคChild Familyโ โ โType โ โRef Note Id โโโโ โ* * โโโโโคSpouseFamilyโ โ โRef Note Id โโโโโ โInlineRefId โโโโค โ* * โโ โRef Note Id โโโ(โโ โInlineNoteIdโโโโโค โMedia Id โโโ(โโ* * โโ โInlineNoteIdโโโ(โโค โMedia Id โโโ โ โโโโโโโโโโโโโโ โโโ* * โโ โMedia Id โโโโ โ โโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโ โโโ* * โโ โโโโโโโโโโโโโโ โโ โโโโโโโโโโโโโโโโโ(โโค โ Note โ โโโ* * โโ โโโโโโโโโโโโโโ โโ โโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโค โโโ* * โโ โ Family โ โโ โ Repository โ โ โโ>โคId+No. (PK)โ<โโคโโ* * โโ โโโโโโโโโโโโโโค โโ โโโโโโโโโโโโโโค โ โ โData โ โโโ* * โโ โId (PK) โโ(โโโ>โคId (PK)โ โ โ โNewline CONTโ โโโ* * โโโ>โคHusband Id โ โ โ โName โ โ โ โโโโโโโโโโโโโโ โโโ* * โโโ>โคWife Id โ โ โ โAddress โ โ โ โโโโโโโโโโโโโโ โโโ* * โโโ>โคChild Id โ โ โ โRef Note Id โโ(โโค โ Media โ โโโ* * โRef Note Id โโ(โ(โโโInlineNoteIdโโ(โโค โโโโโโโโโโโโโโค โโโ* * โInlineNoteIdโโ(โ(โโคโโโโโโโโโโโโโโ โโ(โ>โคId (PK)โ<โ(โคโ* * โMedia Id โโโดโ(โ(โโโโโโโโโโโโโโโโค โ โFile โ โโโ* * โโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโ(โโค โForm โ โโโ* * โโโโโโโโโโโโโโ โ โ โ โTitle โ โโโ* * โ Source โ โ โ โ โRef Note Id โโโโคโโ* * โโโโโโโโโโโโโโค โ โ โ โInlineNoteIdโโโโโโ* * โId (PK)โ<โโ(โโโโโโโโโโโโโโโโโ(โ(โโโโโโโโโโโโโโโโ โโ* * โ_Author โ โ โ โ โโโโโโโโโโโโโโโ โโ* * โPublisher โ โ โ โ โโ Submitter โ โโ* * โRepo Id โโโโโ โ โ โโโโโโโโโโโโโโโค โโ* * โReferenceNo.โ โ โ โโId (PK)โ โโ* * โAPID โ โ โ โโName โ โโ* * โRepo Name โ โ โ โโAddress โ โโ* * โCall Number โ โ โ โโMedia Id โโโโโโ* * โRef Note Id โโโโโโโโโโโโโโโโโโโโโโ(โโค โโโโโโโโโโโโโโโ โ* * โInlineNoteIdโโโโโโโโโโโโโโโโโโโโโโ(โโ โโโโโโโโโโโโโโโโโโโโ* * โMedia Id โโโโโโโโโโโโโโโโโโโโโโโ * * โโโโโโโโโโโโโโ Note: Gedcom and Header omitted.* ******************************************************************
Update; I have changed the processing to include using a stack of gedcom tags. When a higher-level gedcom tag is encountered, the parent (or prior) tag is pushed onto the stack. The child tags can be processed whilst referencing the parent on the stack and when a lower-level tag is encountered later on, the top value on the stack is popped, so the prior parent is apparent for use.
1 SOUR FTM 2 VERS 24.0.0.1230 2 NAME Family Tree Maker for Windows 2 CORP The Software MacKiev Company 3 ADDR 30 Union Wharf, 4 CONT Boston, MA 02109, 4 CONT USA. 3 CITY Boston 3 STAE MA 3 POST 02109 3 CTRY USA 2 PHON (617) 227-6681 2 EMAIL support@familytreemaker.com 2 FAX (617) 227-6680 2 WWW www.familytreemaker.com 1 DEST FTM 1 DATE 28 Sep 2019 1 CHAR UTF-8 1 FILE FTM2019.ged 1 SUBM @SUBM@ 1 GEDC 2 VERS 5.5.1 2 FORM LINEAGE-LINKED
For example, when the gedcom line of ‘3 ADDR 30 Union Wharf,’ is processed, there was a change (or increase) in gedcom level, so the ‘CORP’ tag is pushed onto the stack. When the ‘CONT’ tags are processed, again there was a change (oe increase) in gedcom levels, so the parent ‘ADDR’ tag was also pushed to the stack. When the ‘CITY’ tag is processed, this resulted in a lower-leveled tag, so the top value of ‘ADDR’ is pushed from the stack, so the prior parent of ‘CORP’ is top of stack for the processing of ‘CITY’ through ‘CTRY’.
The use of the stack makes the logic of differing levels are processing of tags appropriate to each level more viable and straight-forward.