After importing a TMG project, there is considerable cleanup to be done in the resulting RootsMagic database. There are differences in their respective sentence template languages that cannot translate well or could be translated better (improvement possible in the direct import process). This script addresses some of these outcomes and some unwanted artifacts that could have more to do with the TMG user’s style in customizing sentences in TMG. There are very likely more common problems that could be ameliorated by extensions to the script; post suggestions as comments on this page.
There are limits to what can be done within SQLite because it lacks regular expression search and replace within a field. A higher level language using a SQLite connection is required to go beyond SQLite’s own limitations. This script does use the REGEXP extension to find records having a field value that matches a regular expression but the REPLACE() function does not support regex for its search and replace, not even a wild card character; only explicit strings can be used as parameters.
The script processes all sentences associated with facts/events in RootsMagic:
- the default fact type sentence for the principal;
- the custom override sentence for the principal(s) for each fact/event;
- the default role sentence for each sharer role of a shared fact type;
- the custom override sentence for each sharer (witness) of a fact/event.
The functions performed include:
- adds [PlaceDetails] to sentences having only [Place] (Direct import translated [L] to [Place])
- adds :plain modifier to [Date], [Place], [PlaceDetails] if preceded by a common preposition to correct, e.g., “of in”; RootsMagic prepends a default preposition if the :plain modifier is not present.
- reverses order in switch “<was|and [Spouse] were>” which RM expands to “was” regardless; this first part is considered true in the absence of a variable in it.
- deletes “[L=English]” (revise the script to cover other unsuppressed language statements).
- relaces “<|” with “< ” (RM would always output nothing; the first part is true in the absence of a variable)
- juggles some instances of space characters surrounding switches to correct spacing. This covers some patterns; there are others it does not.
TMG-RM_Sentence_Tweaks.sql N.B. Requires a SQLite manager such as SQLiteSpy that supports the REGEXP extension; SQLite Expert Personal does not.
The script is not restricted solely to be used on databases imported from TMG. It may help with other databases, too. The caveat is that it, too, may have some unwanted results so it is important to keep the original and compare it to the tweaked one to conclude whether the benefits outweigh the collateral damage.