1 Communication | 2 Elements | 3 Engine | 4 Small application | 5 Heavy application | 6 Download | 7 Notes |
4 Building a small application
4.1 Introduction
In this sections a small medical expert system is build. It uses three subjects: symptoms, illnesses and treatments. Three sentences define the way these subjects relate to each other. When the application is ready it should have this functionality:
- given a
number of symptoms, what are the associated illnesses?
- given a number of illnesses, what are the associated treatments?
This application is the first of the tutorial that comes with
the software. If you download
the software you can build the application live.
Note: In order to prevent name mangling, all subjects that are defined in the
tutorial start with a T.
4.2 Contents logic
Figure 4.1 gives an overview of the contents of the application. First a new subject is added to the language that is called 'Symptom'. Next a sentence is added that says that every symptom has a name. Because there is only one sentence associated with a symptom, the grammar of symptoms is quit trivial. Parsing is done in the parser (see figure 3.5) by selecting the utterance and pressing CTRL+I. After parsing these three utterances, one can add instances of symptoms. In this example, adding symptoms also is done by parsing utterances (in stead of using a generated dialog).
The next step is to connect symptoms to illnesses. For that reason the
subject illness is defined. Sentence Tut2S2 prescribes that an
illness has a name (like 'cold') and that it is connected to one or more
existing symptoms (like sneeze). After parsing the syntax, instances of
illnesses can be added. In a similar fashion we define 'treatments' and connect
these to illnesses.
Now, the small application is defined and we can step to the presentation of its
contents.
4.3 Presentation logic
Figure 4.2 gives an overview of the elements needed in order to present the contents of the application. First, ten components are defined, a form, three images, three list boxes and three static text components. Because there are sentences that define components, adding components to the language is done in much the same way as adding symptoms or illnesses. Basically, there is no difference between these utterances:
Utterance 1 CSTLISTBOX Form1 Diagnosis1
'ListBox1' Diagnosis1.
Utterance 2 HEIGHT
ListBox1 Diagnosis1 200.
Utterance 3 TSYMPTOM 'Cough'
Utterance 4 TILLNESS
'Cold' Sneeze EarAche SoreThroat Cough .
The only difference between a list
box and a symptom is that the first one has
a built-in visual representation.
Note: normally you will not use the parser to design presentation forms but
rather the designer. See
figure 3.4.
After creating the components, properties are parsed. These properties define
for example the position of the component on the form (Width, Height, Left, Top,
etc.).
The next step is to fill the list boxes with proper information. For that
purpose, three 'OnGetSet' events are defined. Such an event informs the system
that it should use the associated noun phrase to get the information. For
ListBox1 the system retrieves 'The Symptoms'. Because we said '1 Or_more
Of The Symptoms' it will select at least one symptom as default. For
ListBox2 the noun phrase contains a 'walk' through the semantic network. The
system is instructed to retrieve all illnesses that are connected to these
illnesses. However, without additional information the system can not know what
is meant by 'these'. For that reason we say that ListBox2 is the context
child of ListBox1. The result in ListBox2 will be dependent on the choice made
in ListBox1. In a similar fashion the set of treatments in ListBox3 is connected
to the choice made in ListBox2.
Now, the application is ready. The next question is: how does the system
process new information? CommunSENS is aware of its world and will always give
the most complete view. For example, if you add a new symptom it automatically
updates the set in ListBox1. The same will happen if you delete a symptom.
As
mentioned before, there is no fundamental difference between a symptom, a form,
a component, a property or an event. For that reason you can add and delete all
these kind of symbols at run time too. Your application stays working in the
state you want it to. This is what is meant by 'fully scalable'.
The basic configuration of the knowledge engine CommunSENS contains about twenty presentation forms like the parser and the designer. The architecture of all these forms is much the same as the form Diagnosis1. Basically, each form consists of a number of components that contain symbol sets which are connected by context. The result is a flow of symbols that stream through the forms. For that reason 'OnGetSet' events are not limited to visual components but also apply to menu items, buttons, etc.
1 Communication | 2 Elements | 3 Engine | 4 Small application | 5 Heavy application | 6 Download | 7 Notes |
Copyright © 2005 by AB Ontwikkeling BV
All Rights Reserved. Any reproduction or reuse of these pages or
their contents requires the advance permission of AB Ontwikkeling BV.