The ID Manager Plugin controls id generation through the use of ID generation profiles.
An ID generation profile is a collection of ID generation rules, each of which may be used depending on where the new term is created in the ontology. Only one ID profile is in use at any given time. This profile is called the active profile.
ID generation profiles may contain zero or more conditional rules. Each of these rules is associated with a filter that specifies when a given conditional rule should be used.
When a new term is created, OBO-Edit looks at the parent term under which the new term was created. That parent term is checked against the rule filters in the active id generation profile. If the parent term matches a filter, the associated id generation rule is used.
If no conditional rule matches the parent term, or if there is no parent term (for example, if a new root was created), the default rule is used. Every id generation profile must specify a default rule.
ID Generation rules are character strings that contain some combination of character literals and variables.
Character literals are text characters that will appear, unaltered, when an id is generated. An id generation rule can, in theory, consist entirely of character literals, such as:
OBO:SINGLE_ID
When a new term is created using this rule, it will be given the ID OBO:SINGLE_ID. The limitations of this kind of rule become immediately apparent: you can only generate a single id from this rule. The next time a user tries to create a term from this rule, the term creation operation will fail, because the id generation rule cannot create an id that is not already in use.
To avoid this problem, we need:
Variables are special sequences (enclosed in $ characters) in the ID generation rule that will be replaced with some other value when a new id is generated.
The most important rule variable is $sequence$. $sequence$ is replaced by a numeric sequence of a fixed length (the default is 7 characters). Because this is a fixed length sequence, low numbered values will often be preceded by a number of zeros.
When a new id is generated, OBO-Edit will replace the $sequence$ variable with the numerically smallest possible value that is not in use.
For example, let's say our ontology consists of 4 terms with the following ids:
If the ID generation rule is:
OBO:$sequence$-A
the next id OBO-Edit will generate is "OBO:0000002-A".
OBO-Edit chooses this id because "OBO:0000000-A" and "OBO:0000001-A"
are
already in use. The fact that "OBO:0000002" is in use doesn't matter; since our
id generation rule specifies a "-A" suffix, the ids don't conflict.
The replacement behavior of some variables can be configured. This configuration is done through the use of variable parameters. Variable parameters are specified in parentheses after the variable name.
The sequence variable, for example, allows three parameters:
$sequence(length, min_value, max_value)$
Let's say our id generation rule is:
OBO:$sequence(7,4,9999999)$-A
If we used this rule with the example ontology described above, the next id OBO-Edit would generate is "OBO:0000005-A", because OBO-Edit generates a sequence with a minimum value of 4. Since "OBO:0000004-A" is already in use, OBO-Edit generates "OBO:0000005-A".
If the rule were:
OBO:$sequence(2,4,9999999)$-A
OBO-Edit would generate "OBO:04-A".
Parameters are always optional. If a parameter is not specified, OBO-Edit will use the default value for the parameter. Therefore, the following rules are all equivalent:
At the moment, there is only one variable besides $sequence$ (although in the future others will probably be added). The other variable is called $id$.
$id$ is replaced with the ID of the parent term. In theory, this makes it possible to build recursive ids that contain information about the parentage of a term.
This is a really, really bad idea. IDs should not encode any information about the structure of an ontology. Remember, ids cannot be modified once they are created. If ontology structure is encoded into ids, there is no way to fix the ids if there is some rearrangement of the ontology later; either the encoding scheme must be broken, or large parts of the ontology must be obsoleted and recreated.
This variable is only included here because some ontologies require it for historical reasons. If you are creating a new ontology, do not use it!
The ID Manager Plugin is used to manage id profiles, and is used to select the active id profile. It looks like this.
The leftmost control is a list of all available ID Generation Profiles. When an id generation profile is selected, it becomes the active id profile, and its rules are used to generate ids for new terms.
The next control to the right is the configuration button. Press this button to edit the currently selected profile. See Editing ID Profiles for details.
The + button creates a new ID profile named "<new id profile>". The new profile can be modified using the configuration button.
The - button deletes the currently selected profile. There must be at one id profile in existence, so it is not possible to delete the last id profile. If there is only one id profile, a new id profile must be created before that profile can be deleted.
When the configuration button is pressed, the id profile editor appears:
The topmost box contains the profile name. This name is used in the display, but doesn't effect what the profile does.
The next text box contains the default id rule.
The bottom most component is a list of conditional id generation rules.
To add a new conditional id generation rule, press the "Add" button. A new rule will be generated with the rule "<your rule>".
To delete a conditional rule, left-click the rule to select it, and press the "Del" button to delete it.
To edit a conditional id generation rule, left-click a rule to select it. The conditional rule editor will appear to the right:
At the top of the editor is a term filter editor. This defines the filter that is used to determine whether this conditional rule should be used.
At the bottom is a text box that contains the actual id generation rule to be used when this conditional rule applies.