1 / 16

Jess: A Rule-Based Programming Environment

Jess: A Rule-Based Programming Environment. Expert System. Reporter: Yu Lun Kuo E-mail: sscc6991@gmail.com Date: April 10, 2006. Why Expert System. Question of project developer Program = algorithm + Data Structure (Hard) Software Engineering Demand  Design  Coding (Demand Phase)

jasoncarr
Download Presentation

Jess: A Rule-Based Programming Environment

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jess: A Rule-Based Programming Environment Expert System Reporter: Yu Lun Kuo E-mail: sscc6991@gmail.com Date: April 10, 2006

  2. Why Expert System • Question of project developer • Program = algorithm + Data Structure (Hard) • Software Engineering • Demand  Design  Coding (Demand Phase) • Programmer • Expert Systems • Rule-based computer programs that capture the knowledge of human experts in their own fields of experience

  3. Rules • A rule is a kind of instruction or command that applies in certain situations • Rules are a lot like the if-then statements of traditional programming languages • if part of a rule is often called its left-hand side • then part of a rule is often called its right-hand side • A rule-based system is a system that uses rules to derive conclusions from premises if predicate or premises then actions or conclusions

  4. Rule Engine • A rule engine doesn’t contain any rules until they are programmed in • A rule engine knows how to follow rules, without containing any specific knowledge itself • deployment environment

  5. Architecture of a Rule-Based System • A typical rule engine contains • Inference engine • Forward Chaining – LISP, CLIPS • Backward Chaining - PROLOG • Rule base (knowledge base) • Working memory (fact base) • Inference engine consists of • Pattern matcher • Agenda • Execution engine

  6. Pattern Matcher • The working memory contains thousands of facts, and each rule has two or three premises • The pattern matcher need to search through millions of combinations of facts to find those combinations that satisfy rules • All the rules are compared to working memory • Decide which ones should be activatedduring this cycle

  7. Agenda • Inference engine figures out which rules should be fired, it still must decide which rule to fire first • The list of rules that could potentially fire is stored on the agenda • Ex. Give high priority

  8. Execution Engine • The execution engine is the component of a rule engine that fires the rules • Some modern rule engines offer a complete programming language you can use define • What happen when a give rules fires

  9. Conflict Set Conflict Resolution Fired

  10. Jess (Java Expert System Shell) • The Java Rule Engine API defined by the javax.rules package • A standard enterprise API for accessing rule engines • Site: http://www.jcp.org/jsr/detail/94.jsp • Jess rule engine • A rule engine and scripting language developed at Sandia National Laboratories in Livermore, California in the late 1990s • It can access to all of Java’s powerful APIs for networking, graphics, database access, and so on

  11. Jess (Cont.) • The Jess language can directly access all Java classes and libraries • This allows you to experiment with Java APIs interactively and build up large programs incrementally • Jess is therefore useful in a wide range of situations • Jess can be used in command-line applications, GUI applications, servlets, and applets.

  12. The most important step in developing a Jess application is to choose an architecture • Pure Jess language, with no Java code • Pure Jess language, but the program accesses Java APIs • Mostly Jess language code, but with some custom Java code in the form of new Jess commands written in Java • Half Jess language code, with a substantial amount of Java code providing custom commands and APIs. Jess provides the main() function • Half Jess language code, with a substantial amount of Java code providing custom commands and APIs. You write the main() function • Mostly Java code, which loads Jess language code at runtime • All Java code, which manipulates Jess entirely through its Java API

  13. Scripting Java with Jess • From Java code, you can access all parts of the Jess library • Easy to embed Jess in any Java application • Use Jess for experimenting with Java APIs • Jess is therefore a kind of scripting language for Java • You can create the windows, buttons, and other graphical components with a few lines of Jess code

  14. Representing facts in Jess • The contents of Jess’s working memory are held in your computer’s RAM • Most other constructs in Jess, facts are stored as lists • Jess offers a set of functions to let a program perform the basic collection operations on the working memory • add, remove, modify, duplicate

  15. Working memory • assert – Add facts to working memory • Clear – Clears all of Jess • Deffacts – Defines the initial contents of working memory • Facts – Display the content of working memory • Reset – Initializes the working memory • Retract – Removes facts from working memory • Watch – Tells Jess to print diagnostics when interesting things happen

More Related