Jess: A Rule-Based Programming Environment - PowerPoint PPT Presentation

About This Presentation
Title:

Jess: A Rule-Based Programming Environment

Description:

... Based Programming Environment. Reporter: Yu Lun Kuo. E-mail: sscc6991_at_gmail. ... to let a program perform the basic collection operations on the working memory ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 17
Provided by: ayhwaan
Category:

less

Transcript and Presenter's Notes

Title: Jess: A Rule-Based Programming Environment


1
Jess A Rule-Based Programming Environment
Expert System
  • Reporter Yu Lun Kuo
  • E-mail sscc6991_at_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 doesnt 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 activated during 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
(No Transcript)
11
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 Javas powerful APIs for
    networking, graphics, database access, and so on

12
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.

13
  • 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

14
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

15
Representing facts in Jess
  • The contents of Jesss working memory are held in
    your computers 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

16
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
Write a Comment
User Comments (0)
About PowerShow.com