Introduction: This paper introduces the Java Rule Engine and its API (JSR-94) and related implementation in detail, describes its architecture and API application, and points out the relationship between Java Rules Engine, rule language, JSR-94, and the deficiencies and prospects of JSR-94.
The development of complex enterprise-level projects, as well as the business rules with changing external conditions (business logic), are in urgent need of separating the business decision logic of business decision makers from the technical decisions of application developers, and placing these business decisions in central databases or other unified locations, They can be dynamically managed and modified at runtime (i.e. business time) to provide flexibility and adaptability to the software system. The rule engine is a solution that is applied to the dynamic environment described above.
The first part of this paper briefly introduces the background of rule engine and rule-based expert system, the second part describes what is the rule engine and its architecture and algorithm, the third part introduces various Java rules engine, such as commercial products and open source project implementation, and the fourth is about Java rules The engine API (JSR-94) is described in detail, explained its architecture, management API and runtime APIs and related security issues, part fifth discusses the rules language and its standardization, part sixth gives a simple example using the Java Rule Engine API, and the seventh part gives a summary and a perspective.
1. Introduction
1.1 Rule Engine generating background
Business managers have the following requirements for the development of enterprise-class IT systems: (1) To improve efficiency, management processes must be automated, even if modern business rules are unusually complex (2) the market requires frequent changes in business rules, IT systems must be based on the changes in business rules fast, low-cost updates (3) for fast, low-cost updates, Business people should be able to directly manage the rules in the IT system without requiring program developers to participate.
The project developers encountered the following problems: (1) program = algorithm + data structure, some complex business rules are difficult to derive algorithm and abstract data Model (2) software engineering requirements from the demand-& gt; Design-> Coding, however, business rules are often not clear in the requirements phase, After the design and coding are still changing, business rules are often embedded in the system code (3) for programmers, the system has been maintained, updated difficult, and more unlikely to allow business personnel to manage.
The emergence of rule-based expert systems is an opportunity for developers to solve problems. The rule engine is developed by the inference engine in a rule-based expert system. The following is a brief introduction to rule-based expert systems.
1.2 rule-based Expert system (RBEs)
The expert system is a branch of artificial intelligence that imitates human reasoning, uses exploratory methods for reasoning, and interprets and proves its inference by using terms that humans can understand. Expert systems have many classifications: neural networks, case-based reasoning, and rule-based systems.
RBEs consists of three parts: rule base (Knowledge Base), Working Memory (fact base), and inference Engine (inference engine). Their structure is as follows:
Figure 1. The composition of rule-based expert system
As shown in the figure above, the inference engine consists of three parts: pattern Matcher, agenda, and execution Engine. The pattern Matcher when to execute which rule, agenda to manage the order of execution of the rules selected by Patternmatcher, and Execution Engine is responsible for enforcing the rules and other actions.
The inference engine is added to the agenda by determining which rules meet the facts or objectives, and give precedence to the rules, and the rules that satisfy the facts or objectives. There are two ways of reasoning: deductive (forward-chaining forward chain) and inductive method (backward-chaining reverse chain). Deduction from an initial fact, constantly applying rules to draw conclusions (or perform specified actions). The inductive rule is to start from the hypothesis and constantly look for the facts that conform to the hypothesis.