In the SQL Model the rules are stored in the database in three tables:
Rule_type ----< Rule -----< Role
Rule_type field and simplified example data for the rule 'torture':
rule_type act of violence
| Rule definition: | |||||
|---|---|---|---|---|---|
| rule_name | rule_type | date1 | date2 | date3 | notes |
| torture | act-of-violence | date | n/a | n/a | yes |
| Role definitions | ||||||
|---|---|---|---|---|---|---|
| row# | rule_name | table_ptr | role | min_no | max_no | controlled_vocab |
| 1 | torture | vocab | torture method | 1 | 10 | yes |
| 2 | torture | name | victim | 1 | 1 | no |
| 3 | torture | name | perpetrator | 1 | 1 | no |
| 4 | torture | event | event name | 1 | 1 | no |
| 5 | torture | vocab | location | 1 | 1 | no |
* the role field stores the name that will appear on the screen to prompt for the appropriate data entry. It must also be a term in the vocab table. If the field is to be filled from a controlled vocabulary it must be a category term in the vocab table.
** the min_no specifies if the field is mandatory (0 if optional, 1 if mandatory), the max_no shows how many times this field can be repeated in the rule.
A rule instance for the above torture rule would have three rows in the link table, two pointing to the name table and one to the event table. It would also have several rows in the term table, one for the location term and between one and ten rows, one for each of the torture methods used.