# Jess (programming language)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Jess_(programming_language)
> Markdown URL: https://mediated.wiki/source/Jess_(programming_language).md
> Source: https://en.wikipedia.org/wiki/Jess_(programming_language)
> Source revision: 1351473280
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Programming language

This article needs more citations. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Jess" programming language – news · newspapers · books · scholar · JSTOR (March 2012) (Learn how and when to remove this message)

Jess Developer Sandia National Laboratories Release 1995; 31 years ago (1995) Stable release 7.1p2 / November 5, 2008; 17 years ago (2008-11-05) Written in Java Platform Java License Proprietary, public domain[clarification needed]

**Jess** is a [rule engine](/source/Rule_engine) for the [Java](/source/Java_(software_platform)) [computing platform](/source/Computing_platform), written in the [Java](/source/Java_(programming_language)) [programming language](/source/Programming_language). It was developed by [Ernest Friedman-Hill](/source/Ernest_Friedman-Hill) of [Sandia National Laboratories](/source/Sandia_National_Laboratories).[1] It is a [superset](/source/Superset) of the [CLIPS](/source/CLIPS) language.[1] It was first written in late 1995.[1] The language provides [rule-based programming](/source/Rule-based_programming) for the automation of an [expert system](/source/Expert_system), and is often termed as an *expert system shell*.[1] In recent years, [intelligent agent](/source/Intelligent_agent) systems have also developed, which depend on a similar ability.

Rather than a [procedural paradigm](/source/Imperative_programming), where one program has a [loop](/source/Loop_(computing)) that is activated only one time, the [declarative paradigm](/source/Declarative_programming) used by Jess applies a set of rules to a set of facts continuously by a process named *[pattern matching](/source/Pattern_matching)*. Rules can modify the set of facts, or can execute any Java code. It uses the [Rete algorithm](/source/Rete_algorithm)[1] to execute rules.

## License

The [licensing](/source/Software_license) for Jess is [freeware](/source/Freeware) for education and government use, and is [proprietary software](/source/Proprietary_software), needing a license, for commercial use. In contrast, CLIPS, which is the basis and starting code for Jess, is [free and open-source software](/source/Free_and_open-source_software).

## 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)

## See also

- [Semantic reasoner](/source/Semantic_reasoner)

- [Decision Model and Notation](/source/Decision_Model_and_Notation)

### Related systems

- [CLIPS](/source/CLIPS): [public-domain software](/source/Public-domain_software) tool to build expert systems

- [ILOG](/source/ILOG) rules: business rule management system

- JBoss [Drools](/source/Drools): business rule management system (BRMS)

- [Prolog](/source/Prolog): general purpose logic programming language

- [OpenL Tablets](/source/OpenL_Tablets): business centric rules and BRMS

- DTRules: [decision table](/source/Decision_table) based, open-source rule engine for Java

## References

1. ^ [***a***](#cite_ref-ExpertSystems_1-0) [***b***](#cite_ref-ExpertSystems_1-1) [***c***](#cite_ref-ExpertSystems_1-2) [***d***](#cite_ref-ExpertSystems_1-3) [***e***](#cite_ref-ExpertSystems_1-4) Hemmer, Markus C. (2008). [*Expert Systems in Chemistry Research*](https://books.google.com/books?id=KepsLbpWe-0C&dq=Jess%2C+Java&pg=PA47). CRC Press. pp. 47–48. [ISBN](/source/ISBN_(identifier)) [9781420053241](https://en.wikipedia.org/wiki/Special:BookSources/9781420053241). Retrieved March 30, 2012. [ISBN](/source/ISBN_(identifier)) [978-1-4200-5323-4](https://en.wikipedia.org/wiki/Special:BookSources/978-1-4200-5323-4)

### Further sources

- Friedman-Hill, Ernest (2003). [*Jess in Action: Rule Based Systems in Java*](https://books.google.com/books?id=-xxjRZhyF0IC&q=Jess+in+Action:+Rule+Based+Systems+in+Java). Manning Publications. [ISBN](/source/ISBN_(identifier)) [9781930110892](https://en.wikipedia.org/wiki/Special:BookSources/9781930110892). Retrieved March 30, 2012. [ISBN](/source/ISBN_(identifier)) [1-930110-89-8](https://en.wikipedia.org/wiki/Special:BookSources/1-930110-89-8)

## External links

- ["Jess, the Rule Engine for the Java Platform"](https://web.archive.org/web/20111229025816/http://www.jessrules.com/). Archived from the original on 29 December 2011.

---
Adapted from the Wikipedia article [Jess (programming language)](https://en.wikipedia.org/wiki/Jess_(programming_language)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Jess_(programming_language)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
