BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 10 definitions for Jess.

Jess programming language

Print-Friendly
About 1 pages (413 words)

Bookmark and Share Know this topic well? Help others and get FREE products!

Jess, a rule engine for the Java platform, is a superset of CLIPS programming language, developed by Ernest Friedman-Hill of Sandia National Labs. It was first written in late 1995. It provides rule-based programming suitable for automating an expert system, and is often referred to as an expert system shell. 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. Jess can be used to build Java servlets, EJBs, applets, 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. While CLIPS is licensed as open source, Jess is not open source. 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)

External Reference

View More Summaries on Jess programming language
 
Ask any question on Jess programming language and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Jess programming language from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy