## 3 Key Concepts
### Rule-Based System  
A rule-based system is a form of an expert system which usually uses an ontology-based representation to codify the information into a knowledge-base that contains facts which can be used later in the reasoning stage [26]. A rule-based system depends on two kinds of memory as it is shown in Figure 4a. The working memory holds the facts which present the domain knowledge, while the production memory holds a set of rules. A rule is a declarative method to represent the knowledge in a concise, non-ambiguous conditional statement. The reasoning engine is the brain of the rule-based system which solves a given problem by matching the present facts with the existing rules. Initially, an external event must trigger a reasoning session in the reasoning engine. When one or more fact matches the IF condition in one or more rule statement, the THEN conclusion will be inferred and a new facts will be generated, then the new facts will be updated into the working memory. A new reasoning session will be triggered automatically, every time a match between a fact and a rule condition occurs. A chain of reasoning sessions will take place until no more matching happens. An example of a reasoning chaining can be seen in Figure 4b. The reasoning engine organizes and controls the flow of the solution route based on one of the following reasoning methods [27]:  
* Forward reasoning: in forward chaining, the rule-based system starts with the initial facts and derives new facts whenever a rule matches a fact. The reasoning engine goes through consequence of rules firing to find its final goal, which ultimately leads to find the solution route from the initial facts to the final goal in a forward reasoning style. An example of the forward chaining is shown in Figure 5a. * Backward reasoning: in backward chaining, the rule-based system starts from the final goal, then it finds which rules must be fired to lead to this goal, therefore the reasoning engine can determine the facts which are needed to reach the final goal. During the backward chaining a consequence of sub-goals will appear, which ultimately leads to find the solution route from the final goal to the initial facts in a backward reasoning style. An example of the backward chaining is shown in Figure 5b. Drools is a BRMS that has been created by jboss organization, therefore it adds more features than a regular rule-based system [28]. As it provides a tool for a rule-based solution creation, managing,  
Figure 4: Rule-based System (**a**) Components and Operating Mechanism; (**b**) An Example. Figure 5: (**a**) Forward Reasoning—an Example; (**b**) Backward Reasoning—an Example. deploying, and analyzing. Drools has the capability of applying a hybrid chaining reasoning. A hybrid chaining reasoning is a mix between the forward and the backward chaining which can be more efficient in some cases than both. [PERSON] applies two mechanisms of reasoning, the first mechanism is called a stateless reasoning. In this technique. The reasoning engine does not take into consideration the change in the values of the facts during executing the reasoning session. Therefore, the rules which are based on these facts will not be fired. The second mechanism is called a stateful reasoning. In this technique, the reasoning engine considers the change in the values of the facts during executing a reasoning session. Therefore, the rules which are associated with these facts will be fired. The stateless reasoning session can be used to derive new results based on facts, while stateful reasoning session is useful in more complicated scenarios such as diagnosis or monitoring. Moreover, Drools evolves the pattern matching ReteMO algorithm to ReteOO algorithm [29]. ReteOO denotes the enhancement of Rete algorithm by combing it with other Object Oriented (OO) concepts such as abstraction, inheritance, and encapsulation.