University of Washington, Bothell
CSS 482: Expert Systems
Fall 2010
Homework 5: Web Apps with Jess
Assigned: Monday, November 8, 2010
Due: Monday, November 15, 2010
In this homework, you will complete the shrub advisor expert system that we designed together in class (you can find the code we had created for this here, or in the Dropbox). You will implement this program as a web application using Java server pages and servlets.
First, to recap, we worked on an expert system that aids in the selection process of a suitable shrub for planting. The table below lists several shrubs and indicates whether each shrub possesses certain characteristics, which are: tolerance to cold weather, tolerance to shade, tolerance to drought, tolerance to wet soil, requirement for acidic soil, tolerance to city dwelling (high pollution), tolerance to growth in a container, whether the shrub is easy to care for, and whether the shrub is fast growing. An “X” indicates the shrub has the characteristic. Note that some of these characteristics represent conditions that the plant tolerates (but does not require), some are requirements, and some are “ordinary” characteristics (they match user desires). Based on interaction with the user, our system should present a list of suitable shrubs.
Shrub | Cold | Shade | Dry | Wet | Acid | City | Pot | Easy | Grows |
| Soil | Soil | Care | Fast | |||||
French hydrangea | X | X | X | X | |||||
Oleander | X | X | X | X | |||||
Northern bayberry | X | X | X | X | X | X | X | ||
Box honeysuckle | X | X | X | X | |||||
Gardenia | X | X | X | ||||||
Common juniper | X | X | X | X | X | ||||
Sweet pepperbush | X | X | X | X | X | ||||
Tartarian dogwood | X | X | X | X | X | ||||
Japanese acuba | X | X | X | X | |||||
Swamp azalea | X | X | X | X | |||||
The Jess code that we arrived at is stored in four files, plus one to load everything up. We have one file containing our templates and facts, one that has all of the “machinery” to ask questions using backwards chaining, one that has rules to exclude plants, and one that outputs recommendations (which we only have implemented as a stub right now, to help with debugging).
Fundamentally, this program works by asking questions, receiving answers, and using those answers to assert facts that may trigger more questions to be asked. When there are no more questions to be asked, a final result is reported. To implement this as a web app, I suggest the following architecture, patterned after the ordering system in chapter 19 of the textbook:
Source file | Description |
index.html | Welcome screen that triggers first servlet |
Startup.java | First servlet; starts up Jess, loads rules, retrieves first question |
ask.jsp | JSP to display question to user and send answer to servlet |
Ask.java | Servlet that takes in user answer, sends to Jess, and retrieves either another question or a final recommendation |
recommend.jsp | JSP to display the final recommendation |
Please submit your program, with documentation (in which you clearly state the current status of your program) and screen shots that illustrate your program’s operation, to our CollectIt drop box. Please zip or tar up your entire directory hierarchy so that I can unpack it in my own webapps directory and try out your code in tomcat. I should be able to do this without creating directories and moving files into their proper locations; everything should unpack right where it needs to be.
Your written documentation should be concise, but should allow the reader to understand your design without reference to the code.
Your code should be easy to read and understand. Use consistent indentation. Each file should start with a comment that includes the file name, your name, the date and a summary of the file purpose/contents. Each deftemplate, defrule, etc. should have a useful comment string and comments indicating what each slot means. The gist of your written documentation should be included in comments in your file(s).
There are a total of 100 points available in this assignment. I will allocate points to the functionality of each of the files indicated above as follows:
File | Points |
||
index.html | 5 |
||
Startup.java | 30 |
||
ask.jsp | 25 |
||
Ask.java | 30 |
||
recommend.jsp | 10 |
||
Therefore, it is essential that your documentation be clear about what is and is not working, and that you include test runs that support your assertions.