ÿþ<HTML> <HEAD> <META NAME="keywords" CONTENT="expert system,free expert system,expert system shell,expert system building tool,free expert system software, rule-based expert system,inference engine,knowledge bases,free Java applet, expert system tutorials,expert system training,e2gRuleEngine expert system shell"> <META NAME="description" CONTENT="A mini-course introducing the free e2gRuleEngine expert system building tool (expert system shell) implemented as a Java applet. e2gRuleEngine permits rule-based expert systems to be embedded in a Web page."> <TITLE>e2gRuleEngine/e2gDroid Free Expert System Shell - Reference</TITLE> </HEAD> <BODY BGCOLOR="#ffffff"> <TABLE CELLSPACING=0 BORDER=0 BGCOLOR="#ffee33" WIDTH="100%"> <TR><TD><IMG SRC="/e2g3g/images/e2gwide2.gif"></TD> <TD>&nbsp;&nbsp;</TD> <TD VALIGN=Center ALIGN=Left><script type="text/javascript"><!-- google_ad_client = "pub-0414996037110743"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel = ""; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></TD></TR></TABLE> <FONT FACE="Arial,Helvetica" SIZE=2>[<A HREF="/e2g3g/">Home: Demos and Tutorials</A>][<A HREF="default.htm">e2gRuleEngine Mini-Course Index</A>] </FONT> <P><!--Reference--> <CENTER><FONT FACE="Arial,Helvetica" SIZE=3><B>Building and Using Expert Systems: a Mini-Course Introducing the e2gRuleEngine/e2gDroid Expert System Shells and e2gRuleWriter Decision Table Software</B></FONT></CENTER> <P><FONT FACE="Arial,Helvetica" SIZE=3><B>Reference: e2gRuleEngine/e2gDroid commands and error messages.</B> </FONT> <FONT FACE="Arial,Helvetica" SIZE=3> <P><B>Reference Index</B> <UL> <LI><A HREF="#APPHTML">Example HTML to incorporate the e2gRuleEngine applet in a Web page</A> <LI><A HREF="#PARAMETERS">e2gRuleEngine applet parameters</A> <LI><A HREF="#BUTTONCODES">e2gRuleEngine button codes passed to JavaScript <LI><A HREF="#PUBLICMETHODS">e2gRuleEngine public methods accessible from JavaScript <LI><A HREF="#KBASEEX">Example knowledge base</A> <LI><A HREF="#KBASEFMT">Knowledge base format</A> <LI><A HREF="#RELOP">Relational operators</A> <LI><A HREF="#MATHOP">Mathematical operators</A> <LI><A HREF="#CFPROC">Certainty Factor (CF) processing</A> <LI><A HREF="#TRANSLATE">Text Customizeable with TRANSLATE Commands</A> <LI><A HREF="#ERRCODES">Error codes</A> <LI><A HREF="#TRACE">Knowledge base trace output</A> <LI><A HREF="#ANALYSIS">Knowledge base analysis output</A> <LI><A HREF="#DUMP">Knowledge base dump output</A> </UL> <P> </FONT> <P><!--Example HTML to Load Applet--> <A NAME="APPHTML"></A> <TABLE ALIGN='CENTER' BORDER='1'> <TR><TH COLSPAN=2 bgcolor="#ffee33" ><FONT FACE="Arial,Helvetica" SIZE=3>HTML to incorporate the e2gRuleEngine Applet in a Web page</TH></TR> <TR><TD COLSPAN=2><PRE> &lt;APPLET CODE="e2gRuleEngine.class" ARCHIVE="e2gRuleEngine.jar" NAME="e2g" WIDTH=450 HEIGHT=300> &lt;PARAM NAME="KBURL" VALUE="auto.kb"> (optional &lt;PARAM> tags) . . . Java capable browser required! &lt;/APPLET> </TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>If the e2gRuleEngine.jar file is not located in the same subdirectory as the HTML document that declares the applet, the ARCHIVE parameter must provide a path to the file. <LI>The NAME parameter is only included when e2gRuleEngine will call a JavaScript function. See the JSFUNCTION parameter below. </OL> </TD></TR> </TABLE> <P><!--Parameters--> <A NAME="PARAMETERS"></A> <TABLE ALIGN='CENTER' BORDER='1'> <TR><TH bgcolor="#ffee33" COLSPAN=4><FONT FACE="Arial,Helvetica" SIZE=3>e2gRuleEngine Applet Parameters</FONT></TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Name</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Values</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Default</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Examples</TH></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>KBURL</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Knowledge base name, path from directory containing document that loaded applet or complete URL locating the KB (see Notes 2,3,4)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>No default: required parameter</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="KBURL" VALUE="auto.kb"><BR>(KB is in same directory as HTML document)<BR>&lt;PARAM NAME="KBURL" VALUE="/kb/auto.kb"><BR>(file is in kb subdirectory below directory containing HTML document)<BR>&lt;PARAM&nbsp;NAME="KBURL"&nbsp;VALUE="http://www.mysite.com/kb/auto.kb"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>APPTITLE</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Any character string: 1st line of title on start screen</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Blank</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="APPTITLE" VALUE="Auto Diagnosis"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>APPSUBTITLE</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Any character string: 2nd line of title on start screen</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Blank</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="APPSUBTITLE" VALUE="by Ace Auto Repair"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>BGCOLOR</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Applet background color specified as hex RGB color as used in HTML</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>#FFFF00 (yellow)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="BGCOLOR" VALUE="#00FF00"> (green)<BR>&lt;PARAM NAME="BGCOLOR" VALUE="#0000FF"> (blue)</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>TITLECOLOR</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>APPTITLE and APPSUBTITLE text color specified as hex RGB color as used in HTML</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>#0000FF (blue)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="TITLECOLOR" VALUE="#FFFFFF"> (white)</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>PROMPTCOLOR</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>PROMPT text color specified as hex RGB color as used in HTML</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>#000000 (black)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="PROMPTCOLOR" VALUE="#FFFFFF"> (white)</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>PROMPTSIZE</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>PROMPT text size (suggested values 8 to 20)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Approximately 10</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="PROMPTSIZE" VALUE="15"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>DEBUG</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>If TRUE, debug window is created when KB is started</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>FALSE</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="DEBUG" VALUE="TRUE"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>STARTBUTTON</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Text on button that starts consultation</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>"Start the consultation"</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="STARTBUTTON" VALUE="Help me!"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>PROMPTFIRST</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>If TRUE use PROMPT for an attribute before backward chaining</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>FALSE</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="PROMPTFIRST" VALUE="true"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>JSFUNCTION</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Provides the name of a JavaScript function to be called each time an e2gRuleEngine button is clicked</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>null (no function is called)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="JSFUNCTION" VALUE="buttonPush"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>KBENCODING</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Defines knowledge base (.kb) file encoding (see Note 6)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>US-ASCII</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="KBENCODING" VALUE="UTF-16"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>HYPERENCODING</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Forced value of linked HTML character encoding for HYPERLINK (v7.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>determined by software</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="HYPERENCODING" VALUE="UTF-16"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>WORDWRAP</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Wrap output lines, breaking between words, in the debug window</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>TRUE</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="WORDWRAP" VALUE="TRUE"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>DIALOGFONT</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Name of the font used to display prompts and button text</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Arial Unicode MS</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="DIALOGFONT" VALUE="Segoe UI"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>MONOFONT</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Name of the monospaced font used to display how, why, conclusions and debug outputs</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Monospaced</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="MONOFONT" VALUE="Courier New"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>NOLOGO</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>If TRUE, suppress display of the eXpertise2Go.com logo on prompt screens</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>FALSE</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="NOLOGO" VALUE="TRUE"></TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2>DISCLAIMER</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Statement to accept before knowledge base can be accessed. Exit if disclaimer not accepted. (v8.0+). Simple HTML tags may be used in the text.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>No disclaimer</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>&lt;PARAM NAME="DISCLAIMER" VALUE="&lt;html>&lt;b>For experimental use only&lt;/b>&lt;/html>"></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD COLSPAN=3><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>e2gRuleEngine PARAM VALUEs are not case sensitive unless they represent file names for an operating system that treats file names as case sensitive (Unix variants). <LI>KBURL is the only required parameter. <LI>If the KBURL value does not start with http://, the value will be appended to the directory containing the HTML file that loaded the e2gRuleEngine applet. <LI>The knowledge base <I>must</I> be loaded from the same Web site as the applet archive (e2gRuleEngine.jar). This is a security requirement of Java applets. <LI>When the JSFUNCTION parameter is used, the NAME parameter must be included in the &lt;applet> tag. <LI>When the knowledge base (.kb) file is stored in Unicode, the KBENCODING parameter must be included and will usually have the value UTF-16. <b>Beginning with v8.00, e2gRuleEngine will determine the encoding if standard byte order markers (BOM) are included at the beginning of the file, so the parameter is no longer required</b>. For non-Unicode .kb files the KBENCODING parameter is never required. The HYPERENCODING parameter is similarly not usually required as e2gRuleEngine will use the BOM to decide how to load the file. If a .kb or .htm/.html file can be loaded by Microsoft Notepad, it should be read correctly by e2gRuleEngine/e2gDroid. <LI>For compatibility with the Android version of the expert system shell, beginning with v8.00 the following applet parameters may be included in the knowledge base instead of (or in addition to) between applet tags: APPTITLE, DISCLAIMER, BGCOLOR, PROMPTCOLOR, TITLECOLOR and PROMPTSIZE. See the <a href="#KBASEFMT">Knowledge Base Format</a> section of this reference for more details. For knowledge bases to be used with both the e2gRuleEngine applet and e2gDroid Android app, the PROMPTSIZE parameter is best avoided because of incompatibilities in text size interpretation between the two programs. Note that parameters specified in the knowledge base are not available when the Web page loading the applet is first displayed and the knowledge base has not yet been loaded. </OL> </TD></TR> </TABLE> <p><!--e2gRuleEngine button codes--> <a name="BUTTONCODES"></a> <table align='center' border='1'> <tr><th bgcolor="#ffee33" colspan='3'><font face='Arial,Helvetica' size='3'>Button Codes Provided by e2gRuleEngine for use with the JavaScript interface</font></th></tr> <tr><th><font face='Arial,Helvetica' size='2'>Button Clicked</font></th><th><font face='Arial,Helvetica' size='2'>Value</font></th></tr> <tr><td><font face='Arial,Helvetica' size='2'>Initialization (before startup screen - no button action)</font></td><td align='center'><font face='Arial,Helvetica' size='2'>0</font></td></tr> <tr><td><font face='Arial,Helvetica' size='2'>Start the consultation *</font></td><td align='center'><font face='Arial,Helvetica' size='2'>1</font></td></tr> <tr><td><font face='Arial,Helvetica' size='2'>Submit your response</font></td><td align='center'><font face='Arial,Helvetica' size='2'>2</font></td></tr> <tr><td><font face='Arial,Helvetica' size='2'>Why Ask?</font></td><td align='center'><font face='Arial,Helvetica' size='2'>3</font></td></tr> <tr><td><font face='Arial,Helvetica' size='2'>Return (from Why Ask?)</font></td><td align='center'><font face='Arial,Helvetica' size='2'>4</font></td></tr> <tr><td><font face='Arial,Helvetica' size='2'>Explain</font></td><td align='center'><font face='Arial,Helvetica' size='2'>5</font></td></tr> <tr><td><font face='Arial,Helvetica' size='2'>Restart</font></td><td align='center'><font face='Arial,Helvetica' size='2'>6</font></td></tr> <tr><td><font face='Arial,Helvetica' size='2'>JSHyperlink clicked (v7.0+)</font></td><td align='center'><font face='Arial,Helvetica' size='2'>9</font></td></tr> <tr><td colspan=2><font face='Arial,Helvetica' size='2'>* May be renamed by the STARTBUTTON applet parameter.<br>Other buttons may be renamed by knowledge base TRANSLATE commands.</font></td></tr> </table> <p><!--e2gRuleEngine public methods--> <a name="PUBLICMETHODS"></a> <table align='center' border='1'> <tr><th colspan='3' bgcolor="#ffee33" ><font face='Arial,Helvetica' size='3'>e2gRuleEngine Methods Accessible from JavaScript</font></th></tr> <tr><th><font face='Arial,Helvetica' size='2'>Method Name</font></th><th><font face='Arial,Helvetica' size='2'>Value Returned and Value Type</font></th><th><font face='Arial,Helvetica' size='2'>Arguments and Argument Types</font></th></tr> <tr><td><font face='Times' size='2'>getAttrCF(attrIx)</font></td><td><font face='Arial,Helvetica' size='2'>(Float) Confidence factor associated with specific instance of named attribute (0.0 if doesn't exist or net yet determined)</font></td><td><font face='Times' size='2'>(Integer) attrIx: index of attribute (between 1 and number of attributes)</font></td></tr> <tr><td><font face='Times' size='2'>getAttrCF(attrName, valIx)</font></td><td><font face='Arial,Helvetica' size='2'>(Float) Confidence factor associated with specific instance of named attribute (0.0 if doesn't exist or net yet determined)</font></td><td><font face='Times' size='2'>(String) attrName: name of attribute<br>(Integer) valIx: instance (between 1 and max values) of named attribute to allow for multi-valued attributes</font></td></tr> <tr><td><font face='Times' size='2'>getAttrCount( )</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) Number of attributes defined in the knowledge base</font></td><font size='2'></font></td></tr> <tr><td><font face='Times' size='2'>getAttrIx(attrName, valIx)</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) Index of attribute associated with specific instance of named attribute (0 if doesn't exist)</font></td><td><font face='Times' size='2'>(String) attrName: name of attribute<br>(Integer) valIx: instance (between 1 and max values) of named attribute to allow for multi-valued attributes</font></td></tr> <tr><td><font face='Times' size='2'>getAttrName(attrIx)</font></td><td><font face='Arial,Helvetica' size='2'>(String) Name of attribute (zero length string if doesn't exist)</font></td><td><font face='Times' size='2'>(Integer) attrIx: index of attribute</font></td></tr> <tr><td><font face='Times' size='2'>getAttrValue(attrIx)</font></td><td><font face='Arial,Helvetica' size='2'>(String) String representation of current value (0 length string if doesn't exist or not yet determined)</font></td><td><font face='Times' size='2'>(Integer) attrIx: index of attribute</font></td></tr> <tr><td><font face='Times' size='2'><nobr>getAttrValue(attrName, valIx)</nobr></font></td><td><font face='Arial,Helvetica' size='2'>(String) String representation of current value (0 length string if doesn't exist or not yet determined)</font></td><td><font face='Times' size='2'>(String) attrName: name of attribute<br>(Integer) valIx: instance (between 1 and max values) of named attribute to allow for multi-valued attributes<font size='2'></font></td></tr> <tr><td><font face='Times' size='2'>getMaxValues(attrName)</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) Number of values (instances) allowed for named attribute (0 if doesn't exist)</font></td><td><font face='Times' size='2'>(String) attrName: name of attribute</font></td></tr> <tr><td><font face='Times' size='2'>getGoalAttr( )</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) Index of current goal or subgoal attribute (0 if inferencing is finished)</font></td><td><font face='Times' size='2'></font></td></tr> <tr><td><font face='Times' size='2'>loadValue(attrName,&nbsp;attrValue,&nbsp;attrCF)</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) 0 if attribute value loaded successfully, -1 if attribute not found in KB</font></td><td><font face='Times' size='2'>(String) attrName: name of attribute to load as if from PROMPT<br>(String) attrValue: value to load (always input as text string: e2gRuleEngine converts if necessary)<br>(Float) attrCF: CF to set for loaded attribute</font></td></tr> <tr><td><font face='Times' size='2'>restartE2g(KBUrl, bypassResults)</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) 0 for OK</font></td><td><font face='Times' size='2'>(String) KBUrl: URL of knowledge base to load<br>(Boolean) bypassResults: if true, bypass display of current consultation results</font></td></tr> <tr><td><font face='Times' size='2'>resetColors(strBColor, strPColor)</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) 0 for OK</font></td><td><font face='Times' size='2'>(String) strBColor: new background color (#rrggbb)<br>(String) strPColor: new prompt text color (#rrggbb)</font></td></tr> <tr><td><font face='Times' size='2'>setAppTitle(appTitle)</font></td><td><font face='Arial,Helvetica' size='2'>(Integer) 0 for OK</font></td><td><font face='Times' size='2'>(String) appTitle: new application title</font></td></tr> <tr><td colspan='3'><font face='Arial,Helvetica' size='2'>Note 1: e2gRuleEngine attributes are identified with a name and index number that begins at 1. Every attribute value has a unique index, but all values of multivalued attributes are stored with the same name. <br>Note 2: A value for an attribute will not be returned until the value is known with a confidence factor at least equal to the minimum CF. <br>Note 3: loadValue(), restartE2g(), resetColors() and setAppTitle() are mutators provided to support applications that switch knowledge bases during a consultation. <br>Note 4: loadValue() may be called more than once with the same attrName if attribute is multivalued. </font> </td></tr> </table> <P><!--Knowledge Base Example--> <A NAME="KBASEEX"></A> <TABLE ALIGN='CENTER' BORDER='1'> <TR><TH bgcolor="#ffee33" ><FONT FACE="Arial,Helvetica" SIZE=3>Example e2gRuleEngine/e2gDroid Knowledge Base</TH></TR> <TR><TD> <PRE> REM Test knowledge base RULE [Is the battery dead?] If [the result of switching on the headlights] = "nothing happens" or [the result of trying the starter] = "nothing happens" Then [the recommended action] = "recharge or replace the battery" RULE [Is the car out of gas?] If [the gas tank] = "empty" Then [the recommended action] = "refuel the car" RULE [Is the battery weak?] If [the result of trying the starter] : "the car cranks slowly" "the car cranks normally" and [the headlights dim when trying the starter] = true and [the amount you are willing to spend on repairs] > 24.99 Then [the recommended action] = "recharge or replace the battery" RULE [Is the car flooded?] If [the result of trying the starter] = "the car cranks normally" and [a gas smell] = "present when trying the starter" Then [the recommended action] = "wait 10 minutes, then restart flooded car" RULE [Is the gas tank empty?] If [the result of trying the starter] = "the car cranks normally" and [a gas smell] = "not present when trying the starter" Then [the gas tank] = "empty" @ 90 PROMPT [the result of trying the starter] Choice CF "What happens when you turn the key to try to start the car?" "the car cranks normally" "the car cranks slowly" "nothing happens" PROMPT [a gas smell] MultChoice CF "The smell of gasoline is:" "present when trying the starter" "not present when trying the starter" PROMPT [the result of switching on the headlights] MultChoice CF "The result of switching on the headlights is:" "they light up" "nothing happens" PROMPT [the headlights dim when trying the starter] YesNo CF "Do the headlights dim when you try the starter with the lights on?" PROMPT [the gas tank] MultChoice CF "According to the fuel gauge, the gas tank is:" "empty" "not empty" PROMPT [the amount you are willing to spend on repairs] Numeric CF "How much are you willing to spend on repairs? (enter value 0->500)" "0" "500.0" GOAL [the recommended action] MINCF 80 </PRE> </TD></TR></TABLE> <P><!--Knowledge Base Format--> <A NAME="KBASEFMT"></A> <TABLE BORDER=1> <TR><TH bgcolor="#ffee33" COLSPAN=3><FONT FACE="Arial,Helvetica" SIZE=3>e2gRuleEngine/e2gDroid Knowledge Base Format</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Command</TH><TH WIDTH="35%"><FONT FACE="Arial,Helvetica" SIZE=2>Description</TH><TH><FONT FACE="Arial,Helvetica" SIZE=2>Examples</TH></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>REM</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Comment line</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>REM Diagnose why an automobile won't start</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>RULE</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Begins a rule: followed by rule description in square brackets</TD> <TD ROWSPAN=3><FONT FACE="Arial,Helvetica" SIZE=2>RULE [Is the battery dead?] <BR>If [the result of switching on the headlights] = "nothing happens" or <BR>[the result of trying the starter] = "nothing happens" <BR>Then [the problem] = "the battery is discharged or dead" @ 90 and <BR>[the recommended action] = "recharge or replace the battery" <BR> <BR>RULE [calculate overtime hours] <BR>If [the number of hours worked] > 40 <BR>Then [the overtime hours] = {[the number of hours worked] - 40}</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>&nbsp;&nbsp;&nbsp;If</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Begins rule premise: followed by first premise clause (attribute name in square brackets + relational operator + comparison quantity), optional logical operator <I>and/or</I> (if there is another premise clause: <i>and/or</i> may <i>not</i> be mixed in the same rule)</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>&nbsp;&nbsp;&nbsp;Then</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Begins rule consequent: followed by first consequent clause (attribute name in square brackets + = + value + optional confidence/certainty factor: <I>@ xxx</I> where xxx represents a percentage and defaults to 100), optional <I>and</I> (required if there is another consequent clause) <BR><BR>In v6.0+, a numeric expression, enclosed by curly braces (<b>{ }</b>) may be used on the right side of the equal sign in a rule consequent. In v8.0+ a function to count the number of concluded values of a multivalued attribute is available. See <a href="e2gMod7.htm#EVAL">Module 7's Performing numerical calculations in rule consequents</a> for details.</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>PROMPT</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Defines format of user request for an attribute's value if the inference engine is allowed to request it. <BR><BR>Prompt types: <BR>&nbsp;&nbsp;YesNo (radio button true/false (Boolean) input) <BR>&nbsp;&nbsp;MultChoice (text string radio button input) <BR>&nbsp;&nbsp;ForcedChoice (same as MultChoice without the "I don't know..." option) <BR>&nbsp;&nbsp;Choice (text string drop-down list input/Android spinner input) <BR>&nbsp;&nbsp;AllChoice (text string check box multiple inputs: See MAXVALS) <BR>&nbsp;&nbsp;Numeric (range-checked numeric input) <BR>&nbsp;&nbsp;Text (unrestricted direct text input -- available in v8.0+) <BR><BR>ELIM parameter (used with MultChoice, ForcedChoice, Choice, AllChoice) eliminates all choices from list for this prompt that have already been selected when a prompt was issued for the elimination attribute: <BR>ELIM [elimination attribute name] (insert between prompt type & optional CF in PROMPT -- see examples) v8.0+ <BR><BR>Optional CF parameter generates request for confidence factor input and may be used with any prompt type <BR><BR>Question to ask user is on the next line in single or double quotes. <BR><BR>Response choices (if required by the PROMPT) are on successive lines in quotes <BR><BR>For the Numeric PROMPT, the minimum and maximum acceptable values are on successive lines in quotes </TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>PROMPT [the stoplights work] YesNo CF <BR>"Do the stoplights light when you step on the brake?" <BR><BR>PROMPT [the gas tank] MultChoice CF <BR>"According to the fuel gauge, the gas tank is:" <BR>"empty" <BR>"not empty" <BR><BR>PROMPT [the gas tank] ForcedChoice CF <BR>"According to the fuel gauge, the gas tank is:" <BR>"empty" <BR>"not empty" <BR><BR>PROMPT [the result of trying the starter] Choice CF <BR>"What happens when you turn the key to try to start the car?" <BR>"the car cranks normally" <BR>"the car cranks slowly" <BR>"nothing happens" <BR><BR>PROMPT [an acceptable time to pick up your car] AllChoice CF <BR>"What time may we pick up your car? (Check up to three)" <BR>"7 - 9 AM" <BR>"9 AM -12 PM" <BR>"12 - 3 PM" <BR>"3 - 7 PM" <BR><BR>PROMPT [best pickup time] ForcedChoice <BR>"What time may we pick up your car? (Select best pickup time)" <BR>"7 - 9 AM" <BR>"9 AM -12 PM" <BR>"12 - 3 PM" <BR>"3 - 7 PM" <BR><BR>PROMPT [2nd best pickup time] ForcedChoice ELIM [best pickup time] <BR>"What time may we pick up your car? (Select 2nd best pickup time)" <BR>"7 - 9 AM" <BR>"9 AM -12 PM" <BR>"12 - 3 PM" <BR>"3 - 7 PM" <BR><BR>PROMPT [the amount you are willing to spend on repairs] Numeric CF <BR>"How much are you willing to spend on repairs? (enter value 0->500)" <BR>"0" <BR>"500.0" <BR><BR>PROMPT [auto id] Text <BR>"Enter identifying information for this vehicle" </TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>GOAL</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Finding a value (or values) for the goal variables is the objective of an expert system consultation. When all GOALs are resolved (or it is determined they cannot be resolved) the consultation ends. At least one GOAL is required.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>GOAL [the problem]</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>MINCF</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) The minimum confidence/certainty factor to accept a value as a fact. Default is 80.0</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>MINCF 70</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>MAXVALS</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) The maximum number of different values one attribute can have. Default is one. Equal sign optional (v8.0+) <B>Attributes with AllChoice PROMPTs should have a MAXVALS greater than one.</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>MAXVALS [an acceptable time to pick up your car] 3 <BR>MAXVALS [an acceptable time to pick up your car] = 3</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>DEFAULT</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Sets value of an attribute if the inference engine fails to determine its value from PROMPTs or RULEs. When a DEFAULT is provided for a multivalued attribute (MAXVALS > 1) the default is assigned to all unresolved values, but only one default value is shown in the results output.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>DEFAULT [the gas tank] = "not empty" <BR>DEFAULT [the stoplights work] = true <BR>DEFAULT [the amount you are willing to spend on repairs] = 50</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>FORMAT</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Defines format statements controlling display of numeric attribute values (V8.0+) <BR>[numeric attribute name] = "format specifier"</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>FORMAT [the amount of the requested loan] = "$%8.2f"</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>HYPERLINK</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Defines hyperlinked HTML file to be displayed when link clicked in final results (V7.0+) <BR>[attribute name for result] = "attribute value" "URL of HTML linked file"</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>HYPERLINK [the recommended action] = "recharge or replace the battery" "http://mysite/battery.htm"</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>INFOLINK</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Defines hyperlinked HTML file to be displayed when "?" button clicked on PROMPT screen. (V8.0+) <BR>[attribute name for prompt] "URL of HTML linked file"</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>INFOLINK [the stoplights work] "http://mysite/autofixinfo.htm#ELECTRICAL"</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>JSHYPERLINK</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Defines hyperlinked HTML file to be displayed by browser hosting the e2gRuleEngine applet (v7.0+, ignored by e2gDroid) <BR>[attribute name for result] = "attribute value" "parameters for JavaScript open.window() command"</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>JSHYPERLINK [the recommended action] = "recharge or replace the battery" <BR>"http://mysite/battery.htm;_new;height=300,width=400,scrollbars=yes" <BR>(Entire command must be on one line in knowledge base)</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>NOSHOW</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Prevents display in results of any attributes with undetermined values (V8.0+) <BR>NOSHOW</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>NOSHOW</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>NOSHOW</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Prevents display of results for specified attribute whether or not determined (V8.0+) <BR>NOSHOW [attribute name to restrict]</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>NOSHOW [auto id]</TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>PARAM</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Allows the following parameters to be included in the knowledge base instead of applet tags for e2gDroid compatibility: APPTITLE, DISCLAIMER, BGCOLOR, PROMPTCOLOR, TITLECOLOR and PROMPTSIZE (v8.0+) <BR>PARAM [parameter name] = "parameter value"</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2> <BR>PARAM [disclaimer] = 'For educational use only: click "Accept" to continue' <BR>PARAM [bgcolor] = "#99ccff" <BR>PARAM [titlecolor] = "#0000ff" </TD></TR> <TR><TD><FONT FACE="Arial,Helvetica" SIZE=2><B>TRANSLATE</B></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Optional) Customizes e2gRuleEngine text output. Also supports knowledge base translation to languages other than English. See <A HREF="#TRANSLATE">Text Customizeable with Translate Commands</A> for a list of text items that may be customized.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>TRANSLATE B_SUBMIT = "Soumettez votre réponse" <BR>TRANSLATE TR_YES = "Oui" <BR>TRANSLATE TR_RULE = "RÈGLE:"</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD COLSPAN=2><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>All RULEs must be defined before any other command (except REM) is used. An attribute must be named in a rule before it is used in any other command. <LI>Attribute names must be enclosed in delimiters: square brackets are preferred. <LI>Text strings representing attribute values must be enclosed in delimiters: matching single or double quotes are preferred. <LI>Commands, attribute names, and text values are not case-sensitive. <LI>Spaces within square brackets or quotes are significant. Spaces between other elements are not significant. <LI>Multiple rule premise clauses may be connected with <B>either</B> <I>And</I> or <I>Or</I> but <B>not both</B> in the same rule. <LI>If the "question to ask the user" on the second line of a PROMPT is lengthy, it will be word wrapped to display on multiple lines. The break will occur between words. Responses in e2gRuleEngine will be truncated to fit on a single line, and ended with ellipses (...) if truncation has been performed. Responses are word wrapped in e2gDroid. <LI>Attribute names and text strings must be delimited. The example convention is to delimit attribute names with square brackets and text strings with double quotes. However, any matched set of the three delimiter pairs (" ",' ', and [ ]) may be used to permit embedding delimiters in a text string as in 'For educational use only: click "Accept" to continue' <LI>When the ELIM parameter is used in a PROMPT, the order in which the prompts will be issued is important. Placing a rule that uses the attribute associated with the prompt that should be issued first in its premise ahead of any rule that uses the attribute associated with the prompt that should be issued last will accomplish this. Another technique is to name the attributes in GOAL statements: the last goal listed will be sought first. The NOSHOW [attribute name] statement could be used to suppress of the attribute values in results. <LI>HYPERLINKs and INFOLINKs must reference Web pages stored on the Web server from which e2gRuleEngine.jar was loaded. This is a JAVA applet security requirement, and does not apply to e2gDroid (the Android device version of the software). </OL> </TD></TR> </TABLE> <P><!--Relational Operators--> <A NAME="RELOP"></A> <TABLE BORDER=1> <TR><TH bgcolor="#ffee33" COLSPAN=4><FONT FACE="Arial,Helvetica" SIZE=3>e2gRuleEngine/e2gDroid Relational Operators</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Operator</TH> <TH WIDTH="20%"><FONT FACE="Arial,Helvetica" SIZE=2>Interpretation</TH> <TH WIDTH="30%"><FONT FACE="Arial,Helvetica" SIZE=2>Formatted Rule Translation</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Example <I>unformatted</I>&nbsp;/formatted premise clause output</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>=</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>equal to</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is<BR>(NOTE: With <I>true</I> Boolean attributes, the relational operator and comparison quantity is omitted from translation)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2> <I>[the result of trying the starter] = "nothing happens"</I> <BR>the result of trying the starter is nothing happens <BR><I>[the headlights dim when the starter cranks] = true</I> <BR>the headlights dim when the starter cranks <BR><I>[the headlights dim when the starter cranks] = false</I> <BR>the headlights dim when the starter cranks is false</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2><</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>strictly less than</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is less than</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the age of the battery in months] < 24</I><BR>the age of the battery in months is less than 24</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2><=</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>less than or equal to (v8.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is less than or equal to</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the age of the battery in months] <= 24</I><BR>the age of the battery in months is less than or equal to 24</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>></TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>strictly greater than</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is greater than</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the age of the battery in months] > 12</I><BR>the age of the battery in months is greater than 12</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>>=</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>greater than or equal to (v8.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is greater than or equal to</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the age of the battery in months] >= 12</I><BR>the age of the battery in months is greater than or equal to 12</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>!</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>not equal to</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is not</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the gas tank] ! "empty"</I><BR>the gas tank is not empty</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2><></TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>not equal to (v8.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is not</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the gas tank] <> "empty"</I><BR>the gas tank is not empty</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>!=</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>not equal to (v8.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>is not</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the gas tank] != "empty"</I><BR>the gas tank is not empty</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>any value equals any of<BR>(NOTE: use only with text string data)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>one of the values of...is <I>value</I>, <I>value</I>,... or <I>value</I></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the battery brand] : "Delco" "Mopar" "Interstate"</I><BR>one of the values of the battery brand is Delco, Mopar or Interstate</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>!:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>none of the values equals any of (v8.0+)<BR>(NOTE: use only with text string data)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>none of the values of...is <I>value</I>, <I>value</I>,... or <I>value</I></TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the battery brand] !: "Delco" "Mopar" "Interstate"</I><BR>none of the values of the battery brand is Delco, Mopar or Interstate</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>?</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>premise clause is true if the attribute's value has been determined (v6.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>has been determined</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2><I>[the battery brand] ?</I><BR>the battery brand has been determined</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD COLSPAN=3><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>One or more optional spaces may be included on either side of the relational operator, but spaces may not be embedded in a two character relational operator. <LI>The translated value of the relational operator should be considered when creating attribute names and values to improve rule readability. <LI>With the exception of <B>:</B> (equals any of), the value of a multivalued attribute with the highest CF is used to evaluate an expression. With the <I>equals any of</I> operator, the expression is considered <B>true</B> if any value of the attribute with a certainty factor equal to or greater than MINCF matches any value in the list of comparison quantities. <LI>A rule clause using the <B>:</B> operator evaluates as unknown until proven true or until all values of the attribute (if it is multivalued) have been resolved or failed. <B>The <B>:</B> relational operator should be used instead of <B>=</B> when the attribute is multivalued <U>even if there is only one comparison quantity</U>.</B> This prevents rules from firing as false before all values of the attribute have been determined. <LI>The <b>?</b> operator returns <i>true</i> if the attribute's value has been determined with a CF>=MINCF. The CF associated with the true premise clause is 100% if the value has been determined with any CF>=MINCF. This operator is provided to allow testing to make sure attributes used in mathematical expressions in the consequent have been resolved before the rule fires and the calculation is performed. </OL> </TD></TR> </TABLE> <P><!--Mathematical Operators--> <A NAME="MATHOP"></A> <p> <center> <table border='1' cellpadding='2'> <tr><th colspan='3' bgcolor='#ffee33'><FONT SIZE='3'>Mathematical Operator Precedence</font></th></tr> <tr bgcolor="lightgray"><th><font size='2'>Operator</font></th><th><font size='2'>Precedence</font></th><th><font size='2'>Operation</font></th></tr> <tr><th>^</th><td align='center'><font size='2'>3</font></td><td><font size='2'>Exponentiation</font></td></tr> <tr><th>*</th><td align='center'><font size='2'>2</font></td><td><font size='2'>Multiplication</font></td></tr> <tr><th>/</th><td align='center'><font size='2'>2</font></td><td><font size='2'>Division</font></td></tr> <tr><th>+</th><td align='center'><font size='2'>1</font></td><td><font size='2'>Addition</font></td></tr> <tr><th>-</th><td align='center'><font size='2'>1</font></td><td><font size='2'>Subtraction</font></td></tr> <tr><th>Notes</th> <td colspan='2'> <FONT SIZE='2'> <ol> <li>Numeric expressions are enclosed in braces (<b>{ }</b>) in rule consequents. These expressions may include names of numeric attributes, math operators and parentheses. <li>Mathematical operators are evaluated according to the precedence shown in this table. Highest precedence operations are performed first. If two operators have the same precedence, they are evaluated left to right. Parentheses and nested parentheses may be used to alter the order of the evaluation. <li>A <b>#</b> sign immediately preceding the left delimiter of of an attribute name represents the "number of values of" function. This function causes a count of the number of resolved values of the named attribute to replace the attribute name in the numeric expression. </ol> </font> </td></tr> </table> </center> <P><!--Certainty Factor Processing--> <A NAME="CFPROC"></A> <TABLE BORDER='1' cellpadding='3'> <TR><TH bgcolor="#ffee33" colspan='2'><FONT FACE="Arial,Helvetica" SIZE=3>Certainty/Confidence Factor (CF) Processing<br> <font size='2'>CF processing in e2gRuleEngine is generally consistent with the "Reasoning with uncertain data discussion (starting at frame 6)" in the <A HREF="/e2g3g/tutorials/inference/">Inference Methods and Uncertainty</A> tutorial.</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>The CF for each rule consequent is multiplied by the CF with which the rule's premise was proven. For example: <P>RULE [Is it going to snow?] <BR>If [precipitation] = "expected" and <BR>[the expected temperature] < 33 <BR>Then [the recommendation] = "wear your boots" @ 95 <P>If the premise is found to be true with a CF of 80%, then the recommendation will be assigned the value "wear your boots" with a CF of 80 x 95 = 76% <LI>When an attribute's value has been determined from multiple sources (prompt plus one or more rules or multiple rules) the calculation, performed using the probability sum method discussed in the <A HREF="/e2g3g/tutorials/inference/">Inference Methods and Uncertainty</A> tutorial, is displayed by the explanation mechanism. Assume "precipitation is expected" has been determined by two rules with CFs of 70% and 80%. The probability calculation will be presented in the following format: <P><B>Multi-source confidence calculation for precipitation is expected: 70% + 80% x (100% - 70%) = 94%</B> <P>If three sources concluded "precipitation is expected" with CFs of 70%, 80% and 50%, the following explanation would be provided: <P><B>Multi-source confidence calculation for precipitation is expected: 70% + 80% x (100% - 70%) = 94%: 94% + 50% x (100% - 94%) = 97%</B> <!-- <LI>Beginning with e2gRuleEngine v6.0, certainty factors in the range 0 to -100% (representing the degree of certainty in the <i>falsity</i> of an assertion) are processed differently than positive CFs in the probability calculation. Instead of basing the certainty modification on the remaining distance to +100%, when the update CF is negative, the certainty modification is based on the distance to -100%. <p>Assume an attribute has been concluded with two CFs of +80% and -20%. The CFs would be combined as follows: <p><b>Multi-source confidence calculation: 80% + -20% x (100% + 80%) = 44%</b> <p>In this example, the distance to the -100% CF boundary is 180%, and the new CF moves the certainty -20% of this distance from the starting value of +80%. --> </OL> </TD></TR> </TABLE> <P><!--Customizeable Text--> <A NAME="TRANSLATE"></A> <TABLE BORDER=1> <TR><TH bgcolor="#ffee33" ><FONT FACE="Arial,Helvetica" SIZE=3>Text Customizeable with TRANSLATE Commands</TH></TR> <TR><TD> <PRE> 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 Button/Dialog title text v8.0+ and Android additions TRANSLATE B_GOBACK = "Go Back" TRANSLATE B_EXIT = "Exit" TRANSLATE B_CANCEL = "Cancel" TRANSLATE B_ACCEPT = "Accept" TRANSLATE B_DISCLAIMER = "Disclaimer" TRANSLATE B_EXITCONFIRM = "Exit Confirmation" 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?" REM TR_LOWCONF and TR_HICONF are not translated in e2gDroid but are replaced with: CF 50% and 100% 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" TRANSLATE TR_ONE = "one of the values of" TRANSLATE TR_HOWCF1 = "Multi-source confidence calculation for" REM v7.0 addition: TRANSLATE TR_HYPERLINK = "Click underlined text to link to more information" REM v8.0 additions: TRANSLATE TR_GOBACK = 'Select PROMPT to reissue, then click "Go Back"' TRANSLATE TR_ALLELIM = "eliminated all responses, click submit" TRANSLATE TR_EXITOPTION = "Choose Exit to quit consultation or Cancel to continue" TRANSLATE TR_PROMPTREQUEST = "has been directly requested by a prompt" TRANSLATE TR_COUNT = "COUNT" TRANSLATE TR_PREVEXPLAIN="was previously explained" TRANSLATE TR_DETERMINED2 = "Determined one of the values of"; </PRE> </TD></TR> <TR><TD> <TABLE> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2><OL> <LI>The default value for each customizeable item is shown in the format of a TRANSLATE command for illustration only. Only those text strings that are to be changed from their default value should be redefined with TRANSLATE commands. To deliver a non-English version of a knowledge base, all items should be translated. An example in French is included in <A HREF="e2gmod8.htm">Module 8</A>. <LI>See also the STARTBUTTON <A HREF="#PARAMETERS">Applet Parameter</A>. <LI>Beginning with v8.0, misspelled or unrecognized TRANSLATE value names are ignored instead of generating an error. </OL> </TD></TR> </TABLE> </TD></TR> </TABLE> <P><!--Error Codes--> <A NAME="ERRCODES"></A> <TABLE BORDER=1> <TR><TH bgcolor="#ffee33" COLSPAN=3><FONT FACE="Arial,Helvetica" SIZE=3>e2gRuleEngine/e2gDroid Error Codes</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Error</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Meaning</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Comment</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>150</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Initialization error</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Internal error while trying to load KB</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>205</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Goal loop</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Circular logic in rules caused inferencing process to loop</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>210</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many GOAL statements</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded: can also result from circular logic leading to goal stack overflow</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>220</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>No GOAL statements</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>At least one goal is required</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>230</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many attributes</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded (600)</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>240</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many unknown attributes</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>250</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many RULEs</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded (approximately 500 depending on complexity)</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>260</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many RULE premise clauses</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>270</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many RULE consequent clauses</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>280</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Space for RULE data exceeded</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>290</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many PROMPTS</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>300</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Space for PROMPT data exceeded</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>310</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Too many HYPERLINK, JSHYPERLINK and INFOLINK commands (v7.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Program capacity exceeded (100)</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>400</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected a delimited attribute name or value at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>405</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected a delimited parameter name at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>410</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Unexpected end of knowledge base</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Encountered end of KB file while processing a KB component</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>420</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected an IF statement at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Next non-blank line after RULE must begin with IF</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>430</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected an attribute name at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>440</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected a value at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>450</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected a THEN statement at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The premise clause on the previous line did not end with <I>And</I> or <I>Or</I></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>460</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected a relational operator (=,<,<=,>,>=,!,!=,<>,:,!:) at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>470</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected a logical operator (and/or) at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Using the "=" instead of ":" relational operator with multiple values is one source of this error</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>480</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected an assignment operator (=) at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>490</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected AND at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>500</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected numeric confidence factor between 1 and 100 at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>510</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected numeric MAXVALS value at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>520</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Expected PROMPT type (YesNo, MultChoice,...) at this location</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>530</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>A translation value with this name does not exist</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>540</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>An attribute with this name does not exist (must appear in rule first)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Usually caused by defining a PROMPT with an attribute name never used in a RULE</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>600</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Attempt to change attribute type</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Use in an earlier RULE defined this attribute as a different data type</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>610</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Not a legitimate numeric value</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Illegal characters or out of range</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>615</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Out of range CF value</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Confidence factors are limited to the range -100 to +100 </TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>620</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Bad numeric value in MAXVALS statement</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>630</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Logical operator not recognized</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Probably mixed and/or logical operators in same rule premise</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>700</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>PROMPT type not recognized</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>750</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Knowledge base command not recognized</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>760</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Unrecognized data type</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>800</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Missing or empty knowledge base</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>This error will also appear if the Web server will not allow files with the .kb extension to be read. Changing the knowledge base extension to .txt (both on the .kb file and in the KBURL parameter) should resolve the problem.</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>850</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Error in JavaScript function call</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>930</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Bad operator in numeric expression</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>V6.0+: run in DEBUG mode for help in locating problem.</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>940</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Bad factor in numeric expression</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>V6.0+: run in DEBUG mode for help in locating problem.</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>950</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Non-numeric factor in numeric expression</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>V6.0+: run in DEBUG mode for help in locating problem.</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>960</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>No numeric value found with CF >= MINCF</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>v6.0+ See Note 2 below. Run in DEBUG mode for help in locating problem.</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>970</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Unbalanced parentheses in expression</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>V6.0+: run in DEBUG mode for help in locating problem.</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>980</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Attempted division by zero in parser</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>V6.0+: run in DEBUG mode for help in locating problem.</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD COLSPAN=2><FONT FACE="Arial,Helvetica" SIZE=2><OL> <LI>Most numbered errors are detected when the knowledge base is loaded. Loading aborts when the first error is detected and the line containing the error is displayed in the DEBUG window if running in DEBUG mode. (See e2gRuleEngine Applet Parameters.) <LI>It is the knowledge base developer's responsibility to make sure all numeric attributes to be used in a calculation in a rule's consequent have values before the rule fires. This is best accomplished by using all of the attributes in the rule's premise. The "?" (has been determined) relational operator can be employed when there is no other reason for a numeric attribute to appear in the premise. </OL></TD></TR> </TABLE> <P><!--Trace--> <A NAME="TRACE"></A> <TABLE BORDER=1> <TR><TH bgcolor="#ffee33" COLSPAN=3><FONT FACE="Arial,Helvetica" SIZE=3>Knowledge Base Trace Output</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Statement</TH> <TH WIDTH="50%"><FONT FACE="Arial,Helvetica" SIZE=2>Description</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Examples (from various demo KBs)</TH></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>STARTING NEW CONSULTATION WITH THE FOLLOWING GOALS:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>List of all attributes named by GOAL statements</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>>the&nbsp;recommendation</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>Minimum confidence factor for accepting a value as a fact:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Provided after the list of goals when a new consultation begins.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>80%</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>TRYING RULE:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The rule description for the rule the inference engine is about to consider.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Is it going to rain?</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>>Add to goal stack</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Provides the name of an attribute added to the goal stack. A value of this attribute is needed to evaluate the rule the inference engine last considered leading to an Unknown status.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>precipitation</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>>Rule status after evaluation is:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The status of the rule the inference engine just considered: possible values are <B>Unknown</B>, <B>True/fired</B>, <B>False</B> and <B>Failed</B>.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Unknown</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>PROMPT FOR:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>A PROMPT will be tried to obtain a value for the named attribute.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>precipitation</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>*Prompt assigned:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The value returned from the last issued PROMPT followed by the confidence with which the value was input.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>precipitation=expected&nbsp;(100.0%)</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>*Rule assigned:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>A rule has fired and the consequent assigned the specified value to the named attribute with the confidence level shown in parentheses.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>the&nbsp;recommendation=wear a raincoat (100.0%)</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>*Default assigned:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The value specified in a knowledge base DEFAULT command was assigned to the named attribute with the confidence level shonw in parentheses after the inference engine failed to resolve its value.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>the&nbsp;recommendation=wear whatever you want to (90.0%)</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>FORWARD CHAIN:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The value of an attribute has been determined from a PROMPT, because a rule fired or from a DEFAULT with sufficient confidence to be considered a fact. It will now be used to evaluate relevant rules in the knowledge base.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>precipitation=expected&nbsp;(100.0%)</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>>Forward chain - trying rule:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Provides the name of a rule the forward chaining process is about to try. The <B>>Rule status after evaluation is:</B> trace output will follow.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Is it going to rain?</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>No eligible rules for:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The named attribute's value has been resolved but there are no eligible rules to try with forward chaining.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>the recommendation</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>REMOVE FROM GOAL STACK</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Reason for removing an attribute from the goal stack followed by the attribute name. Reasons are: (Resolved) meaning a value was determined or (Failed) meaning a value could not be determined.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>(Resolved): precipitation</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>REPLACE ON GOAL STACK:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>When a value is resolved for a multivalued attribute (MAXVALS > 1) it is removed from the goal stack. If there are any remaining unresolved values, the attribute is put back on the goal stack.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>the recommendation</TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>GOAL STACK EMPTY: END CONSULTATION</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The goal stack is empty so the consultation is over. Each goal variable has either been resolved or the inference engine has determined that it cannot be resolved with the available facts.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2></TD></TR> <TR><TH ALIGN=left><FONT FACE="Arial,Helvetica" SIZE=2>Added hyperlink for:</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>A hyperlink defined by HYPERLINK or JSHYPERLINK in the knowledge base has been added to the FINAL RESULTS output. (v7.0+)</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2> Added hyperlink for: the recommended action = refuel the car hyperdemo2.htm</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD COLSPAN=2><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>Knowledge base tracing is available when running in the DEBUG mode obtained by setting the DEBUG parameter to TRUE in the &lt;APPLET> parameters. The <B>Trace is ON/OFF</B> button toggles the trace output on or off. This button may be used at any time during a consultation. </OL> </TD></TR> </TABLE> <P><!--Analysis--> <A NAME="ANALYSIS"></A> <TABLE BORDER=1> <TR><TH bgcolor="#ffee33" COLSPAN=3><FONT FACE="Arial,Helvetica" SIZE=3>Knowledge Base Analysis Output</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Component</TH> <TH WIDTH="50%"><FONT FACE="Arial,Helvetica" SIZE=2>Description</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Examples</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>ATTRIBUTE USAGE</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>All attribute names found in the knowledge base are listed in alphabetical order (ignoring case). PROMPTs and RULEs that can determine a value for the attribute are shown. Then, on a separate line, each RULE that uses the attribute is listed. An attribute that is used but never determined represents a logical error, and is flagged with a question mark before the attribute name. This typically occurs because an attribute name has been misspelled leading to the existence of two attributes when only one is intended. It is OK for an attribute name to be determined by never used in a rule: this will often be the case for the goal attributes.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>[precipitation]&nbsp;Determined&nbsp;by&nbsp;PROMPT&nbsp;1<BR>[precipitation] Used by rule(s) 1,2<BR>[the&nbsp;recommendation]&nbsp;Determined&nbsp;by&nbsp;rule(s)&nbsp;1,2 <BR><B>Error</B> (caused by space at end of attribute name in PROMPT):<BR>[precipitation&nbsp;] Determined by PROMPT 1<BR>?[precipitation] Used by rule(s) 1,2<BR>[the&nbsp;recommendation]&nbsp;Determined&nbsp;by&nbsp;rule(s)&nbsp;1,2</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>VALUE USAGE</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>In the VALUE USAGE section of the report, all text values found in the knowledge base are listed in alphabetical order (ignoring case). Each value is followed by its length enclosed in parentheses. Then its location in the knowledge base (in a rule premise (IF), rule consequent (THEN) or PROMPT) is identified along with the associated attribute. This output helps identify values with slightly different spelling, spacing or other punctuation that makes two values that are intended to match appear unmatched to the inference engine. The length of each attribute is useful in identifying hard-to-see typographical errors such as two spaces between words when only one was intended. </TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>"expected" (8) prompt 1 value of [precipitation] <BR>"expected" (8) rule 1 premise value of [precipitation] <BR>"expected" (8) rule 2 premise value of [precipitation] <BR><B>Error</B> (caused by misspelling "expected" in rule 2's premise) <BR>"expected" (8) rule 1 premise value of [precipitation] <BR>"exprected" (9) rule 2 premise value of [precipitation] </TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD COLSPAN=2><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>Knowledge base analyses are available when running in the DEBUG mode obtained by setting the DEBUG parameter to TRUE in the &lt;APPLET> parameters. To obtain this output, click the <B>Analyze KB</B> button in the <B>KNOWLEDGE BASE DEVELOPER'S OUTPUT</B> window. An analysis represents static information about the knowledge base and may be requested at any time during the consultation. </OL> </TD></TR> </TABLE> <P><!--Debug--> <A NAME="DUMP"></A> <TABLE BORDER=1> <TR><TH bgcolor="#ffee33" COLSPAN=3><FONT FACE="Arial,Helvetica" SIZE=3>Knowledge Base Dump Output</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Component</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Description</TH> <TH><FONT FACE="Arial,Helvetica" SIZE=2>Examples</TH></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Minimum CF</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Minimum confidence factor that must be achieved before the value of an attribute is accepted as known.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Minimum confidence factor for accepting a value as a fact: 80%</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>ATTRIBUTES</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The current value of an attribute followed by its type (<B>S</B> for string, <B>N</B> for numeric and <B>B</B> for Boolean) and the confidence currently associated with the value. If the knowledge base includes a DEFAULT statement for this attribute, the default value, type and confidence with which it will be assigned is provided.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Attribute 3: the recommendation=wear your boots (S)(95%) DEFAULT: wear whatever you want to (90%)</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>RULES</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The first line for each rule provides the rule description, current status (<B>U</B> for unknown, <B>T</B> for proven true, <B>F</B> for proven false and <B>X</B> for failed (cannot be determined)) followed by the current confidence factor associated with the rule. <BR>Next each premise (IF:) and consequent (THEN:) clause is presented along with its value type. Consequent clauses also provide the confidence factor associated with the value assignment in parentheses.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>RULE 1:&nbsp;[Is&nbsp;it&nbsp;going&nbsp;to&nbsp;rain?]&nbsp;Status:&nbsp;U&nbsp;(0.0%)<BR>IF: precipitation=expected(S) and<BR>the expected temperature>32.0(N)<BR>THEN:&nbsp;the&nbsp;recommendation=wear&nbsp;a&nbsp;raincoat(S)&nbsp;(100.0%)</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>GOAL STACK</TH> <TD><FONT FACE="Arial,Helvetica" SIZE=2>The goal stack provides a list of the attributes the inference engine is trying to resolve. The last (highest numbered) goal is the current inferencing objective. A goal is removed when its value is determined or there is no way to determine its value. When the goal stack is empty, the consultation ends.</TD> <TD><FONT FACE="Arial,Helvetica" SIZE=2>Goal 1: the recommendation<BR>Goal 2: the expected temperature</TD></TR> <TR><TH><FONT FACE="Arial,Helvetica" SIZE=2>Notes</TH> <TD COLSPAN=2><FONT FACE="Arial,Helvetica" SIZE=2> <OL> <LI>Knowledge base dumps are available when running in the DEBUG mode obtained by setting the DEBUG parameter to TRUE in the &lt;APPLET> parameters. To obtain this output, click the <B>Display KB dump</B> button in the <B>KNOWLEDGE BASE DEVELOPER'S OUTPUT</B> window. Dumps may be requested at any time during the consultation. <LI>If an attribute is allowed to have multiple values (there is a MAXVALS statement for this attribute with a value greater than 1), it will appear multiple times in the ATTRIBUTE section of the dump. </OL> </TD></TR> </TABLE> <FONT FACE="Arial,Helvetica" SIZE=2> <P><CENTER>[<A HREF="default.htm">Index</A>][<A HREF="e2gmod1.htm">Module 1</A>][<A HREF="e2gmod2.htm">Module 2</A>][<A HREF="/e2g3g/tutorials/esintro">Module 3</A>][<A HREF="e2gmod4.htm">Module 4</A>][<A HREF="/e2g3g/tutorials/inference">Module 5</A>][<A HREF="/e2g3g/tutorials/knoweng">Module 6</A>][<A HREF="e2gmod7.htm">Module 7</A>][<A HREF="e2gmod8.htm">Module 8</A>][<A HREF="e2gmod9.htm">Module 9</A>][<A HREF="e2gRuleWriterRef.htm">Module 10</A>]</CENTER> <P><HR><FONT FACE="Arial,Helvetica" SIZE=1>Copyright © 2001-2011 by <FONT COLOR=Blue>e</FONT><FONT COLOR=Red>Xpertise</FONT><FONT Color=Blue><I>2Go</I></FONT>.com. All rights reserved. <BR><A HREF="mailto:webmaster@expertise2go.com">webmaster@expertise2go.com</A> </FONT> </BODY> </HTML>