![]() |
![]() |
Reference: Tables summarizing e2gLite's
commands and error messages.
Reference Index
HTML to incorporate the e2gLite Applet in a Web page | |
---|---|
<APPLET CODE="e2glite.e2g.class" ARCHIVE="e2glite.jar" WIDTH=450 HEIGHT=300 MAYSCRIPT> <PARAM NAME="KBURL" VALUE="auto.kb"> (optional <PARAM> tags) . . . Java capable browser required! <BR>Free Java capable browsers are available from: <A HREF="http://www.netscape.com">Netscape</A> and <A HREF="http://www.opera.com/download">Opera</A> </APPLET> | |
Notes |
|
e2gLite Applet Parameters | |||
---|---|---|---|
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) |
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 | (Version 3.x) 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"> |
Notes |
|
Button Codes Provided by e2gLite | ||
---|---|---|
Button Clicked | Value | |
Start the consultation * | 1 | |
Submit your response | 2 | |
Why Ask? | 3 | |
Return (from Why Ask?) | 4 | |
Explain | 5 | |
Restart | 6 | |
* May be renamed by the
STARTBUTTON applet parameter. Other buttons may be renamed by knowledge base TRANSLATE commands. |
e2gLite Methods Accessible from Javascript | ||
---|---|---|
Method Name | Value Returned and Value Type | Arguments and Argument Types |
getAttrCF(attrName,valIx) | (Float) Confidence factor associated with specific instance of named attribute (0.0 if doesn't exist or net yet determined) | (String) attrName: name of
attribute (Integer) valIx: instance (between 1 and max values) of named attribute to allow for multi-valued attributes |
getAttrCount( ) | (Integer) Number of attributes defined in the knowledge base | |
getAttrIx(attrName,valIx) | (Integer) Index of attribute associated with specific instance of named attribute (0 if doesn't exist) | (String) attrName: name of
attribute (Integer) valIx: instance (between 1 and max values) of named attribute to allow for multi-valued attributes |
getAttrName(attrIx) | (String) Name of attribute (zero length string if doesn't exist) | (Integer) attrIx: index of attribute |
getAttrValue(attrIx) | (String) String representation of current value (0 length string if doesn't exist or not yet determined) | (Integer) attrIx: index of attribute |
(String) String representation of current value (0 length string if doesn't exist or not yet determined) | (String) attrName: name of
attribute (Integer) valIx: instance (between 1 and max values) of named attribute to allow for multi-valued attributes | |
getMaxValues(attrName) | (Integer) Number of values (instances) allowed for named attribute (0 if doesn't exist) | (String) attrName: name of attribute |
getGoalAttr( ) | (Integer) Index of current goal or subgoal attribute (0 if inferencing is finished) | |
Note 1: e2gLite 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. 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. |
Example e2gLite Knowledge Base |
---|
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 |
e2gLite Knowledge Base Format | ||
---|---|---|
Command | Description | Examples |
REM | Comment line | REM Diagnose why an automobile won't start |
RULE | Begins a rule: followed by rule description in square brackets | 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 problem] = "the battery is discharged or dead" @ 90 and [the recommended action] = "recharge or replace the battery" |
If | Begins rule premise: followed by first premise clause (attribute name in square brackets + relational operator + comparison quantity), optional logical operator and/or (if there is another premise clause) | |
Then | Begins rule consequent: followed by first consequent clause (attribute name in square brackets + = + value + optional confidence/certainty factor: @ xxx where xxx represents a percentage and defaults to 100), optional and (required if there is another consequent clause) | |
PROMPT | Defines format of user request for
an attribute's value if the inference engine is allowed to request it.
Prompt types: YesNo (radio button true/false (Boolean) input) MultChoice (text string radio button input) Choice (text string drop-down list input) AllChoice (text string check box multiple inputs: See MAXVALS) Numeric (range-checked numeric input) Optional CF parameter generates request for confidence factor input Question to ask user is on the next line in single or double quotes. Response choices (if required by the PROMPT) are on successive lines in quotes For the Numeric PROMPT, the minimum and maximum acceptable values are on successive lines in quotes |
PROMPT [the stoplights work] YesNo
CF "Do the stoplights light when you step on the brake?" PROMPT [the gas tank] MultChoice CF "According to the fuel gauge, the gas tank is:" "empty" "not empty" 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 [an acceptable time to pick up your car] Choice What time may we pick up your car? (Check up to three) "7 - 9 AM" "9 AM -12 PM" "12 - 3 PM" "3 - 7 PM" 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 | 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. | GOAL [the problem] |
MINCF | (Optional) The minimum confidence/certainty factor to accept a value as a fact. Default is 80.0 | MINCF 70 |
MAXVALS | (Optional) The maximum number of different values one attribute can have. Default is one. Attributes with AllChoice PROMPTs should have a MAXVALS greater than one. | MAXVALS [an acceptable time to pick up your car] 3 |
DEFAULT | (Optional) Sets value of an attribute if the inference engine fails to determine its value from PROMPTs or RULEs. | DEFAULT [the gas tank] = "not empty"
DEFAULT [the stoplights work] = true DEFAULT [the amount you are willing to spend on repairs] = 50 |
TRANSLATE | (Optional) Customizes e2gLite text output. Also supports knowledge base translation to languages other than English. See Text Customizeable with Translate Commands for a list of text items that may be customized. | TRANSLATE B_SUBMIT = "Soumettez
votre réponse" TRANSLATE TR_YES = "Oui" TRANSLATE TR_RULE = "RÈGLE:" |
Notes |
|
e2gLite Relational Operators | |||
---|---|---|---|
Operator | Interpretation | Formatted Rule Translation | Example unformatted/formatted premise clause output |
= | equal to | is (NOTE: With true Boolean attributes, the relational operator and comparison quantity is omitted from translation) |
[the result of trying the
starter] = "nothing happens" the result of trying the starter is nothing happens [the headlights dim when the starter cranks] = true the headlights dim when the starter cranks [the headlights dim when the starter cranks] = false the headlights dim when the starter cranks is false |
< | strictly less than | is less than | [the age of the battery in
months] < 24 the age of the battery in months is less than 24 |
> | strictly greater than | is greater than | [the age of the battery in
months] > 12 the age of the battery in months is greater than 12 |
! | not equal to | is not | [the gas tank] !
"empty" the gas tank is not empty |
: | equals any of (NOTE: use only with text string data) |
is value, value,... or value | [the battery brand] : "Delco"
"Mopar" "Interstate" the battery brand is Delco, Mopar or Interstate |
Notes |
|
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" | ||
|
e2gLite Error Codes | ||
---|---|---|
Error | Meaning | Comment |
150 | Initialization error | Internal error while trying to load KB |
210 | Too many GOAL statements | Program capacity exceeded |
220 | No GOAL statements | At least one goal is required |
230 | Too many attributes | Program capacity exceeded |
240 | Too many unknown attributes | Program capacity exceeded |
250 | Too many RULEs | Program capacity exceeded |
260 | Too many RULE permise clauses | Program capacity exceeded |
270 | Too many RULE consequent clauses | Program capacity exceeded |
280 | Space for RULE data exceeded | Program capacity exceeded |
290 | Too many PROMPTS | Program capacity exceeded |
300 | Space for PROMPT data exceeded | Program capacity exceeded |
400 | Expected a delimited attribute name or value at this location | |
410 | Unexpected end of knowledge base | Encountered end of KB file while processing a KB component |
420 | Expected an IF statement at this location | Next non-blank line after RULE must begin with IF |
430 | Expected an attribute name at this location | |
440 | Expected a value at this location | |
450 | Expected a THEN statement at this location | The premise clause on the previous line did not end with And or Or |
460 | Expected a relational operator (= < > ! :) at this location | |
470 | Expected a logical operator (and/or) at this location | Using the "=" instead of ":" relational operator with multiple values is one source of this error |
480 | Expected an assignment operator (=) at this location | |
490 | Expected AND at this location | |
500 | Expected numeric confidence factor between 1 and 100 at this location | |
510 | Expected numeric MAXVALS value at this location | |
520 | Expected PROMPT type (YesNo, MultChoice,...) at this location | |
530 | A translation value with this name does not exist | |
540 | An attribute with this name does not exist | Usually caused by defining a PROMPT with an attribute name never used in a RULE |
600 | Attempt to change attribute type | Use in an earlier RULE defined this attribute as a different data type |
610 | Not a legitimate numeric value | Illegal characters or out of range |
620 | Bad numeric value in MAXVALS statement | |
630 | Logical operator not recognized | |
700 | PROMPT type not recognized | |
750 | Knowledge base command not recognized | |
760 | Unrecognized data type | |
800 | Missing or empty knowledge base | |
Notes |
|
Knowledge Base Trace Output | ||
---|---|---|
Statement | Description | Examples (from various demo KBs) |
STARTING NEW CONSULTATION WITH THE FOLLOWING GOALS: | List of all attributes named by GOAL statements | >the recommendation |
Minimum confidence factor for accepting a value as a fact: | Provided after the list of goals when a new consultation begins. | 80% |
TRYING RULE: | The rule description for the rule the inference engine is about to consider. | Is it going to rain? |
>Add to goal stack | 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. | precipitation |
>Rule status after evaluation is: | The status of the rule the inference engine just considered: possible values are Unknown, True/fired, False and Failed. | Unknown |
PROMPT FOR: | A PROMPT will be tried to obtain a value for the named attribute. | precipitation |
*Prompt assigned: | The value returned from the last issued PROMPT followed by the confidence with which the value was input. | precipitation=expected (100.0%) |
*Rule assigned: | A rule has fired and the consequent assigned the specified value to the named attribute with the confidence level shown in parentheses. | the recommendation=wear a raincoat (100.0%) |
*Default assigned: | 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. | the recommendation=wear whatever you want to (90.0%) |
FORWARD CHAIN: | 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. | precipitation=expected (100.0%) |
>Forward chain - trying rule: | Provides the name of a rule the forward chaining process is about to try. The >Rule status after evaluation is: trace output will follow. | Is it going to rain? |
No eligible rules for: | The named attribute's value has been resolved but there are no eligible rules to try with forward chaining. | the recommendation |
REMOVE FROM GOAL STACK | 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. | (Resolved): precipitation |
REPLACE ON GOAL STACK: | 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. | the recommendation |
GOAL STACK EMPTY: END CONSULTATION | 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. | |
Notes |
|
Knowledge Base Analysis Output | ||
---|---|---|
Component | Description | Examples |
ATTRIBUTE USAGE | 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. | [precipitation] Determined by PROMPT 1 [precipitation] Used by rule(s) 1,2 [the recommendation] Determined by rule(s) 1,2 Error (caused by space at end of attribute name in PROMPT): [precipitation ] Determined by PROMPT 1 ?[precipitation] Used by rule(s) 1,2 [the recommendation] Determined by rule(s) 1,2 |
VALUE USAGE | 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. | "expected" (8) prompt 1 value of
[precipitation] "expected" (8) rule 1 premise value of [precipitation] "expected" (8) rule 2 premise value of [precipitation] Error (caused by misspelling "expected" in rule 2's premise) "expected" (8) rule 1 premise value of [precipitation] "exprected" (9) rule 2 premise value of [precipitation] |
Notes |
|
Knowledge Base Dump Output | ||
---|---|---|
Component | Description | Examples |
Minimum CF | Minimum confidence factor that must be achieved before the value of an attribute is accepted as known. | Minimum confidence factor for accepting a value as a fact: 80% |
ATTRIBUTES | The current value of an attribute followed by its type (S for string, N for numeric and 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. | Attribute 3: the recommendation=wear your boots (S)(95%) DEFAULT: wear whatever you want to (90%) |
RULES | The first line for each rule
provides the rule description, current status (U for unknown,
T for proven true, F for proven false and X for
failed (cannot be determined)) followed by the current confidence factor
associated with the rule. 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. |
RULE
1: [Is it going to rain?] Status: U (0.0%) IF: precipitation=expected(S) and the expected temperature>32.0(N) THEN: the recommendation=wear a raincoat(S) (100.0%) |
GOAL STACK | 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. | Goal 1: the recommendation Goal 2: the expected temperature |
Notes |
|