Rule Engines

The rule engine originates from an area of computer science that has long battled with the issues surrounding the embedding of human logic and expertise into computer software. Research into AI, and the offshoot from that research in the form of expert systems, led to the development of rule engines as a means of organizing and managing large and complex rule sets.

An expert system, also known as a production system, is an AI-derived application that employs a knowledge base of human expertise for the purposes of problem solving in a well-defined problem domain, such as medical diagnosis or hardware fault-finding. Achieving this aim requires defining potentially thousands of complex, interrelated rules, which capture the knowledge of a human expert.

Developers of expert systems use rule engines within their products because they offer several benefits over conventional software engineering approaches: Specifically, they:

  • Allow the dynamic addition of rules and data.

  • Enable the definition of rules using specialized rule-based languages.

  • Make rules easier to manage by centralizing them in one location.

  • Reduce the complexity involved in modeling extremely complex sets of rules.

Rule engines enable developers to employ declarative programming techniques on software systems using rule-based languages. Conventional approaches to software development rely on programming languages that use the imperative computational model. Imperative languages like Java provide the computer with a list of commands to execute in a specific order. Declarative programming languages instead state a set of conditions and then leave it to the computer to determine how the conditions should be satisfied.

Declarative programming techniques help facilitate the development of rule-based systems and have proven extremely effective in the field of expert systems.

Rule-Based Systems

A rule-based system relies upon the services of rule engines as means of inferring which rules to apply when solving a particular problem. The architecture of a rule-based system generally comprises three main elements:

  • Rules in the form of if ... then ... statements

  • A knowledge base of facts, or data

  • A rule engine

A rule-based system, such as an expert system, defines rules using the familiar construct of the if ... then ... clause, introduced earlier for business rules. Within an expert system, a rule represents a heuristic. The heuristic is an attempt to express the guidelines, or rules of thumb, a human expert applies when solving a particular problem.


Rule engines are sometimes referred to as inference engines.

Data is represented within the system as facts, which are typically maintained within a knowledge base.

The rule engine is responsible for matching facts to rulesmatching facts against the if part of the rule. If a match is found, then the rule engine executes the actions defined for the rule's then statement.


Not all rule-based systems use this approach. Systems built using the logic programming language Prolog define both facts and rules as predicates and so do not differentiate between the two.

Execution of the rule engine ceases when all facts have been matched. Since rules are able to modify the knowledge base as part of their actions, the rule engine can go on to fire further rules as a result of the actions of each rule.

Rules Engines in Enterprise Systems

Rule-based systems have previously been the domain of computer science rather than business systems. Nevertheless, the areas of business rules and rule-based systems do overlap, and the research into the development of expert systems can be applied directly to the definition of business rules within enterprise systems. After all, a system designed to model complex human reasoning should have no trouble with the humble business rule.

You should consider using a rule engine if:

  • Your business rules are subject to frequent change.

  • Other systems implement the same rules.

  • The business rules are highly complex and difficult to represent using conventional programming languages.

Rule engines, like databases, are enterprise resources. Where a database manages an organization's data, correspondingly, a rule engine manages a company's business knowledge. This makes rule engines complementary to the multitier architecture of the J2EE platform, which accesses the business knowledge managed by a rule engine in the same manner as corporate data assets held in a database are accessed.

In the next section, we examine how Java applications can employ the capabilities of a rule engine using Jess, a Java Expert System Shell.

    Rapid J2EE Development. An Adaptive Foundation for Enterprise Applications
    Rapid J2EEв„ў Development: An Adaptive Foundation for Enterprise Applications
    ISBN: 0131472208
    EAN: 2147483647
    Year: 2005
    Pages: 159
    Authors: Alan Monnox © 2008-2017.
    If you may any questions please contact us: