Jump to content
Wikipedia The Free Encyclopedia

Jess (programming language)

From Wikipedia, the free encyclopedia
(Redirected from Jess programming language)
This article needs additional citations for verification . 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
Initial release1995; 30 years ago (1995)
Stable release
7.1p2 / November 5, 2008; 16 years ago (2008年11月05日)
Written inJava
Platform Java
License Proprietary, public domain
Websitewww.jessrules.com

Jess is a rule engine for the Java computing platform, written in the Java programming language. It was developed by Ernest Friedman-Hill of Sandia National Laboratories.[1] It is a superset of the CLIPS language.[1] It was first written in late 1995.[1] The language provides rule-based programming for the automation of an expert system, and is often termed as an expert system shell.[1] In recent years, intelligent agent systems have also developed, which depend on a similar ability.

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

License

[edit ]

The licensing for Jess is freeware for education and government use, and is 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.

Code examples

[edit ]

Code examples:

; is a comment
(bind?x100)
; x = 100
(deffunctionmax(?a?b)
(if(>?a?b)then?aelse?b))
(deffactsmyroom
(furniturechair)
(furnituretable)
(furniturebed)
)
(deftemplatecar
(slotcolor)
(slotmileage)
(slotvalue)
)
(assert(car(colorred)(mileage10000)(value400)))

Sample code:

(clear)
(deftemplateblood-donor(slotname)(slottype))
(deffactsblood-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"))
)
(defrulecan-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)))
=>
(printoutt?name" can give blood to "?name2crlf)
)
(defruleO-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)))
=>
(printoutt?name" can give blood to "?name2crlf)
)
(defruleA-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)))
=>
(printoutt?name" can give blood to "?name2crlf)
)
;(watch all)
(reset)
(run)

See also

[edit ]
[edit ]

References

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

Further sources

[edit ]
[edit ]

AltStyle によって変換されたページ (->オリジナル) /