Post by Uncle Buddy on May 4, 2022 0:13:14 GMT -8
Now that I'm getting data into the Treebard database directly from a GEDCOM file, it's time to take a closer look at the table schemas involved. This part of the database (see thread title) as it exists today was created a long time ago and I didn't really know what I was trying to do at the time. Here are my notes as I make plans to clean these tables up and create needed tables that are missing.
Terminology:
1:m, one-to-many relationship; a foreign key can go in the many side more than once
m:m, many-to-many relationship; two foreign key columns, either side can repeat
1:1, one-to-one relationship; best to put both columns in the same table
finding in the code: =conclusion in the GUI
claim in the code: =assertion in the GUI
conclusion: What the user decides about an event based on 0 or more assertions.
assertion: What citation(s) say about an event.
events table: should be called conclusions table
attribute: a type of event that is undated, dated with a span date, optionally dated, complete without a date, and/or better not dated at all. EG: hair color: gray. Unless it turned gray prematurely, who cares that it turned gray?
Create the following tables or correct existing tables:
1. Sources and citations: 1:m `source_id` is FK in `citation` table OK
2. Repositories and sources: m:m make junction table `sources_reposits`
3. Findings and claims: 1:m `finding` is FK in `claim` table
Why isn't this a many-many relationship?
claim: Bob was born in 1888 in the Sahara Desert. > 1900 census
claim: Bob was born in 1898 in Africa. > biography
finding: Bob was born btwn 1888-1898 in Sahara Desert, Africa > 2 claims
If m:m, then you could have 2 conclusions for the same event. This is no longer a conclusion and defeats the purpose of separating assertions from conclusions. So it looks like death and birth are not the only events which can't/shouldn't be repeated in a person's events table. Unlike death and birth, I don't think there's a way to enforce this, because two residence events could be either two different events or two versions of the same event if the user doesn't respect the notion of making only one conclusion per event. However, enforcing death and birth restriction of "one each" is easy because one person is biologically incapable of being born twice or dying twice, so there's no ambiguity and it can be enforced. Anyway, Treebard doesn't intend to become enforcementware. But discouraging the same event from appearing multiple times in the same events table is one of Treebard's reasons for existing.
4. Citations and claims: m:m make junction table `claims_citations`
I read the other day, I think it was on the FHISO website, that modeling assertions in genieware is an abstract prospect. True, if an assertion is "Bob was born on the back of a camel somewhere in the middle of the Sahara Desert in about 1897 or so while his parents were racing from one oasis to another, blah blah blah" then that is not genealogy, it's a note. But in Treebard the conclusion and the assertion can be recorded pretty much the same, with each column containing a single part of the assertion made by a source. Is it double the work? Well, if there are fifteen different assertions about a single event, it's considerably more than double the work. But Treebard is not slanted toward either evidence- or conclusion-based functionality. The user who wants to make split decisions and record everything as a conclusion can do so. The persnickety genealogist who cares about the details and the sources will finally have a place to store his data properly instead of stuffing all the good stuff into long notes. But when notes are still needed, Treebard does it right, by making it easy to link any note to any number of other elements in the tree.
I have some work to do on the old database tables before I'll be able to store GEDCOM-sourced citations in a Treebard file. This site was helpful in gathering my thoughts about the table relationships as well as confirming my suspicions that the right way to communicate between databases is with a database.
Terminology:
1:m, one-to-many relationship; a foreign key can go in the many side more than once
m:m, many-to-many relationship; two foreign key columns, either side can repeat
1:1, one-to-one relationship; best to put both columns in the same table
finding in the code: =conclusion in the GUI
claim in the code: =assertion in the GUI
conclusion: What the user decides about an event based on 0 or more assertions.
assertion: What citation(s) say about an event.
events table: should be called conclusions table
attribute: a type of event that is undated, dated with a span date, optionally dated, complete without a date, and/or better not dated at all. EG: hair color: gray. Unless it turned gray prematurely, who cares that it turned gray?
Create the following tables or correct existing tables:
1. Sources and citations: 1:m `source_id` is FK in `citation` table OK
2. Repositories and sources: m:m make junction table `sources_reposits`
3. Findings and claims: 1:m `finding` is FK in `claim` table
Why isn't this a many-many relationship?
claim: Bob was born in 1888 in the Sahara Desert. > 1900 census
claim: Bob was born in 1898 in Africa. > biography
finding: Bob was born btwn 1888-1898 in Sahara Desert, Africa > 2 claims
If m:m, then you could have 2 conclusions for the same event. This is no longer a conclusion and defeats the purpose of separating assertions from conclusions. So it looks like death and birth are not the only events which can't/shouldn't be repeated in a person's events table. Unlike death and birth, I don't think there's a way to enforce this, because two residence events could be either two different events or two versions of the same event if the user doesn't respect the notion of making only one conclusion per event. However, enforcing death and birth restriction of "one each" is easy because one person is biologically incapable of being born twice or dying twice, so there's no ambiguity and it can be enforced. Anyway, Treebard doesn't intend to become enforcementware. But discouraging the same event from appearing multiple times in the same events table is one of Treebard's reasons for existing.
4. Citations and claims: m:m make junction table `claims_citations`
I read the other day, I think it was on the FHISO website, that modeling assertions in genieware is an abstract prospect. True, if an assertion is "Bob was born on the back of a camel somewhere in the middle of the Sahara Desert in about 1897 or so while his parents were racing from one oasis to another, blah blah blah" then that is not genealogy, it's a note. But in Treebard the conclusion and the assertion can be recorded pretty much the same, with each column containing a single part of the assertion made by a source. Is it double the work? Well, if there are fifteen different assertions about a single event, it's considerably more than double the work. But Treebard is not slanted toward either evidence- or conclusion-based functionality. The user who wants to make split decisions and record everything as a conclusion can do so. The persnickety genealogist who cares about the details and the sources will finally have a place to store his data properly instead of stuffing all the good stuff into long notes. But when notes are still needed, Treebard does it right, by making it easy to link any note to any number of other elements in the tree.
I have some work to do on the old database tables before I'll be able to store GEDCOM-sourced citations in a Treebard file. This site was helpful in gathering my thoughts about the table relationships as well as confirming my suspicions that the right way to communicate between databases is with a database.