Term Selection - Syntax
A term selection instruction is a specification for the MRGT to modify the provisional MRG that it is working with should be modified. This documents specifies the syntax for the various instructions.
Term selection instructions are used in the [`versions` section](/docs/specs/files/saf#versions) of the SAF, where the various MRG (versions) for the scope are defined.Example of a `termselection` field in a SAF
Selecting Terms to be Added to the Provisional MRG
Legend of abbreviations used
Instruction | Description |
---|---|
"*" | Create an MRG entry from every curated text in the current scope, and add it to the provisional MRG. |
"[ <f1>, <f2>, ... ]" | Create an MRG entry from every curated text that matches any of the form phrases <f<i>> . |
"<key> [ <v1>, <v2>, ... ]" | Create an MRG entry from every curated text that has a header with a field named <key> , and whose value matches any of the specified values <v<i>> .1 |
By adding a terminology identifier @<tid>
to any of the above instructions, you specify that the MRG entries that are to be selected must originate from the terminology that this terminology identifier <tid>
identifies.
The instruction "[ party, actor ]@essif-lab"
will copy all MRG entries from the (default version) of the MRG as it exists in the scope essif-lab
. Of course, essif-lab
must be defined as a scopetag in one of the entries of the scopes section of the SAF.
Examples for adding terms
Selecting Terms to be Removed from the Provisional MRG
The syntax for removing terms is similar to one that is used for adding terms, but it is preceded with a -
character, as follows:
Legend of abbreviations used
Instruction | Description |
---|---|
"-[ <f1>, <f2>, ... ]" | Remove every MRG entry from the provisional MRG that matches any of the <f<i>> . |
"-<key> [ <v1>, <v2>, ... ]" | Remove every MRG entry from the provisional MRG that has a field named <key> , and whose value matches any of the specified values <v<i>> .1 |
Examples for removing terms:
Renaming/rewriting term fields
In analogy with namespaces, we accommodate for the renaming of terms (better: modifying fields in provisional MRG entries) as they are 'imported' from terminologies other than the one that we are constructing. However, the analogy breaks down in the sense that it is not only the term that should be renamable (which is sufficient for namespaces), but also certain attributes may need to be changed, e.g. the formPhrases
.
The following syntaxes are available for renaming fields in a provisional MRG entry that is part of the provisional MRG:
Legend of abbreviations used
Instruction | Description |
---|---|
"rename <ttrm> [ <k1>:<v1>, <k2>:<v2>, ... ]" | In the MRG entry that is identified by <ttrm> in the provisional MRG, the values of the fields k<i> are replaced by their corresponding values v<i> (also if v<i> is the empty string) |
Here is how it works. First, the provisional MRG Entry is searched that has a term
field whose value is <term>
. If found, all <key>
:<value>
pairs are processed in the sequence they are specified. Processing a <key>
:<value>
pair consists of looking for a field named <key>
in the selected MRG entry. We now have the following situations:
- if the
<key>
field exists, and- if the
<value>
is not empty, then the contents of the field is overwritten by<value>
; - if the
<value>
is empty, then the contents of the field is deleted;
- if the
- if the
<key>
field does not exists, and- if the
<value>
is not empty, then a new field named<key>
with the specified<value>
is added to the MRG entry; - if the
<value>
is empty, then nothing is done.
- if the
Renaming examples
- 'matching' means that [TBD: specify the matching algorithm, in particular when the field itself is an array, such as
grouptags
,headingids
, etc.].↩