Common Rule engine Technology

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

What are business rules? In the requirements we tend to constrain, integrity, calibration, sub-branches and so can be counted into the business rules. The business rules that are discussed in the rules engine focus on what to do when the conditions are met. Therefore, a complete business rule consists of two parts: the condition and the triggering action. The engine is an important operating mechanism inside the thing, and the rule engine focuses on how to describe the rules, how to execute them, and how to monitor the problems.

for the Rapid software development platform will often include two aspects of content, one is reusable, one is configurable. For common components, common base class libraries, common algorithms and so on tend to increase reusability, while for object model, permission model, workflow model, rule engine is the high-level configuration of the solution platform.

    • The permission model realizes the user post, the role and the permission adjustment can be configured.
    • The workflow engine enables flexible configuration when the process changes.
    • The rules engine also allows business decisions to be drawn out from program code and also flexibly configured to implement changes in rules.

after having the metadata model, object model, workflow, permissions, interface model. The remaining two focuses on events and rules, and if events and rules can be flexibly configured and modified, and the rules themselves can be reused well, a more complete rapid development platform can be achieved.


definition and access to rules

In the past, most of the rule engine development was not normalized and had its own API, which made it less flexible to integrate with external programs. Switching to another product often means rewriting the application logic and API calls at a higher cost. The lack of standards in the rule engine industry has become an important area of concern. The JSR 94 (Java Rule Engine API), finalized in November 2003 and finally released in August 2004, standardizes the implementation of the Java rules engine.

The language used to create rules and actions is not involved in JSR 94. The rule language is an important part of the Rule Engine application, and all business rules must be defined in a language and stored in the rule execution set so that the rule engine can load and process them. Details of the rules language are not described here, and the names and their URLs are listed below:

  • Rule Markup Language (ruleml) 9>    
  • Simple Rule Markup Language (SRML) 0> c40>
  • Business Rules Markup Language (BRML)          
  • Swrl:a Semantic Web Rule Language combining OWL and ruleml

the use of multiple rule languages makes compatibility between different rule engine implementations a problem. The common rules Engine API may mitigate problems between different manufacturers ' APIs, but the lack of a common rules language will still hinder interoperability between different rule engine implementations. Although the industry has made some efforts in proposing common rules languages, such as the advent of RULEML,SRML, there is still a long way to go to get the common standards agreed by most of the rules engine vendors.

Execution of rules

in the definition phase of the rule, the rules are defined according to the business situation, and the rules are described in the rule language. Multiple rules can form a set of rule sets. The execution of the rule engine, first, is to load a rule set and parse the rules. At the same time, according to the rule inference engine, these parsing completed rules are executed to the data object of the specific input.

when the engine executes, the rule execution instance is executed according to the order of precedence in the rule execution queue, because the execution part of the rule may change the data object of the workspace, which causes some rule execution instances in the queue to fail due to a condition change and must be revoked from the queue. It is also possible to activate a rule that originally did not satisfy the condition, and generate a new rule execution instance into the queue. Therefore, a "dynamic" rule execution chain is formed, which forms the inference mechanism of the rule. The "chained" response to this rule is entirely driven by data in the workspace.

The efficiency of rule condition matching determines the performance of the engine, the engine needs to quickly test the data objects in the workspace, discover the rules that match the rules from the loaded rule set, and generate the rule execution instance. Charles L. Forgy of Carnegie Mellon University in 1982 invented an algorithm called Rete, which solves this problem well. At present, the world's top commercial business rules engine products are basically using the rete algorithm.

Rule Engine Products

Java Rules Engine commercial products are mainly (Jess is not an open source project, it can be used for academic research free of charge, but for commercial purposes)


Http://www.oschina.net/project/tag/231/rule-engine
the implementation of open source projects mainly includes:
    • The Drools-drools rule engine uses the improved form RETE-II algorithm of the rete algorithm. Internally, it uses the same concepts and methods as the Forgy algorithm, but adds a node type that can be seamlessly connected to the object-oriented language.
    • Mandarax is based on reverse inference (inductive method). Integration of multiple data sources is easier to implement. For example, database records can be easily integrated into fact sets (facts sets), reflection to integrate functionality in the object model. JSR 94 is not currently supported
    • OFBiz Rule Engine-Support induction (backward chaining). The original code is based on the "Building parsers in Java" of Steven John Metsker and does not support JSR 94
    • Jlisa-jlisa is a powerful framework for building business rules that has the advantage of extending the excellent features of Lisp, which is more powerful than clips. These features are essential for the development of multi-instance software. Support JSR 94


Currently the best commercial rules management system BRMS is Ilog JRules, the most commonly used open source rule engine is the Drools,java Rule Engine specification is JSR94, respectively, briefly described as follows:
(1) ILOG JRules
ILOG JRules is ILOG's flagship enterprise Rules engine product, and ILOG JRules itself is a flexible brms (business rule Management System) that covers the entire life cycle of operational rules. The rules engine within the ILOG JRules is a Java EE application that can be deployed to any Java EE project. In addition, the ilog can be easily integrated into the IDE environment, using Java controls to invoke the Rule engine.
ILOG Jrules positioned in the high-end brms market, according to IDC, ILOG's market share is around 30%, ranking first, with the world's leading manufacturers to achieve integration (ibm,bea,oracle,filenet, ... )。 Http://www.doc88.com/p-909285703209.html
Ilog was acquired by IBM in January 2009 as an important member of the IBM WebSphere product family.
(2) Drools
Drools is an open source rule engine written in the Java language, which was acquired by JBoss in 2005 based on the Apache protocol, and the current version of 5.0.1,drools is divided into four modules from 5.0:

    • Drools Guvnor (BRMS/BPMS)
    • Drools Expert (Rule engine),
    • Drools Flow (Process/workflow)
    • Drools Fusion (cep/temporal reasoning)

The expert is the traditional rule engine, Guvnor is a complete business rule management system. The main functions and features of drools are:

    •   use Rete algorithm to evaluate the rules you write;
    •   user-friendly web interface with Web2.0 Ajax features,
    •   By using the wizard editor and the text editor, the rule's author is more likely to modify the rule;
    •   support rules debugging;
    •   support rule flow;
    •   comes with a non-XML-formatted rule language DRL, and support the extension of natural language through DSL (Domain rule language);
    •   decision tables supporting XLS or CSV file formats;
    •   is versioned, you can easily replace the current set of rules with the previously saved version;
    •   JCR compatible rules warehouse;
    •   Provides an implementation of the Java Rule Engine API (JSR94);


(3) JSR94
The Java Rule Engine API is defined by the Javax.rules package and is the standard enterprise API for the access rule engine. The Java Rules Engine API allows the client to interact with different vendor's Rule engine products in a uniform manner, just as with JDBC authoring independent of vendor access to different database products.


Add: If the rule engine written in C is faster, you can find a C rule engine later.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.