Rules engine development specification--rule configuration class specification <serial 6>

2.5. As far as possible to complete all actions in a rule or a rule set Make
full use of the initial action, start action, entry condition, multiple conditions and actions of the rule set and rules. Whenever possible, complete a task in a rule or a set of rules. But too many layers.
When rule sets and rules were originally designed, each rule consisted of conditions and actions. Therefore, a standard rule is that
if condition 1
then action 1
is composed, this is the most basic rule.
But when a rule has two conditions, you can put this condition into the rule's conditions, becoming
if condition 1 and condition 2
then action 1.
This is the second standard rule form.
At this time, if there are multiple combinations of two conditions, different actions are performed between different combinations. For example
if condition 1 and condition 2
then action 1
else if condition 1 or condition 2
then action 2
This is the third standard form of the rule.
If some judgments in the conditions need to be implemented and processed, then the rules can be set to support initialization. For example:
initialize action 1
if condition 1 and condition 2
then action 1
else if condition 1 or condition 2
then action 2
This is the fourth standard rule form
If all these conditions are judged, a common condition needs to be satisfied, only if it is satisfied This rule cannot be processed until this condition is met. Rules can be set to support entry conditions, such as:
Entry Condition: Entry Condition 1
Initialization Action 1
If condition 1 and condition 2
then action 1
else if condition 1 or condition 2
then action 2
This approach is not part of the standard format for rules. This is just a configuration for the convenience of display and viewing. This method is the same as adding a ruleset and placing the rules under the ruleset.
Rule Set:
Entry Condition: Enter Condition 1
Rule 1:
Initialize Action 1
If Condition 1 and Condition 2
, then Action 1
Otherwise, if Condition 1 or Condition 2
, then Action 2
When configuring rules, add as few layers as possible, especially loops Medium loop. Not easy to understand and not easy for other users to see.
2.6. Take full advantage of the power of decision trees.
If you need to call an external rule package, use the decision tree function as much as possible to display the logic more intuitively.
At present, when the rules are used for processing, they are executed in a sequential manner. Therefore, when the rules are configured, a flowchart will be formed by default according to the sequence. If a rule set is set, it is equivalent to defining a branch of the process. When the calling external rule package is defined in the rule, it is equivalent to calling the sub-process.
The functions of flowcharts, process branches and sub-processes are realized by sequentially executing rule sets, rules, and calling external rule package functions.
However, in order to show the process more intuitively, especially when external rule packages need to be called, it is more intuitive to use the decision tree function.
The decision tree uses a flowchart to define the sequence, and the node of each process can be a rule or an external rule package. At the same time, a connection method can be used between multiple nodes to define the execution sequence and execution conditions.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326626873&siteId=291194637