
12-10-2013_09-24-50 / [Simon_Kendal,_Malcolm_Creen]_Introduction_to_Know(BookFi.org)
.pdfExpert System Shells, Environments and Languages |
163 |
development of hybrid intelligent information systems, i.e., systems containing both procedural and declarative components (see Chapter 6 for more details of hybrid intelligent information systems).
JESS was written entirely in Java and was designed in such a way that components created by JESS can be integrated directly with procedural components, assuming that they are also written in Java. To facilitate this JESS has the following features:
tools for extending Eclipse, an Integrated Development Environment often used for developing Java programs
an inference engine that supports both forward chaining and backward chaining
the ability to perform reasoning upon other Java objects.
JESS does not provide graphical user-interface facilities directly. However, Java programmers already have facilities to create these and JESS programmers have access to all of the Java API.
As systems created with JESS are written in Java this provides and easy method of developing web-based ESs.
More details of JESS and the JESS software itself can be found on the Internet at: http//www.herzberg.ca.sandia.gov/jess/.
Summary
This section has examined the use of ES shells as tools used in the development of ESs.
Self-Assessment Question
Question 1
Find two ES shells on the web and contrast them. Identify their main features.
Identify any major differences in usability between each shell.
Answers to Self-Assessment Question
Answer 1
Your answer will be very dependent upon the specific shells you find and compare.
164 |
An Introduction to Knowledge Engineering |
Much of your evaluation will represent your personal experience of the software and you may have developed preferences for the different ways in which the two programs approach the same task.
Generally speaking, most shells are relatively simple tools that support one knowledge base using one knowledge representation scheme. Many shells also offer additional features such as automatic explanation facilities, graphical interface development tools and some support for integrating the system with other programs and/or databases.

Expert System Shells, Environments and Languages |
165 |
SECTION 2: EXPERT SYSTEM
DEVELOPMENT ENVIRONMENTS
Introduction
This section provides a brief introduction to the use of ES development environments. It considers the main limitations with ES shells and looks how one industry standard tool overcomes these limitations.
Objectives
By the end of the section you will be able to:
evaluate the advantages and limitations of ES development environments.
Activity 59
Search the WWW and read some of the documentation for Aion BRE, a system produced by Computer Associates. Identify the characteristics of the system that make it an improvement over ES shells.
Feedback 59
You may have been able to recognise the following main advantages:
supports multiple segmented knowledge bases
allows inference engines to be tailored to each knowledge base
supports multiple knowledge representation schemes, rules (with forward and backward chaining)
supports object-oriented knowledge representation (similar to frames but more flexible)
appropriate for the development of large systems but also much more expensive, complex and more difficult to learn
separates control and domain knowledge thus supporting knowledge base reuse (discussed in Chapter 6).
Expert system development environments are in many ways similar to ES shells. However, as we have seen, while still specifically designed to support the development of ESs, they are much more flexible than ES shells.
In particular, they allow larger ESs to be developed in a structured way and they offer much more flexibility in the way knowledge is represented.
166 |
An Introduction to Knowledge Engineering |
They also allow the separation of control and domain knowledge. This is an important issue that enables knowledge reuse.
The advantages that ES development environments offer when compared with ES shells will become much more apparent when you work your way through Chapter 6. This explains current thinking with regard to life cycles and methodologies used when developing ESs. You will see that segmented knowledge bases and the separation of control and domain knowledge are important concepts that are supported by modern ES development environments such as Aion BRE.
In Chapter 6, you will see how Aion BRE has facilities required by current methodologies and can be used to develop a larger well-structured application.
Expert system development environments do however have one particular disadvantage when compared with ES shells. As they are more flexible, they are also larger, more costly and more complex to learn. Therefore when choosing a tool to develop an ES a sensible rule would be to ‘use a shell where you can and an environment where you should’.
Summary
This section has provided an introduction to the use of ES development environments and you have had the opportunity to review one modern industry standard tool.
Self-Assessment Question
Question 1
You have been asked to develop a small web-based ES to advise prospective students of appropriate courses at a university.
Consider each of the following types of tool and select the most appropriate for this problem:
An ES shell
A knowledge-based system (KBS) development environment (e.g. Aion BRE)
A conventional programming language (e.g. C++ or Java).
Answers to Self-Assessment Question
Answer 1
This problem is quite small and this would indicate the use of a shell (e.g. Crystal). However, this can significantly restrict the knowledge representation scheme
Expert System Shells, Environments and Languages |
167 |
allowed and if the shell does not support the knowledge representation method most suitable for this problem (e.g. frames) we may be forced to consider a more flexible tool such as KBS environment (e.g. Aion BRE). Furthermore, not all shells would allow the system to be integrated with the WWW (though JESS will).
If a more flexible knowledge base were required we may need to consider the use of an AI language (e.g. PROLOG) see next section. However, nothing in the problem suggests that such flexibility is required.
The use of a conventional programming language would be most costly of all as it has no inbuilt inference capabilities and thus the inference engine would need to be programmed from scratch. This is the most flexible of all options but should only be considered if all other options are deemed inappropriate. The use of a procedural programming language would at least allow the system to be very easily integrated on to the web.
168 |
An Introduction to Knowledge Engineering |
SECTION 3: USE OF AI LANGUAGES
Introduction
This introduces PROLOG, a programming language not specifically designed for the development of ESs but one designed for the creation of many AI applications.
Objectives
By the end of this section you will be able to:
evaluate the advantages and limitations of programming languages for the development of ESs.
Expert System Languages
There are two main classes of languages, procedural and declarative.
Procedural languages include C++ and Java. These are relatively general-purpose languages that can be used in many different programming situations, e.g. expert systems, Microsoft Windows programs and company-specific applications. They are organised as a set of procedures, very similar to the way that a chapter in a book is divided into a series of paragraphs. While they offer no specific support for the development of ESs they do offer the ultimate in flexibility. As such languages such as these can be used to develop systems where other tools may be inadequate. For example, the development of a hybrid expert/neural network system may require this level of flexibility. However, this choice of tool should be a last resort as they offer no specific support for the development of ESs.
On the other hand, the declarative programming language PROLOG is specifically designed for programming AI systems from scratch and can be used to develop ESs. When developing ESs, PROLOG offers even more flexibility than an ES development environment. However, it has limited inbuilt facilities, i.e., less specific support for the development of ESs. Thus developing an ES using PROLOG will take considerably longer than if shell or environment was used as required features need to be programmed. Thus there is a trade off between flexibility of tool and lack of specific support.
The following tools are placed in increasing order of flexibility. They are also in order of increasing complexity and hence development time:
Shells
Development environments
AI languages
Procedural languages.
Expert System Shells, Environments and Languages |
169 |
When choosing between these options you should use a shell where you can and an environment where you should and a language only if you must.
An Introduction to PROLOG
This chapter now introduces you to the PROLOG programming language.
Programs written in declarative languages include a set of declarations about a specific field of knowledge. Using this declaration, the ES can determine the truth of a statement as well as work out solutions to problems.
Most ES languages, including PROLOG, give knowledge to an ES in the form of facts.
PROLOG programs are made from terms, which can be either:
A constant is a single entity (like zebra, ‘John’) or a non-negative integer (like 24)
A variable is a series of letters that begins with a capital letter (like John). Note: constants cannot begin with a capital letter unless they are enclosed in quotes.
A structure is a predicate with zero or more arguments, written in functional notation. For example,
animal(zebra). speaks(boris, russian).
A fact is a term followed by a period (.). A rule is a term followed by :- and a series of terms (term1, term2, . . . , termN) separated by commas and ended by a period (.). That is, rules have the following form:
term :- term1, term2, ..., termN.
A PROLOG program is a series of facts and rules:
speaks(boris, russian). speaks(john, english). speaks(mary, russian). speaks(mary, english).
understands(Person1, Person2) :- speaks(Person1, L), speaks(Person2, L).
This program can be translated into the following English facts:
Boris speaks Russian.
John speaks English.
Mary speaks Russian.
Mary speaks English.

170 |
An Introduction to Knowledge Engineering |
and the following rule . . .
Two people can understand each other if they both speak the same language.
A fact in English may be written as:
The expert system monitors the ventilator.
This fact contains two important components:
a relationship or predicate in the PROLOG language. In this example, the predicate is monitor.
objects or arguments in PROLOG (objects are normally people, things or other items being acted on by the predicates). In this example, the objects are expert system and ventilator.
In PROLOG, the fact would be expressed (all in lower case) as:
monitors(expert-system,ventilator).
In other words, the activity is placed at the beginning of the fact. The people or objects affected by the activity appear inside the brackets, normally with the person first, followed by any collective noun (e.g. class of pupils) or names of objects. Note also that the syntax demands full stops at the end.
PROLOG uses various symbols.
Symbol |
Meaning |
, |
And |
; |
Or |
:- |
If |
|
|
Activity 60
Express the following facts in PROLOG
1.A person travels on a train.
2.The teacher instructs the class.
3.John drives a car.

Expert System Shells, Environments and Languages |
171 |
Feedback 60
1.travels(person,train).
2.instructs(teacher,class).
3.drives(john,car).
Note that in all situations the activity is placed before the brackets, which contain the objects/arguments affected by the activity/predicate.
While the order of arguments within the brackets have no significance within PROLOG, the order must be used consistently. For example, writing ‘the doctor treats the patient’ should always be written as:
treats(doctor,patient).
Rather than sometimes as:
treats(doctor,patient).
and at other times as:
treats(patient,doctor).
Expressing Facts in ESs
Facts can be expressed in ESs using the same format as the action statements above. For example, the fact my surname is Smith can be expressed as
surname(smith)
Activity 61
Explain the meaning of these statements in PROLOG
1.age(fred, 56).
2.value(pH,7.27).
Feedback 61 |
|
PROLOG statement |
Meaning |
age(fred,56). |
Fred is 56. |
value(pH,7.27). |
The pH value is 7.27. |
|
|

172 |
An Introduction to Knowledge Engineering |
Using Facts in ESs
Given a set of facts, an ES can review those facts to determine if any apply in a given situation. For example, a system can be provided with the following set of facts.
Fact |
PROLOG statement |
Fred is male |
male(fred). |
Tina is female |
Female(tina). |
Susan is female |
Female(susan). |
Fred is on a ventilator |
ventilator(fred). |
Susan is on a ventilator |
ventilator(susan). |
|
|
Queries can be given to PROLOG in the format:
? - ventilator(fred).
In other words, please find out if Fred is on a ventilator. The ES then searches the knowledge base to see if this fact is known and a suitable response is provided.
Notice that these statements are different from those statements indicating a relationship between different objectives. In this situation, the statements simply express facts. Also, where there is more than one object within a class, such as female in this situation, then the overall class name appears outside of the brackets, with the class example (the name) inside of the bracket. Using this format means that a search can be made for a specific object name, such as female, and then all items matching that search will be quickly identified.
Figure 5.2 shows the ES answering the queries:
Is Fred on a ventilator ?
You can then use query mode to ask Prolog questions about patients.
Is Tina on a ventilator ?
?- ventilator(fred).
The query is entered in Prolog format
Yes
Prolog then exam the knowledge ba for facts which
the question
?- ventilator(tina). |
|
No |
FIGURE 5.2. Querying an expert system.