简介
Jess提供适合自动化专家系统的逻辑编程,它常被称作“专家系统外壳”。近年来,智能代理系统也在相似的能力上发展起来。
与一个程序中有一个只运行一次的循环的命令式编程语言不同,Jess使用的声明式编程通过一个名为“模式匹配”的过程连续的对一个事实的集合运用一系列规则。规则可以修改事实集合,或者运行任何Java代码。
Jess可以被用来构建使用规则定义形式的知识来推倒结论和推论的Java Servlet、EJB、Applet和应用程序。因为不同的规则匹配不同的输入,所以有了一些有效的通用匹配算法。Jess规则引擎使用Rete算法。
特性
Jess非常小巧、灵活,并且是已知规则引擎中最快的。核心Jess语言与CLIPS依然兼容,许多Jess脚本也是有效的CLIPS脚本。与CLIPS一样,Jess使用Rete运算法则来处理规则。Rete是一个非常高效的算法,用于解决复杂、艰深的多对多匹配问题。在CLIPS的基础上,Jess添加了许多特性:后向链表、运行内存查询以及操作和直接推理Java对象的能力。Jess同时也是一个强有力的Java脚本环境。通过它你能够创建Java对象、调用Java方法而无需编译任何Java代码。
许可证
Jess不是开源软件,而CLIPS是。
代码实例
代码实例:
(deftemplate male "" (declare (ordered TRUE)))
(deftemplate female "" (declare (ordered TRUE)))
(deftemplate parent "" (declare (ordered TRUE)))
(deftemplate father "" (declare (ordered TRUE)))
(deftemplate mother "" (declare (ordered TRUE)))
(deffacts initialFacts
(male bill)
(female jane)
(female sally)
(parent bill sally)
(parent jane sally)
)
(defrule father
(parent ?x ?y)
(male ?x)
=>
(printout t crlf ?x " is the father of " ?y crlf)
)
(defrule mother
(parent ?x ?y)
(female ?x)
=>
(printout t crlf ?x " is the mother of " ?y crlf)
)
(reset)
(facts)
(run)
(printout t crlf)
