![]() |
|
e2gSwing Reference: Extensions to e2gLite Reference for the Updated Expert System Shell Applet.
e2gSwing Reference Index
The e2gLite expert system shell was originally designed (more than eight years ago) as a Java applet to work with early versions of the
Java runtime engine (JRE)
installed automatically with the Web browsers popular at that time. While the user interface functionality represented by these versions
of Java has worked adequately for many users, it does not adapt easily to implementing applications that need to represent output using non-Roman
character sets such as Cyrillic or Chinese. Because the number of users who desire such functionality has increased over
time, e2gLite has been re-architected to use the "Swing" user interface associated with Java 2 and has been renamed e2gSwing
to clearly distinguish it from earlier versions.
This Web page provides initial extensions to the e2gLite documentation for e2gSwing
and is provided with the understanding that the applet, and its documentation, is still a work in progress. Further development of
the expert system shell applet will be concentrated on e2gSwing, but e2gLite will continue to be available.
Expert system applications implemented with e2gSwing will work only with browsers that incorporate access to a Java 2 JRE, usually implemented
as a "plugin" or "add-on" obtained from Sun Microsystems. Browser documentation will generally describe the process for downloading and installing the Java plugin.
Introduction: General Description of e2gSwing
The format of e2gSwing knowledge bases is unchanged from e2gLite with the exception that knowledge bases employing non-Roman character sets must be stored as Unicode files. This document provides a supplement to the e2gLite documentation, not a replacement. If you are developing an application to be delivered in a language other than English, you should examine the material in Module 7 under the heading Delivering a knowledge base in languages other than English.
The examples provided on this Web page have been tested with the following browsers: Microsoft Explorer (v7.x), Mozilla Firefox (v3.x), and Google Chrome (v1.x) running under Windows XP. All language translations in the examples were performed with Yahoo's Babel Fish machine translation software, and we apologize if these translations are not perfect.
Click here to run the demonstration expert systems: use browser back button to return
e2gLite "Auto Diagnosis Advisor" (English & French) and "Graduate Admissions Expert System" demonstrations run with e2gSwing
Click here to run the demonstration expert system: use browser back button to return
e2gLite "wine selection" demonstration with Javascript interface run with e2gSwing"
| Example HTML to incorporate the e2gSwing Applet in a Web page | |
|---|---|
<APPLET CODE="e2g.class" ARCHIVE="e2gSwing.jar" NAME="e2g" WIDTH=450 HEIGHT=300 MAYSCRIPT> <PARAM NAME="KBURL" VALUE="weather.kb"> (optional <PARAM> tags) . . . Java capable browser required! </APPLET> | |
| Notes |
|
| e2gSwing Applet Parameters: Additions to e2gLite for e2gSwing Shown in Blue | |||
|---|---|---|---|
| Name | Values | Default | Examples |
| KBURL | Knowledge base name, path from directory containing document that loaded applet or complete URL locating the KB | No default: required parameter | <PARAM NAME="KBURL" VALUE="auto.kb"> (KB is in same directory as HTML document) <PARAM NAME="KBURL" VALUE="/kb/auto.kb"> (file is in kb subdirectory below directory containing HTML document) <PARAM NAME="KBURL" VALUE="http://www.mysite.com/kb/auto.kb"> |
| APPTITLE | Any character string: 1st line of title on start screen | Blank | <PARAM NAME="APPTITLE" VALUE="Auto Diagnosis"> |
| APPSUBTITLE | Any character string: 2nd line of title on start screen | Blank | <PARAM NAME="APPSUBTITLE" VALUE="by Ace Auto Repair"> |
| BGCOLOR | Applet background color specified as hex RGB color as used in HTML | #FFEE33 (pale yellow) | <PARAM NAME="BGCOLOR" VALUE="#00FF00"> (green) <PARAM NAME="BGCOLOR" VALUE="#0000FF"> (blue) |
| TITLECOLOR | APPTITLE and APPSUBTITLE text color specified as hex RGB color as used in HTML | #000000 (black) | <PARAM NAME="TITLECOLOR" VALUE="#FFFFFF"> (white) |
| PROMPTCOLOR | PROMPT text color specified as hex RGB color as used in HTML | #000000 (black) | <PARAM NAME="PROMPTCOLOR" VALUE="#FFFFFF"> (white) |
| PROMPTSIZE | PROMPT text size (suggested values 8 to 20) | Approximately 10 | <PARAM NAME="PROMPTSIZE" VALUE="15"> |
| DEBUG | If TRUE, debug window is created when KB is started | FALSE | <PARAM NAME="DEBUG" VALUE="TRUE"> |
| STARTBUTTON | Text on button that starts consultation | "Start the consultation" | <PARAM NAME="STARTBUTTON" VALUE="Help me!"> |
| LOADMSG | Message displayed on opening screen while knowledge base is loaded | "Loading knowledge base..." | <PARAM NAME="LOADMSG" VALUE="Chargeant la base de connaissance..."> |
| PROMPTFIRST | If TRUE use PROMPT for an attribute before backward chaining | TRUE | <PARAM NAME="PROMPTFIRST" VALUE="false"> |
| JSFUNCTION | Provides the name of a Javascript function to be called each time an e2gLite button is clicked | null (no function is called) | <PARAM NAME="JSFUNCTION" VALUE="buttonPush"> |
| KBENCODING | Defines knowledge base (.kb) file encoding | US-ASCII | <PARAM NAME="KBENCODING" VALUE="UTF-16"> |
| WORDWRAP | Wrap output lines in the how, why, conclusions and debug outputs, breaking lines between words | FALSE | <PARAM NAME="WORDWRAP" VALUE="TRUE"> |
| DIALOGFONT | Name of the font used to display prompts and button text | Arial Unicode MS | <PARAM NAME="DIALOGFONT" VALUE="Segoe UI"> |
| MONOFONT | Name of the monospaced font used to display how, why, conclusions and debug outputs | Monospaced | <PARAM NAME="MONOFONT" VALUE="Courier New"> |
| Notes |
| ||
If your application's Web page or e2gSwing knowledge base incorporates non-Roman character sets, you must save the file as a Unicode file.
If your application is delivered in a Roman language that employs diacritical marks, saving in Unicode is recommended. Many text
editors provide this capability. For example, the Notepad editor included with Microsoft Windows operating systems provides the following
Encoding option when Save As is selected from the File menu:
Saving a knowledge base (.kb) or Web page (.htm) file in Unicode
Demonstration and example knowledge base: Weather Wizard (English version)
| Example HTML to incorporate the English language Weather knowledge base in a Web page |
|---|
|
<APPLET CODE="e2g.class" ARCHIVE="e2gSwing.jar" WIDTH=450 HEIGHT=300> <PARAM NAME="KBURL" VALUE="weather.kb"> <PARAM NAME="APPTITLE" VALUE="Weather Demonstration"> <PARAM NAME="APPSUBTITLE" VALUE="by The Weather Wizard"> <PARAM NAME="TITLECOLOR" VALUE="#FF0000"> <PARAM NAME="STARTBUTTON" VALUE="Recommend what to wear"> <PARAM NAME="WORDWRAP" VALUE="True"> Java is required to view this page! </APPLET> |
| Example e2gSwing Knowledge Base: English version of the Weather Demonstration |
|---|
REM Test Knowledge Base (weather.kb) RULE [Is it going to rain?] If [precipitation] = "expected" and [the expected temperature] > 32 Then [the recommendation] = "wear a raincoat" RULE [Is it going to snow?] If [precipitation] = "expected" and [the expected temperature] < 33 Then [the recommendation] = "wear your boots" @ 95 PROMPT [precipitation] MultChoice CF "According to the weather forecast, precipitation is:" "expected" "not expected" PROMPT [the expected temperature] Numeric CF "The expected daytime temperature (degrees Fahrenheit) is:" "-30" "120" GOAL [the recommendation] DEFAULT [the recommendation] = "wear whatever you want to" @ 90 |
Demonstration and example knowledge base: Weather Wizard (simplified Chinese version)
| Example HTML to incorporate the Simplified Chinese language Weather knowledge base in a Web page |
|---|
|
<APPLET CODE="e2g.class" archive="e2gSwing.jar" WIDTH=400 HEIGHT=300>
<PARAM NAME="KBURL" VALUE="weatherCh.kb"> <PARAM NAME="APPTITLE" VALUE="天气示范"> <PARAM NAME="APPSUBTITLE" VALUE="由天气巫术师"> <PARAM NAME="PROMPTCOLOR" VALUE="#000000"> <PARAM NAME="BGCOLOR" VALUE="#00ff00"> <PARAM NAME="DEBUG" VALUE="false"> <PARAM NAME="WORDWRAP" VALUE="true"> <PARAM NAME="PROMPTSIZE" VALUE="12"> <PARAM NAME="KBENCODING" VALUE="UTF-16"> <PARAM NAME="STARTBUTTON" VALUE="推荐怎样佩带"> Java is required to view this page! </APPLET> |
| Example e2gSwing Knowledge Base: simplified Chinese version of the Weather Demonstration |
|---|
REM Test Knowledge Base (weatherCh.kb) Chinese-simplified: MUST BE SAVED AS A UNICODE FILE! RULE [下雨?] If [降雨雪] = "期望" and [期望的温度] > 32 Then [推荐] = "穿着雨衣" RULE [下雪?] If [降雨雪] = "期望" and [期望的温度] < 33 Then [推荐] = "穿您的起动" @ 95 PROMPT [降雨雪] MultChoice CF "根据天气预报,降雨雪是:" "期望" "没期望" PROMPT [期望的温度] Numeric CF "期望的白天温度(华氏度)是:" "-30" "120" GOAL [推荐] DEFAULT [推荐] = "佩带什么您想要" @ 90 REM Translation table for e2gSwing output: only partially translated with Babel Fish (babelfish.yahoo.com) REM Button text TRANSLATE B_SUBMIT = "递交您的反应" TRANSLATE B_EXPLAIN = "解释" TRANSLATE B_WHYASK = "为什么要求?" TRANSLATE B_RESTART = "再开始" TRANSLATE B_RETURN = "回归" REM Message text TRANSLATE TR_KB = "知识库:" TRANSLATE TR_NORESP = "我不知道也宁可不回答" TRANSLATE TR_HOWCONF = "多么确信您感觉关于您的反应?" TRANSLATE TR_LOWCONF = "非常不定(50%)" TRANSLATE TR_HICONF = "非常确定(100%)" TRANSLATE TR_YES = "是" TRANSLATE TR_NO = "否" TRANSLATE TR_FALSE = "错误" TRANSLATE TR_RESULTS = "决赛成绩:" TRANSLATE TR_MINCF = "接受的价值极小的置信因数作为事实:" TRANSLATE TR_NOTDETERMINED = "不能是坚定的" TRANSLATE TR_ISRESULT = "is:" TRANSLATE TR_WITH = "with" TRANSLATE TR_CONF = "% confidence" TRANSLATE TR_ALLGOALS = "所有结论" TRANSLATE TR_VALUE = "Value" TRANSLATE TR_OF = "of" TRANSLATE TR_THISRULE = "Rule below fired at CF=" TRANSLATE TR_RULEASGN = "and assigned the value" TRANSLATE TR_TOFIND = "To find" TRANSLATE TR_AVALUE = "a value for" TRANSLATE TR_ISNEEDED = "is needed to try this rule:" TRANSLATE TR_RULE = "RULE:" TRANSLATE TR_IF = "IF:" TRANSLATE TR_THEN = "THEN:" TRANSLATE TR_AND = "and" TRANSLATE TR_OR = "or" TRANSLATE TR_EQUAL = "is" TRANSLATE TR_LESSTHAN = "is less than" TRANSLATE TR_GREATER = "is greater than" TRANSLATE TR_NOTEQUAL = "is not" TRANSLATE TR_VALUEFOR = "A value for:" TRANSLATE TR_FOUND = "has been determined" TRANSLATE TR_NOTFOUND = "has not yet been determined" TRANSLATE TR_WASINPUT = "was input with " TRANSLATE TR_DETERMINED = "Determined" TRANSLATE TR_IS = "is" TRANSLATE TR_FROM = "from:" TRANSLATE TR_DEFAULTED = "was set by default with" REM following added in v3.03 TRANSLATE TR_ONE = "one of the values of" TRANSLATE TR_HOWCF1 = "Multi-source confidence calculation for" |
Demonstration and example knowledge base: Weather wizard (Cyrillic version)
| Example HTML to incorporate the Cyrillic Weather knowledge base in a Web page |
|---|
|
<APPLET CODE="e2g.class" archive="e2gSwing.jar" WIDTH=500 HEIGHT=300>
<PARAM NAME="KBURL" VALUE="weatherRu.kb"> <PARAM NAME="APPTITLE" VALUE="Демонстрация погоды"> <PARAM NAME="APPSUBTITLE" VALUE="чудодеем погоды"> <PARAM NAME="PROMPTCOLOR" VALUE="#000000"> <PARAM NAME="BGCOLOR" VALUE="#00ff00"> <PARAM NAME="DEBUG" VALUE="false"> <PARAM NAME="WORDWRAP" VALUE="true"> <PARAM NAME="PROMPTSIZE" VALUE="12"> <PARAM NAME="KBENCODING" VALUE="UTF-16"> <PARAM NAME="STARTBUTTON" VALUE="Порекомендуйте чего нести"> Java is required to view this page! </APPLET> |
| Example e2gSwing Knowledge Base: Cyrillic version of the Weather Demonstration |
|---|
REM Test Knowledge Base (weatherRu.kb) Cyrillic: MUST BE SAVED AS A UNICODE FILE! RULE [Оно идет идти дождь?] If [высыпание] = "предположено" and [предпологаемая температура] > 32 Then [рекомендация] = "несите плащ" RULE [Оно идет идти снег?] If [высыпание] = "предположено" and [предпологаемая температура] < 33 Then [рекомендация] = "несите ваши ботинки" @ 95 PROMPT [высыпание] MultChoice CF "Согласно прогнозу погоды, высыпание является следующим:" "предположено" "не предположено" PROMPT [предпологаемая температура] Numeric CF "Предпологаемая температура дневного времени (градусы Fahrenheit) является следующим:" "-30" "120" GOAL [рекомендация] DEFAULT [рекомендация] = "несите все, что угодно вы хотите к" @ 90 REM Translation table for e2gSwing output: only partially translated with Babel Fish (babelfish.yahoo.com) REM Button text TRANSLATE B_SUBMIT = "Представьте вашу реакцию" TRANSLATE B_EXPLAIN = "Объясните" TRANSLATE B_WHYASK = "Почему спросите?" TRANSLATE B_RESTART = "Рестарт" TRANSLATE B_RETURN = "Возвращение" REM Message text TRANSLATE TR_KB = "Knowledge base:" TRANSLATE TR_NORESP = "Я не знаю/довольно не ответил бы" TRANSLATE TR_HOWCONF = "Как уверенно вы чувствуете о вашей реакции?" TRANSLATE TR_LOWCONF = "Очень неуверено (50%)" TRANSLATE TR_HICONF = "Очень уверено (100%)" TRANSLATE TR_YES = "yes" TRANSLATE TR_NO = "no" TRANSLATE TR_FALSE = "false" TRANSLATE TR_RESULTS = "FINAL RESULTS:" TRANSLATE TR_MINCF = "Minimum confidence factor for accepting a value as a fact:" TRANSLATE TR_NOTDETERMINED = "could not be determined" TRANSLATE TR_ISRESULT = "is:" TRANSLATE TR_WITH = "with" TRANSLATE TR_CONF = "% confidence" TRANSLATE TR_ALLGOALS = "все заключения" TRANSLATE TR_VALUE = "Value" TRANSLATE TR_OF = "of" TRANSLATE TR_THISRULE = "Rule below fired at CF=" TRANSLATE TR_RULEASGN = "and assigned the value" TRANSLATE TR_TOFIND = "To find" TRANSLATE TR_AVALUE = "a value for" TRANSLATE TR_ISNEEDED = "is needed to try this rule:" TRANSLATE TR_RULE = "RULE:" TRANSLATE TR_IF = "IF:" TRANSLATE TR_THEN = "THEN:" TRANSLATE TR_AND = "and" TRANSLATE TR_OR = "or" TRANSLATE TR_EQUAL = "is" TRANSLATE TR_LESSTHAN = "is less than" TRANSLATE TR_GREATER = "is greater than" TRANSLATE TR_NOTEQUAL = "is not" TRANSLATE TR_VALUEFOR = "A value for:" TRANSLATE TR_FOUND = "has been determined" TRANSLATE TR_NOTFOUND = "has not yet been determined" TRANSLATE TR_WASINPUT = "was input with " TRANSLATE TR_DETERMINED = "Determined" TRANSLATE TR_IS = "is" TRANSLATE TR_FROM = "from:" TRANSLATE TR_DEFAULTED = "was set by default with" REM following added in v3.03 TRANSLATE TR_ONE = "one of the values of" TRANSLATE TR_HOWCF1 = "Multi-source confidence calculation for" |
| Text Customizeable with TRANSLATE Commands | ||
|---|---|---|
REM Button text TRANSLATE B_SUBMIT = "Submit your response" TRANSLATE B_EXPLAIN = "Explain" TRANSLATE B_WHYASK = "Why ask?" TRANSLATE B_RESTART = "Restart" TRANSLATE B_RETURN = "Return" REM Message text TRANSLATE TR_KB = "Knowledge base:" TRANSLATE TR_NORESP = "I don't know/would rather not answer" TRANSLATE TR_HOWCONF = "How confident do you feel about your response?" TRANSLATE TR_LOWCONF = "Very uncertain (50%)" TRANSLATE TR_HICONF = "Very certain (100%)" TRANSLATE TR_YES = "yes" TRANSLATE TR_NO = "no" TRANSLATE TR_FALSE = "false" TRANSLATE TR_RESULTS = "FINAL RESULTS:" TRANSLATE TR_MINCF = "Minimum confidence factor for accepting a value as a fact:" TRANSLATE TR_NOTDETERMINED = "could not be determined" TRANSLATE TR_ISRESULT = "is:" TRANSLATE TR_WITH = "with" TRANSLATE TR_CONF = "% confidence" TRANSLATE TR_ALLGOALS = "all conclusions" TRANSLATE TR_VALUE = "Value" TRANSLATE TR_OF = "of" TRANSLATE TR_THISRULE = "Rule below fired at CF=" TRANSLATE TR_RULEASGN = "and assigned the value" TRANSLATE TR_TOFIND = "To find" TRANSLATE TR_AVALUE = "a value for" TRANSLATE TR_ISNEEDED = "is needed to try this rule:" TRANSLATE TR_RULE = "RULE:" TRANSLATE TR_IF = "IF:" TRANSLATE TR_THEN = "THEN:" TRANSLATE TR_AND = "and" TRANSLATE TR_OR = "or" TRANSLATE TR_EQUAL = "is" TRANSLATE TR_LESSTHAN = "is less than" TRANSLATE TR_GREATER = "is greater than" TRANSLATE TR_NOTEQUAL = "is not" TRANSLATE TR_VALUEFOR = "A value for:" TRANSLATE TR_FOUND = "has been determined" TRANSLATE TR_NOTFOUND = "has not yet been determined" TRANSLATE TR_WASINPUT = "was input with " TRANSLATE TR_DETERMINED = "Determined" TRANSLATE TR_IS = "is" TRANSLATE TR_FROM = "from:" TRANSLATE TR_DEFAULTED = "was set by default with" REM following added in v3.03 TRANSLATE TR_ONE = "one of the values of" TRANSLATE TR_HOWCF1 = "Multi-source confidence calculation for" | ||
|
e2gSwing software and demonstration knowledge base downloads
![]() |
Purpose of e2gSwing and disclaimers: This software has been developed and is being distributed for educational and experimental purposes. It is a work in progress, and will continue to be a development prototype for some time to come. No claims are made for its serviceability, and eXpertise2Go.com assumes no responsibility for financial or other harm that occurs due to the use of e2gSwing or knowledge bases developed to work with e2gSwing or due to decisions made based on use of e2gSwing or its knowledge bases. While reasonable effort is being expended in the ongoing effort to test and debug the program, when you download and use the e2gSwing software you become an informal member of the test team! |
![]() |
You may not sell e2gSwing: e2gSwing is free software: eXpertise2Go.com isn’t selling it, so you can’t either. It is OK to incorporate e2gSwing into Web sites you develop for compensation, but your client must understand that the e2gSwing Java applet is not part of what they are paying for. |
![]() |
Knowledge bases delivered by e2gSwing are not confidential: Knowledge bases used with e2gSwing are text files that may be examined in a browser or with a text editor by anyone with access to the Web site from which they are delivered. Implementing a knowledge base with this software implies your willingness to make the knowledge public – you are publishing the expertise as you might in an article. In this regard, you may (and are encouraged to) modify and extend the sample e2gSwing knowledge bases included on this Web site. |
![]() |
Re-engineering/reverse engineering e2gSwing is prohibited: You agree that you will not de-compile and/or modify the e2gSwing applet. This prohibition explicitly includes modifying or removing the eXpertise2Go.com logo displayed on the opening screen. The motivation for distributing e2gSwing is to attract visitors to the eXpertise2Go.com Web site in hopes of increasing public awareness of expert systems and expanding mass-market usage of the technology, so displaying the logo is important. |
![]() |
Redistribution of e2gSwing is allowed: You may redistribute copies of the e2gSwing applet if you make recipients aware of these conditions of use and don’t charge for the redistribution. New versions of the applet will be created on a continuing basis to correct errors or include new capabilities, so you should check the version number displayed on the opening screen from time to time to keep the version you are redistributing current. |
![]() |
Use of e2gSwing on commercial Web sites is allowed: Subject to the above conditions, it is OK to incorporate the e2gSwing applet and sample knowledge bases in for-profit Web sites. |
| e2gSwing Downloads |
|---|
| I agree to the conditions of use -- Download e2gSwing.jar |
| Download the weather knowledge base (English version) (RIGHT CLICK ON LINK THEN USE SAVE ITEM ON MENU) |
| Download the weather.htm file (English version) (RIGHT CLICK ON LINK THEN USE SAVE ITEM ON MENU) |
| Download the weather knowledge base (Simplified Chinese version) (RIGHT CLICK ON LINK THEN USE SAVE ITEM ON MENU) |
| Download the weatherCh.htm file (Simplified Chinese version) (RIGHT CLICK ON LINK THEN USE SAVE ITEM ON MENU) |
| Download the weather knowledge base (Cyrillic version) (RIGHT CLICK ON LINK THEN USE SAVE ITEM ON MENU) |
| Download the weatherRu.htm file (Cyrillic version) (RIGHT CLICK ON LINK THEN USE SAVE ITEM ON MENU) |
| Download the swingdemo.htm file (RIGHT CLICK ON LINK THEN USE SAVE ITEM ON MENU) |
If you click the knowledge base (.kb) or Web page source (.htm) links with the left mouse button, a text file listing or Web page may open. To avoid this, click on the link with the right mouse button, then look for the entry on the menu that will appear that allows you to save the target file.