Subsets of rules

Use

Complex Sets of Rules can be simplified by splitting them into main sets of rules and subsets of rules. This creates smaller encapsulated units that require less effort to process.

Features

The subsets of rules are called from the main set of rules. The main set of rules transfers the content of the Facts , Records, and Compositions to the subset of rules. The subset of rules is run and eventually transfers the new calculated facts etc. back to the main set of rules.

Note Note

The data is only exchanged between the main set of rules and the subset of rules. Subsets of rules do not read data directly from the specification database. This means that no mapping database is required for sets of rules that serve purely as subsets of rules.

End of the note.

Subsets of rules are called using the CALL command. In its simplest form, the CALL command looks like this:

CALL

“<RULE NAME>”

END

Note Note

<RULE NAME> is used by the system to identify the subset of rules. It is therefore necessary for you to register subsets of rules. For more information, see Set Up Windows Registry in the Customizing for Basic Data and Tools.

End of the note.

In the above case, the input – facts, – records and – compositions of the subset of rules are read by the facts, records and compositions of the same name from the main set of rules and the output – facts, – records and – compositions of the subset of rules are returned to the facts, records and compositions of the same name from the main set of rules. However, this is not always possible or desired. To compare different names of facts, records, and compositions in the main set and subset of rules and to meet other requirements that arise, the CALL command has the following optional extended syntax.

Syntax of the Call command

Example syntax

CALL "<RULE NAME>"

WITH <NAME> AS MAIN

MAP

<NAME_MAIN>AS <NAME_SUBSET>,

RECORD <NAME_MAIN> AS <NAME_SUBSET>

 

<NAME_MAIN> AS <NAME_SUBSET>

END,

Composition <NAME_MAIN> AS <NAME_SUBSET>

<NAME_MAIN> AS <NAME_SUBSET>,

RECORD <NAME_MAIN> AS <NAME_SUBSET>

<NAME_MAIN> AS <NAME_SUBSET>

END

END

END

PHRASEMAP

“TEXT_MAIN” AS “TEXT_SUBSET”,

“TEXT_MAIN1” AS “TEXT_SUBSET1”,

END

END

Note Note

You can enter the complex syntax of the CALL command in the multirow edit window List of Todos of the rule editor. To configure this edit window, under Start of the navigation path Tools Next navigation step Options End of the navigation path on the Edit tab page, select the Use Multiline Edit box for To Dos field.

End of the note.
  • WITH <NAME> AS MAIN Use this to align different levels for the main set and subset of rules. For example, you can link facts of a subset of rules with the facts of a composition or a record of the main set of rules. The subset of rules is called for every component of the <NAME> composition or for every instance of the <NAME> record. In this case, the facts of the specified composition or specified record of the main set of rules are assigned to the facts without reference to a composition or record of the subset of rules.

    In the following MAP section (see below), only facts of the specified record or facts and records of the specified composition will be shown on the left-hand side of a MAP assignment. Using WITH <NAME> AS MAIN, it is only possible to transfer facts, records, or compositions that are assigned to the specified record or specified composition to the subset of rules.

  • MAP Optional section for assigning facts, records, and compositions of the main set and subset of rules if different names exist or an existing assignment of the same name is to be overwritten. The entries of the right-hand side, in other words the entries for the subset of rules, must be uniquely assigned. This means that a A AS B, A AS C assignment is permitted, but not A AS B, C AS B.

    The simplest entry is <NAME_MAIN>AS <NAME_SUBSET>, with the left-hand side referring to the main set of rules and right to the subset. Records and compositions can also be assigned, however. See the above example for the required syntax. Within such an assigned record or composition, facts are assigned on the basis of name equivalence if not assigned explicitly.

    Note Note

    If the system cannot find the corresponding assignments, it uses the original names.

    End of the note.
  • PHRASEMAP This is used to assign the content of facts, phrase keys for example, to other values during the transfer. This assignment is also optional. Both sides must be unique. The right-hand side relates to the subset of rules. Only text values are assigned.

Note:

  • Dependencies between rules The EH&S Expert also takes into account reciprocal rule dependencies when processing subsets of rules. For more information, see Data-Dependent Rule Execution in When Is a Rule Executed?

  • Data transfer Before the data is imported into the subset of rules, the facts, records, and compositions are empty. The import is performed in the same way as the initial importing of data into the main set of rules.

    The data is written back to the main set of rules as follows.

    • For facts, the values determined in the subset of rules are transferred.

    • In the case of records, the records in the main set of rules are first emptied to allow the state determined in the subset of rules to be transferred to the main set of rules.

    • When writing back the data of compositions, no instances are deleted in the main set of rules; instead new ones are added in order. If more instances exist in the main set of rules than in the subset, these remain unchanged. If fewer instances exist in the main set of rules, additional ones will be created.