PROLOG and Semantic Nets

Course : T0273 – EXPERT SYSTEMS
Year
: 2014
The Representation of Knowledge 1
Session 3
Learning Outcomes
LO 1 : Explain concepts of Expert Systems
LO 2 : Describe the characteristics of Expert Systems
 After taking this course, students should be able to
explain and discuss the representation of knowledge.
T0273 - Expert Systems
3
Lecture Outline
•
•
•
•
•
•
•
•
•
•
Introduction
The Meaning of Knowledge
Productions
Semantic Nets
Object-Attribute-Value Triples
PROLOG and Semantic Nets
Difficulties with Semantic Nets
Schemata
Graph
Exercise
T0273 - Expert Systems
4
Introduction
• Knowledge representation (KR) has long been
considered central to AI because it is as significant a
factor in determining the success of a system as the
software that uses the knowledge.
• KR is of major importance in expert systems for two
reasons:
– Expert systems are designed for a certain type of KR based on
rules of logic called inferences.
– Expert systems affects the development, efficiency, speed, and
maintenance of the system.
T0273 - Expert Systems
5
The Meaning of
Knowledge
• Knowledge is one of those words that everyone knows
the meaning of, yet finds hard to define or even feel the
same way about.
• Knowledge has many meanings depending on the mind
of the beholder
• Knowledge can be further classified into procedural
knowledge, declarative knowledge, and tacit
knowledge.
T0273 - Expert Systems
6
The Meaning of
Knowledge
• Procedural Knowledge
is often referred to as knowing how to do something.
Example: knowing how to boil a pot of water
• Declarative Knowledge
refers to knowing that something is true or false
Example: “Don’t put your fingers in a pot of boiling water”
• Tacit Knowledge (unconscious knowledge)
it cannot be expressed by language.
Example: knowing how to move your hand.
T0273 - Expert Systems
7
The Meaning of
Knowledge
• Knowledge is of primary importance in expert systems.
Knowledge + Inference = Expert Systems
• Inferencing is generally used for mechanical systems such
as expert systems.
• Reasoning is the term used for human thinking.
T0273 - Expert Systems
8
The Meaning of
Knowledge
T0273 - Expert Systems
9
Productions
• A number of different KR techniques have been devised.
These include rules, semantic nets, frames, script, logic,
conceptual graphs, and others.
• One formal notation for defining productions is the BackusNaur-Form (BNF).
Example:
<sentence>::= <subject> <verb> <end-mark>
angle brackets, <>, and ::= : symbols of the metalanguage
term within angle brackets : nonterminal symbols
<sentence>
: start symbol
T0273 - Expert Systems
10
Productions
• The production rule:
<sentence>  <subject> <verb> <end-mark>
states that a sentence is composed of a subject,
followed by a verb, followed by an end-mark
• The following rules complete the nonterminals by
specifying their possible terminals. The bar means “or”
in the metalanguage:
<subject>  I | You | We
<verb>  left |came
<end-mark>  . | ? | !
T0273 - Expert Systems
11
Productions
• A grammar is a complete set of production rules that
defines a language ambiguously.
Example:
<sentence>  <subject> <verb> <object> <end-mark>
<object>  home | work | school
• A parse tree or derivation tree is a graphic
representation of a sentence decomposed into all the
terminals and nonterminals used to derive the sentence
T0273 - Expert Systems
12
Semantics Nets
• Semantic network is a classic AI representation technique
used for propositional information. Sometimes called a
propositional net.
• The structure of a semantic net is shown graphically in
terms of nodes and the arcs connecting them. Nodes are
sometimes referred as objects and the arcs as links or
edges.
• The links of a semantic net are used to express
relationships. Nodes are generally used to represent
physical objects, concepts, or situations.
T0273 - Expert Systems
13
Semantics Nets
T0273 - Expert Systems
14
Semantics Nets
A Semantic Net with IS-A and A-Kind-Of (AKO) Links
T0273 - Expert Systems
15
Object-Attribute-Value
Triples
• An object-attribute-value triple (OAV), or triplet, can
be used to characterize all the knowledge in a semantic net
and was used in the expert system MYCIN for diagnosing
infectious diseases.
• OAV triples are especially useful for representing facts and
the patterns to match the facts in the antecedent of a rule.
T0273 - Expert Systems
16
Object-Attribute-Value
Triples
An OAV Table
Object
apple
apple
apple
grapes
grapes
grapes
Attribute
color
type
quantity
color
type
quantity
T0273 - Expert Systems
Value
red
macintosh
100
red
seedless
500
17
PROLOG and
Semantic Nets
• Semantic nets are easy to translate into PROLOG.
• Example:
is_a (goodyear_blimp, blimp).
is_a (spirit_of_st_louis, special).
has_shape (blimp, ellipsoidal).
has_shape (balloon, round).
• Each of statements above is a PROLOG predicate
expression.
T0273 - Expert Systems
18
PROLOG and
Semantic Nets
• The following are some examples of PROLOG predicates.
Comments are preceded by semicolons and ignored by the
PROLOG engines:
color (red).
; red is a color is a fact
mother (pat, ann).
; pat is the mother of ann
parents (jim, ann, tom) ; jim and ann are parents of tom
surrogatemother (pat, tom) ; pat is surrogatemother of tom
• Predicates can also be expressed with relations such as the
IS-A and HAS-A
is_a (red, color).
has_a (john, father).
has_a (john, mother).
has_a (john, parents).
T0273 - Expert Systems
19
Difficulties with
Semantic Nets
• The lack of link name standards.
• Combinatorial explosion of searching nodes, especially
if the response to a query is negative.
• It would take a very long time to answer negative
queries.
• Semantic nets are logically inadequate because they
cannot define knowledge in the way that logic can.
T0273 - Expert Systems
20
Schemata
• In AI, the term schema (plural schemas or schemata)
is used to describe a more complex knowledge
structure than the semantic net.
• For example, the acts of eating and drinking are
pleasurable sensorimotor schemata that involve
coordinating information from the senses with the
required motor (muscle) movements to eat and drink.
• A conceptual schema is an abstraction in which
specific objects are classified by their general
properties. For example, if you see a small red, round
object with a green stem under a sign that says
Artificial Fruit, you will recognize it as an artificial apple.
T0273 - Expert Systems
21
Graph
• A circuit (cycle) is a path through the graph
beginning and ending with the same node.
• Acyclic graphs have no cycles.
• Connected graphs have links to all the nodes.
• Digraphs are graphs with directed links.
• Lattice is a directed acyclic graph.
Bina Nusantara University
State and Problem Spaces
• A state space can be used to define an object’s behavior.
• Different states refer to characteristics that define the
status of the object.
• A state space shows the transitions an object can make
in going from one state to another.
Bina Nusantara University
Finite State Machine
• A FSM is a diagram describing the finite number of
states of a machine.
• At any one time, the machine is in one particular state.
• The machine accepts input and progresses to the next
state.
• FSMs are often used in compilers and validity checking
programs.
Bina Nusantara University
Using FSM to Solve Problem
• Characterizing ill-structured problems – one having
uncertainties.
• Well-formed problems:
– Explicit problem, goal, and operations are known
– Deterministic – we are sure of the next state when an
operator is applied to a state.
– The problem space is bounded.
– The states are discrete.
Bina Nusantara University
State Diagram of
Vending Machine
Bina Nusantara University
Summary
• Knowledge representation is of major importance in
expert systems.
• A number of different KR techniques have been
devised. These include rules, semantic nets, frames,
script, logic, conceptual graphs, and others.
• Semantic network is a classic AI representation
technique used for propositional information.
• Semantic nets are easy to translate into PROLOG.
• There are some difficulties with semantic nets.
• Schemata is used to describe a more complex
knowledge structure than the semantic net.
T0273 - Expert Systems
27
Exercise
1. Draw semantic net for computers using AKO and IS-A
links. Consider the classes of microcomputer,
mainframe, supercomputer, computing systems,
dedicated, general purpose, board-level, computer-ona-chip, single processor, and multiprocessor. Include
specific instances.
2. Draw a semantic net for computer communications
using AKO and IS-A links. Consider the classes of local
area net, wide area net, token ring, star, centralized,
decentralized, distributed, modems,
telecommunications, newsgroups, and electronic mail.
Include specific instances.
T0273 - Expert Systems
28
References
• Joseph Giarratano, Gary Riley. 2005. Expert Systems:
Principles and Programming Chapter 2. Thomson Course
Technology. Australia. ISBN:0-534-38447-1.
• Peter Jackson. 1998. Introduction to Expert Systems.
Addison-Wesley. Harlow, England. ISBN:0201876868
• http://www.codeproject.com/Articles/179375/ManMarriage-and-Machine-Adventures-in-Artificial
T0273 - Expert Systems
29