Show TOC

 Subsets of Rules

Use

You can simplify complex set of rules by splitting them into main sets and subsets of rules. This process creates smaller encapsulated units that can be edited more easily.

Features

The subsets of rules are called from the main set of rules. The main set of rules passes the contents of the facts , records , and compositions to the subset of rules. The subset of rules executes and then passes the newly calculated facts, records, and compositions back to the main set of rules.

Note Note

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

End of the note.

A subset of rules is called using the CALL command . The CALL command in its simplest form appears as follows:

CALL "<RULE_NAME>"

END

Note Note

The system identifies the subset of rules by means of its <RULE_NAME>. It is important, therefore, that you register the subsets of rules. For more information, see the Implementation Guide (IMG) for Basic Data and Tools under Set Up Windows Registry .

End of the note.

In the above case, the input facts, records, and compositions of the subset of rules are read by facts, records, and compositions of the main set of rules with the same names, and the output facts, records, and compositions of the subset of rules are returned to facts, records, and compositions of the main set of rules with the same names. This is not always possible or desirable. To match up different names of facts, records, and compositions in main and subsets of rules and to meet other requirements that arise, the CALL command has an optional extended syntax shown and explained below.

CALL Command Syntax

CALL "<RULE_NAME>"

WITH <NAME> AS MAIN

MAP

<NAME_MAIN> AS <NAME_SUB>,

RECORD <NAME_MAIN> AS <NAME_SUB>

<NAME_MAIN> AS <NAME_SUB>

END,

Composition <NAME_MAIN> AS <NAME_SUB>

<NAME_MAIN> AS <NAME_SUB>,

RECORD <NAME_MAIN> AS <NAME_SUB>

<NAME_MAIN> AS <NAME_SUB>

END

END

END

PHRASEMAP

"TEXT_MAIN" AS "TEXT_SUB",

"TEXT_MAIN" AS "TEXT_SUB"

END

END

Note Note

You can enter the complex syntax of the CALL command in the rule editor in the multiline editing window List of Todos . To set this editing window, under Start of the navigation path Tools Next navigation step Options End of the navigation path on the Edit tab page select the field Use Multiline Edit Box for To Do's.

End of the note.
  • WITH <NAME> AS MAIN This makes it possible to match up different levels in the main and subset of rules. In this way, facts in a subset can be linked with the facts of a composition or a record in the main set of rules. The subset of rules is called for each component of the composition <NAME> or for each instance of the record <NAME>. The facts of the specified composition or record in the main set of rules are assigned in this case to the facts of the subset of rules without reference to a composition or record.

    In the MAP section below, this means that facts of the specified record or facts and records of the specified composition can appear exclusively on the left-hand side of a MAP assignment. With WITH <NAME> AS MAIN it is only possible to pass facts, records, or compositions to the subset of rules if they are assigned to the specified record or composition.

  • MAP Optional section for assigning facts, records, and compositions in main or subsets of rules if their names are different or if an existing assignment with the same name is to be overwritten. The entries on the right for the subset of rules must be uniquely assigned for this. Thus the assignment A AS B, A AS C is allowed, but not A AS B, C AS B .

    The simplest entry is <NAME_MAIN> AS <NAME_SUB> , where the left-hand side relates to the main set of rules and the right-hand side to the subset of rules. Records and compositions can also be assigned. For the correct syntax, refer to the above example. Within an assigned record or composition, an assignment of the facts by means of identical names also applies if no explicit assignments were made.

    Note Note

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

    End of the note.
  • PHRASEMAP This makes it possible to assign the contents of facts, such as phrase keys, to other values when transferring them. This assignment is also optional. It must be unique on both sides. 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 dependencies between rules when working with subsets of rules. See also “Data-Dependent Rule Execution” in When Is a Rule Executed?

  • Data transfer: Before reading data into the subset of rules, its facts, records, and compositions are empty. Reading in is done in the same way as the initial import of data into the main set of rules.

    Writing data back to the main set of rules is done as follows:

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

    • For records, the records in the main set of rules are first emptied so that the status determined in the subset of rules can be transferred to the main set of rules.

    • When writing back the data for compositions, no instances in the main set of rules are deleted; they are filled in sequence. If more instances exist in the main set of rules than in the subset, these remain unchanged. If there are fewer instances in the main set of rules, additional instances are created.