Jess programming language
Encyclopedia
Jess is a rule engine for the Java platform - it is a superset of CLIPS programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

, developed by Ernest Friedman-Hill
Ernest Friedman-Hill
Dr. Ernest Friedman-Hill is a principal member of the technical staff at Sandia National Laboratories. They are located in Livermore, California....

 of Sandia National Labs
Sandia National Laboratories
The Sandia National Laboratories, managed and operated by the Sandia Corporation , are two major United States Department of Energy research and development national laboratories....

. It was first written in late 1995.

It provides rule-based programming suitable for automating an expert system
Expert system
In artificial intelligence, an expert system is a computer system that emulates the decision-making ability of a human expert. Expert systems are designed to solve complex problems by reasoning about knowledge, like an expert, and not by following the procedure of a developer as is the case in...

, and is often referred to as an expert system shell. In recent years, intelligent agent
Intelligent agent
In artificial intelligence, an intelligent agent is an autonomous entity which observes through sensors and acts upon an environment using actuators and directs its activity towards achieving goals . Intelligent agents may also learn or use knowledge to achieve their goals...

 systems have also developed, which depend on a similar capability.

Rather than a procedural paradigm
Imperative programming
In computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...

, where a single program has a loop that is activated only one time, the declarative paradigm
Declarative programming
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than...

 used by Jess continuously applies a collection of rules to a collection of facts by a process called pattern matching. Rules can modify the collection of facts, or they can execute any Java code.

Jess can be used to build Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 servlets, EJBs, applet
Applet
In computing, an applet is any small application that performs one specific task that runs within the scope of a larger program, often as a plug-in. An applet typically also refers to Java applets, i.e., programs written in the Java programming language that are included in a web page...

s, and full applications that use knowledge in the form of declarative rules to draw conclusions and make inferences. Since many rules may match many inputs, there are few effective general purpose matching algorithms. The Jess rules engine uses the Rete algorithm
Rete algorithm
The Rete algorithm is an efficient pattern matching algorithm for implementing production rule systems. The Rete algorithm was designed by Dr Charles L. Forgy of Carnegie Mellon University, first published in a working paper in 1974, and later elaborated in his 1979 Ph.D. thesis and a 1982 paper...

.

License

While CLIPS is licensed as open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

, Jess is not open source.
JESS is free for educational and government use but a license is required to use JESS for commercial systems.

Code examples

Code examples:

; is a comment

(bind ?x 100)

; x = 100

(deffunction max (?a ?b)
(if (> ?a ?b) then ?a else ?b))

(deffacts myroom
(furniture chair)
(furniture table)
(furniture bed)
)

(deftemplate car
(slot color)
(slot mileage)
(slot value)
)

(assert (car (color red) (mileage 10000) (value 400)))

Sample code:

(clear)
(deftemplate blood-donor (slot name) (slot type))
(deffacts blood-bank ; put names & their types into working memory
(blood-donor (name "Alice")(type "A"))
(blood-donor (name "Agatha")(type "A"))
(blood-donor (name "Bob")(type "B"))
(blood-donor (name "Barbara")(type "B"))
(blood-donor (name "Jess")(type "AB"))
(blood-donor (name "Karen")(type "AB"))
(blood-donor (name "Onan")(type "O"))
(blood-donor (name "Osbert")(type "O"))
)
(defrule can-give-to-same-type-but-not-self ; handles A > A, B > B, O > O, AB > AB, but not N1 > N1
(blood-donor (name ?name)(type ?type))
(blood-donor (name ?name2)(type ?type2 &:(eq ?type ?type2) &: (neq ?name ?name2) ))
=>
(printout t ?name " can give blood to " ?name2 crlf)
)
(defrule O-gives-to-others-but-not-itself ; O to O cover in above rule
(blood-donor (name ?name)(type ?type &:(eq ?type "O")))
(blood-donor (name ?name2)(type ?type2 &: (neq ?type ?type2) &: (neq ?name ?name2) ))
=>
(printout t ?name " can give blood to " ?name2 crlf)
)
(defrule A-or-B-gives-to-AB ; case O gives to AB and AB gives to AB already dealt with
(blood-donor (name ?name)(type ?type &:(or (eq ?type "A") (eq ?type "B" ))))
(blood-donor (name ?name2)(type ?type2 &: (eq ?type2 "AB") &: (neq ?name ?name2) ))
=>
(printout t ?name " can give blood to " ?name2 crlf)
)
;(watch all)
(reset)
(run)

Documentation

  • A book on Jess, Jess in Action: Rule Based Systems in Java, ISBN 1-930110-89-8

Related systems

  • CLIPS
    CLIPS
    CLIPS is a public domain software tool for building expert systems. The name is an acronym for "C Language Integrated Production System." The syntax and name was inspired by Charles Forgy's OPS...

    : public domain software tool for building expert systems.
  • d3web
    D3web
    d3web is a free, open-source platform for knowledge-based systems .Its core is written in Java using XML and/or Office-based formats for the knowledge storage....

    : free, open-source platform for knowledge-based systems (expert systems).
  • ILOG rules
    ILOG
    ILOG is an international software company owned by IBM. It creates enterprise software products for supply chain, business rule management, visualization and optimization....

    : a business rule management system.
  • JBoss Drools
    Drools
    Drools is a business rule management system with a forward chaining inference based rules engine, more correctly known as a production rule system, using an enhanced implementation of the Rete algorithm....

    : a business rule management system (BRMS).
  • Prolog
    Prolog
    Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is declarative: the program logic is expressed in terms of...

    : a general purpose logic programming language.
  • OpenL Tablets
    OpenL Tablets
    OpenL Tablets is a business rule management system and a business rules engine based on table representation of rules. Engine implements optimized sequential algorithm...

    : business centric rules and BRMS.
  • DTRules
    DTRules
    DTRules is Open Sourced Rules Engine written entirely in Java. DTRules executes Decision tables directly, and utilizes a Domain Specific Language for expressing the conditions and actions within the Decision Tables....

    : a Decision Table based, open-sourced rule engine for Java.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK