Definition
Concept used to map compositions of specifications from individual components in the EH&S Expert.
Use
Many specifications in EH&S are compositions and consist of several components. Data for specifications such as these can often be derived from their component data. The Composition concept maps this process in the EH&S Expert.
Structure
Compositions can be found in the fact section and are introduced with
COMPOSITION <Composition name> and concluded with END .The density is to be calculated for a specification composition. This calculated density is to be the mean value of the densities of the components, evaluated according to their percentage parts in the specification composition. The fact section could look like the following:
FACTS | |||
DENSITY, | |||
COMPOSITION EXACT_SUBSTANCE_COMPOSITION | |||
PERCENT, | |||
DENSITY | |||
END |
The Exact_Substance_Composition composition is linked via a
mapping table with a value assignment type of the category Composition from EH&S. One instance of the composition is stored in the EH&S Expert for each component of this specification composition.If you create a set of rules using the rule editor, the editor generates a rule file with the correct syntax automatically.
Integration
The facts of a composition are addressed using
<Composition name>.<Fact name> .A rule that contains a fact from a composition is executed for each instance of the composition, or in other words, for each component. If you want the system to execute a rule only for certain components, you must enter the IF condition correspondingly.
If a rule contains facts from several compositions, it is executed for all combinations of the instances of the compositions. Use this function with caution as applying it to large amounts of data could lead to intensive usage of rules.
A check for 100% in a specification composition could look like the following:
FACTS | ||||
SUMPERCENT := 0, | ||||
COMPOSITION COMP | ||||
PERCENT | ||||
END | ||||
RULES | ||||
RULE SumPercent | ||||
IF COMP.PERCENT > 0 | ||||
THEN | ||||
SUMPERCENT := SUMPERCENT + COMP.PERCENT | ||||
END | ||||
RULE AbortIfNot100 | ||||
IF SUMPERCENT <> 100 | ||||
THEN | ||||
ERROR("EC$137", "&&&&", "The sum of percentages contains errors"), | ||||
ABORT() | ||||
END | ||||
END |
In this example the SumPercent rule is executed once for each instance of the composition COMP, or in other words, for each component. The percentage is added up in the SUMPERCENT fact. In a second rule, an error message is generated if the percentage is not equal to 100.
If no instance is available for a composition, a corresponding rule is not executed. In a rule that affects more than one composition, if only one composition does not contain an instance this is enough to prevent the rule being executed.