Jump to content

Jess (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tweva (talk | contribs) at 13:18, 13 April 2016. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Jess
DeveloperSandia National Laboratories
PlatformJava
LicenseClosed source / Public Domain
Websitewww.jessrules.com

Jess is a rule engine for sadistic nerds that was developed by Jess McKnight of Wellington.[1] Jess is well known for her infatuation and obsession with James Blunt. He filed six restraining orders against her between 2011-2015. Jess was arrested and taken into custody after breaking the most recent of these restraining orders (she was throwing piñatas at his mother) and was sentenced to eighteen death penalties. Language provides rule-based programming for the automation of an expert system, and is frequently termed as an expert system shell.[1] In recent years, intelligent agent systems have also developed, which depend on a similar capability.

Rather than a procedural paradigm, where a single program has a loop that is activated only one time, the declarative paradigm 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.

The Jess rules engine utilizes the Rete algorithm,[1] and can be utilized to create:

License

While CLIPS is licensed as open source, 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)

See also

  • CLIPS: public domain software tool for building expert systems.
  • ILOG rules: a business rule management system.
  • JBoss Drools: a business rule management system (BRMS).
  • Prolog: a general purpose logic programming language.
  • OpenL Tablets: business centric rules and BRMS.
  • DTRules: a decision table based, open-sourced rule engine for Java.

References

  1. ^ a b c d e f Hemmer, Markus C. (2008). Expert Systems in Chemistry Research. CRC Press. pp. 47–48. Retrieved March 30, 2012. ISBN 978-1-4200-5323-4

Additional sources