Tutorials : A Closer Look at the Java Rules Engine API (JSR 94) :

JESS

 The JESS rules engine is a programming library written in Java. It uses the JESS language to define rules, which are subsequently run on the JESS engine. The JESS language evolved itself from the CLIPS expert system, which was initially developed by NASA. The language is very similar to the LISP programming language in syntax and structure.

A JESS rules engine has two main parts, the rules and the knowledge base. The rules are the "if else" conditions representing a problem domain that a rule engine program needs to evaluate. The knowledge base is the actual data on which the rules will be applied. The knowledge defines the states of the problem domain. JESS will apply the rules on the knowledge base to get the desired results.

The JESS language allows the user to interact directly with the JESS API. JESS language does not need any compilation and can be used interactively to execute commands on the JESS API. Moreover the language is flexible enough to allow the programmer to add new commands written in Java. The JESS language can be customized to suit the needs of a specific application.

JESS provides the flexibility to be used as an embedded API, a GUI tool, servlets and other Java code. It can also work on the command line executing command line JESS commands and returning the results. For those who want the ability to include JESS into their proprietary framework, JESS allows itself to be controlled entirely by Java code without any JESS language extensions included in the code.

The JESS rule engine uses the RETE algorithm to evaluate its rules. The RETE algorithm is a popular rule evaluation algorithm used by many players in the industry. The algorithm is known to be efficient even when the numbers of rules are increased.

Conclusion

The Java Rules Engine API only provides guidelines on how to implement the Runtime API and the Administrator API. It misses out on the language to be used for creating rules and actions. The rules language forms a major part of a rules Engine application. All the business rules need to be defined in some language and stored in RuleExecutionSets so that Rules engines can load them and process them. As long as there is no common specification on how rules should be defined, there will be numerous flavors of rules languages in the market. The problem with multiple rules languages is the compatibility between different rule engine implementations. A common Rules Engine API might alleviate the problems of proprietary APIs but the absence of a common rule language will still handicap the interoperability between rule engine implementations.

Most of the popular rule engines in the market have their own rule languages. There is some effort in the industry to come up with a common rule language. Efforts like Rule Markup language (RuleML), Simple Rule Markup language (SRML) are underway in the industry, but there still is no common standard on which all the rule engine vendors agree. It might be some time before a consensus language to define rules is seen in the market. So until then we will have to live with multiple rule engines and their flavors of the rule languages. As the Rules engine API gains acceptance applications server providers might offer JDBC like support for multiple vendor implementations of the API, then just like multiple database support provided by the application server, multiple rule engine support can be provided within the same application server. As of now the vendor implementations of rule engines can be accessed using JNDI calls but the process of registration has to be done manually.

Sun may have done its part of the job by trying to standardize the Java API for rules engine, but the open question of the standards on the rule language would bog down any efforts to make interoperable rule engines.

Resources

Java Rules Engine JSR info

JESS Rule Engine

Benoy Jose is a web developer with over six years of experience in J2EE and Microsoft technologies. He is a Sun Certified programmer and enjoys writing technical and non-technical articles for various magazines.


Print Article

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.