Knowledge Representation - Budditha Hettige...2019/11/02  · – Frames – Scripts – Ontology 3...

100
Knowledge Representation Budditha Hettige Department of Computer Engineering 1

Transcript of Knowledge Representation - Budditha Hettige...2019/11/02  · – Frames – Scripts – Ontology 3...

  • Knowledge Representation

    Budditha HettigeDepartment of Computer Engineering

    1

  • 2

    Overview

    • Introduction

    • Logical Representation

    – Propositional Logic

    – Predicate Logic

    • Procedural representation

    • Network representation

    • Structured representation

    – Frames

    – Scripts

    – Ontology

  • 3

    Introduction

    • Knowledge Representation (KR) is an

    approach to Artificial Intelligence

    • The concept of KR is as old as AI

    • KR formalisms allows to represent and

    reasoning on knowledge

    • There are so many types of knowledge

    • Requires different ways to represent

    knowledge

  • 4

    Types of Knowledge

    • Static knowledge

    • Dynamic or active knowledge

    • Surface knowledge

    • Deep knowledge

    • Procedural knowledge

    • Declarative knowledge

    • Meta knowledge

    • Heuristic knowledge

  • 5

    Major KR Techniques

    • Logical Representation Schema

    • Procedural representation

    • Network representation

    • Structured representation

  • 6

    Logical representation

    • Oldest form of knowledge representation

    • Propositional and Predicate logic are so

    popular in KR in Artificial Intelligence

    • Precise representation and effective

    reasoning mechanism

  • 7

    Logic

    • A formal system for describing knowledge

    • Logic is a language

    • Logic deals with

    – Syntax

    – Semantics

    – Inference mechanism

    • Ontological/Epistemological concern

  • 8

    Ontology/Epistemology

    Language Ontology Epistemology

    Propositional logic Facts T/F/Unknown

    Predicate logic Facts, objects,

    relations

    T/F/unknown

    Temporal Logic Facts, objects,

    relations, time

    T/F/unknown

    Fuzzy logic Degree of truth Degree of belief

    0….1

  • Propositional logic

  • 10

    Propositional logic

    • Proposition is a statement (sentence) which is either true or false

    • Propositional symbols such as P, Q are used to represent sentences

    • The following logical connectives are used to combine propositions– ∩ conjunction (AND)

    – ∪ disjunction (OR)

    – ¬ not

    – → implies

    – ↔ equivalence or if and only if

  • Example

    • P means “It is hot.”

    • Q means “It is humid.”

    • R means “It is raining.”

    • (P Q) R “If it is hot and humid, then it is raining”

    • Q P “If it is humid, then it is hot”

    Budditha Hettige ([email protected]) 11

  • Example

    • Examples of propositions:– The Moon is made of green cheese.

    – Trenton is the capital of New Jersey.

    – Toronto is the capital of Canada.

    – 1 + 0 = 1

    – 0 + 0 = 2

    • Examples that are not propositions.– What time is it?

    – x + 1 = 2

    Source: (Richard Mayr University of Edinburgh, UK)

    7/11/2015 Budditha Hettige ([email protected]) 12

  • Syntax

    • Sequence of element of the vocabulary yields a formula

    • The formula which abide the rules of propositional logic is called well formed formula (WFF)– A symbol is a sentence

    – If S is a sentence, then S is a sentence

    – If S is a sentence, then (S) is a sentence

    – If S and T are sentences, then (S T), (S T), (S T), and (S ↔ T) are sentences

    Budditha Hettige ([email protected]) 13

  • Logical connectives

    • Disjunction

    The disjunction of propositions p and q is

    denoted by p ∨ q and has this truth table:

    7/11/2015 Budditha Hettige ([email protected]) 14

  • logical connectives

    • The Conjunction of propositions p and q is

    denoted by p ∧ q and has this truth table:

    7/11/2015 Budditha Hettige ([email protected]) 15

  • logical connectives

    • Implication

    – If p and q are propositions, then p → q is a

    conditional statement or implication which is

    read as “if p, then q” and has this truth table:

    7/11/2015 Budditha Hettige ([email protected]) 16

  • Implication

    • In p → q, p is the hypothesis (antecedent

    or premise) and q is the conclusion (or

    consequence).

    • Implication can be expressed by

    disjunction and negation: p → q ≡ ¬p ∨ q

    7/11/2015 Budditha Hettige ([email protected]) 17

  • Different Ways of Expressing p

    → q

    • if p, then q

    • p implies q

    • if p, q

    • p only if q

    • q unless ¬p

    • q when p

    • q if p

    • q whenever p

    • p is sufficient for q

    • q follows from p

    • q is necessary for p

    a necessary

    condition for p is q

    • a sufficient condition

    for q is p

    7/11/2015 Budditha Hettige ([email protected]) 18

  • Biconditional

    • If p and q are propositions, then the biconditional proposition p ↔ q has this truth table

    • p ↔ q also reads as

    – p if and only if q

    – p iff q.

    – p is necessary and sufficient for q

    – if p then q, and conversely

    – p implies q, and vice-versa

    7/11/2015 Budditha Hettige ([email protected]) 19

  • Precedence of Logical Operators

    1. ¬

    2. ∧

    3. ∨

    4. →

    5. ↔

    • Thus p ∨ q → ¬r is equivalent to (p ∨ q) → ¬r.

    • If the intended meaning is p ∨ (q → ¬r) then parentheses must be used.

    7/11/2015 Budditha Hettige ([email protected]) 20

  • Logical Equivalence

    • Definition

    – Two compound propositions p and q are logically equivalent if the columns in a truth table giving their truth values agree.

    – This is written as p ≡ q.

    • It is easy to show:Factp ≡ q if and only if p ↔ q is a tautology.

    7/11/2015 Budditha Hettige ([email protected]) 21

  • 22

    Propositional logic …

    • Assignment: each raw of a truth table

    • Interpretation: what each assignment yields

    • Model: an assignment that makes a true interpretation

    • Counter example: an assignment that makes a false interpretation

    • Tautology an expression whose interpretation is always true Example: p ∨ ¬p.

    • Contradiction: an expression whose interpretation is always false Example: p ∧ ¬p.

    • Equivalence - Two expressions with same interpretations

  • De Morgan’s Laws

    • ¬(p ∧ q) ≡ ¬p ∨ ¬q¬(p ∨ q) ≡ ¬p ∧ ¬q

    • Truth table proving De Morgan’s second

    law.

    7/11/2015 Budditha Hettige ([email protected]) 23

  • Logical Equivalences

    7/11/2015 Budditha Hettige ([email protected]) 24

  • 25

    Logical Equivalences contd.

    • (P) P

    • PQ QP

    • P Q PQ

    • (PQ) PQ

    • (PQ) PQ

    • P(QR) (PQ) (PR)

    • P Q Q P

  • Logical Equivalences contd.

    7/11/2015 Budditha Hettige ([email protected]) 26

    Conditional Biconditional

  • A Proof in Propositional Logic

    • To prove: ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q

    ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬(¬p ∧ q) by De Morgan’s 2nd law

    ≡ ¬p ∧ (¬(¬p) ∨ ¬q) by De Morgan’s first law

    ≡ ¬p ∧ (p ∨ ¬q) by the double negation law

    ≡ (¬p ∧ p) ∨ (¬p ∧ ¬q) by the 2nd distributive law

    ≡ F ∨ (¬p ∧ ¬q) because ¬p ∧ p ≡ F

    ≡ (¬p ∧ ¬q) ∨ F by commutativity of disj.

    ≡ ¬p ∧ ¬q by the identity law for F

    7/11/2015 Budditha Hettige ([email protected]) 27

  • Conjunctive and Disjunctive

    Normal Form

    • A literal is either a propositional variable, or the negation of one.

    – Examples: p, ¬p.

    • A clause is a disjunction of literals.

    – Example: p ∨ ¬q ∨ r.

    • A formula in conjunctive normal form (CNF) is a conjunction of clauses.

    – Example: (p ∨ ¬q ∨ r) ∧ (¬p ∨ ¬r)

    • Disjunctive normal form (DNF) by swapping the words ‘conjunction’ and ‘disjunction’ in the definitions above.

    – Example: (¬p ∧ q ∧ r) ∨ (¬q ∧ ¬r) ∨ (p ∧ r).

    7/11/2015 Budditha Hettige ([email protected]) 28

  • Transformation into Conjunctive

    Normal Form• Every propositional formula one can construct an equivalent

    one in conjunctive normal form.

    • Steps

    1. Express all other operators by conjunction, disjunction

    and negation.

    2. Push negations inward by De Morgan’s laws and the

    double negation law until negations appear only in

    literals.

    3. Use the commutative, associative and distributive laws

    to obtain the correct form.

    4. Simplify with domination, identity, idempotent, and

    negation laws.

    7/11/2015 Budditha Hettige ([email protected]) 29

  • Transformation into CNF

    Transform the following formula into CNF.¬(p → q) ∨ (r → p)

    Express implication by disjunction and negation.¬(¬p ∨ q) ∨ (¬r ∨ p)

    Push negation inwards by De Morgan’s laws and double negation.

    (p ∧ ¬q) ∨ (¬r ∨ p)Convert to CNF by associative and distributive laws.

    (p ∨ ¬r ∨ p) ∧ (¬q ∨ ¬r ∨ p)Optionally simplify by commutative and idempotent laws.

    (p ∨ ¬r) ∧ (¬q ∨ ¬r ∨ p)and by commutative and absorbtion laws

    (p ∨ ¬r)

    7/11/2015 Budditha Hettige ([email protected]) 30

  • Translating English Into Logic

    The word “but” in English is often translated as ∧.

    – Example: Today is is hot but it is not sunny.

    – Because the second part of the sentence is a surprise, “but” is used instead of “and”.

    – Example: Write each sentence in symbols, assigning propositional variables to statements as follows:

    • P: It is hot.

    • Q: It is sunny.

    – It is not hot but it is sunny.

    7/11/2015 Budditha Hettige ([email protected]) 31

  • Translating English Into Logic

    • Example:

    You can use the microlab only if you are a cs major or not a

    freshman.• P: You can use the microlab.

    • Q: You are a cs major.

    • R: You are a freshman.

    – Rewrite the statement using logical connectives.

    • Example:If it snows or rains today, I will not go for a walk.

    – Rewrite this proposition using logical connectives and propositional variables

    7/11/2015 Budditha Hettige ([email protected]) 32

  • Deriving the Semantic Values

    • If Peter and Susan leave, I will be upset

    – KEY: p = Peter leaves; q = Susan leaves; r = I

    will be upset.

    7/11/2015 Budditha Hettige ([email protected]) 33

  • Simplification

    • Example: Simplify the formula

    (P ∧ Q) ∨ ¬ (¬ P ∨ Q).

    • Solution

    7/11/2015 Budditha Hettige ([email protected]) 34

  • 35

    Propositional Logic..

    • An argument consists of a set of propositions called premises and another proposition called conclusion as in the following statement

    P1P2P3……Pn C

    • If the above statement is a tautology, then the argument is called valid

  • 36

    Reasoning – Example

    ((P Q)QP R) R

    LHS – ((P Q)QP R) (using modus tolens) P(P R) (P R)P (P R)P (using modus ponens) R (i.e. RHS)

    • Note that this can also be shown by using truth tables

    • Better way would be use CNF and method of contradiction

  • 37

    Conjunctive normal forms

    • We can express propositional logic formulae as conjunct of disjunction (CNF)

    • Procedure– Eliminate , replacing PQ with

    (P Q)(Q P)

    – Eliminate , replacing P Q with PQ

    – Push negation in using• (P) P, (PQ) PQ, (PQ) PQ

    – Distribute over (break at sign)

    • With the use of CNF proof can be done by using the method of contradiction

  • 38

    Example

    • Consider the paragraph:If Sarath works hard and or lucky he can pass the exam. Sarath is curious but he is not lucky. If sarath is curious then he works hard.

    • From this paragraph, check whether sarath can pass the exam.

    • Let P- sarath works hard,

    Q- Luck

    S- sarath is curious

    R- pass exam

  • 39

    Example…Then the paragraph can be written in propositional logic as follows

    (PQ) R ----(a)

    SQ ----(b)

    S P ----(c)Convert these into CNF

    (a) Eliminate , we get (PQ)R

    remove , then get (PQ)R

    R(PQ)

    (R P) (RQ)

    break at sign

    (R P) ----(a1)

    (RQ) ----(a2)

    (b) Only the last step apply

    S ----(b1)

    Q ----(b2)

    ( c) elimination

    SP ----(c1)

  • 40

    Example …..

    Thus CNF are as follows(R P) ----(a1)

    (RQ) ----(a2)

    S ----(b1)

    Q ----(b2)

    SP ----(c1)

    Suppose we want to show sarath can pass the exam.

    For this purpose, assume its negation is true add it as a new CNF

    to the system, i.e. R.

    R ----(d1)

    Then resolve the above and try to get a contradiction as follows

  • 41

    Example …

    R P R

    P SP

    S S

    { }

    Therefore, we conclude that R is true

  • Limitations of Propositional logic

    • Inability to generalize

    • Inability to represent internal information

    • Example: Suppose we have:• “All men are mortal.”

    • “Socrates is a man”.

    • Does it follow that “Socrates is mortal” ?

    – This cannot be expressed in propositional logic.

    – We need a language to talk about objects, their properties and their relations.

    7/11/2015 Budditha Hettige ([email protected]) 42

  • Predicate Logic

  • 44

    First-order Logic

    • This is also known as predicate logic• Address the issues of propositional logic• Predicates are defined as objects with

    properties– E.g. fruit(mango).– fruit is name of the predicate and mango is a property

    • Using a variable for a property we can achieve generalization

    • Predicate name tells us about what the predicate represents

    • Quantifiers can be used to define the scope of variables

  • 45

    Syntax of first-order logic

    • Sentence AtomicSentence |Sentence Connective Sentence |Quantifier Variable Sentence

    | Sentence

    • AtomicSentences Predicate(Term, ....)Term =Term

    • Term Function (Term, …)

    | Constant

    | Variable

    • Connectives |||

    • Quantifier |

    • Constant A|X1|Asoka| ….

    • Variable a|x| ….

    • Predicate Before|Hascolour|Raining|.....

    • Functions Mother|….

  • 46

    Quantifiers in FOL

    • x universal quantifiers

    – Read as for all x

    • x – existential quantifier

    – Read as for some, there exists

  • 47

    Examples

    • Everything is fine x fine(x)

    • Something is expensive x expensive(x)

    • All dogs are animal

    – x dog(x) animal(x)

    • Some dogs are friendly

    – x dog(x) friendly(x)

    • Nothing is fine x fine(x)

    • Not everything is fine x fine(x)

  • 48

    Order of quantifiers

    • xy P(x,y) yx P(x,y)

    • x y P(x,y) y x P(x,y)

    • xy P(x,y) yx P(x,y)

  • 49

    Inference in First-order logic

    • Most useful rule is the modus ponens

    – P(a), P(x) Q(x)├ Q(a)

    • This happens through substitution for

    variables and unification

  • Modus ponens Example

    • If it is raining, I will meet you at the theater.

    It is raining. Therefore, I will meet you at

    the theater.

    • Modus ponens can be stated formally as:

    7/11/2015 Budditha Hettige ([email protected]) 50

  • 51

    Conversion procedure FOL to CNF

    step 1: remove all “=>” and “” operators

    (using P => Q ~P v Q and P Q P => Q ^ Q => P)

    step 2: move all negation signs to individual predicates

    (using de Morgan’s law)step 3: remove all existential quantifiers y

    case 1: y is not in the scope of any universally quantified variable, then replace all occurrences of y by a skolem constant

    case 2: if y is in scope of universally quantified variables x1, ... xi,then replace all occurrences of y by a skolem function

    with x1, ... xi are its argument

    step 4: remove all universal quantifiers x (with the understanding that all remaining variables are universally quantified)

    step 5: convert the sentence into CNF (using distribution law, etc) step 6: use parenthesis to separate all disjunctions, then drop all v’s

    and ^’s

  • 52

    Example – FOL to CNF

    • Consider the sentence “every one who loves all animals is loved by someone”x [y animal(y)loves(x,y)] [y loves(y,x)]

    • Using S1 (note replacing P Q with PQ)

    x [ y animal(y)loves(x,y)][y loves(y,x)]

    • Using S2 push inwards

    x [y (animal(y)loves(x,y))][y loves(y,x)]

    x [y animal(y)loves(x,y))][y loves(y,x)]

    x [y animal(y)loves(x,y))][y loves(y,x)]

  • 53

    Example – FOL to CNF…

    • Use S3 to rename variable not to appear twice

    x [y animal(y)loves(x,y))][z loves(z,x)]• Use S4 to introduce constants to existential

    quantifiers

    x [animal(A)loves(x,A))]loves(B,x)Note: this A can be a F(x) and B is G(x) as they depend on x

    x [animal(F(x))loves(x,F(x)))]loves(G(x),x)

  • 54

    Example – FOL to CNF…

    • Use S5

    [animal(F(x))loves(x,F(x)))]loves(G(x),x)

    • Use S6

    [animal(F(x))loves(G(x),x)]

    [loves(x,F(x)))loves(G(x),x)]

  • Proof by contradiction

  • 56

    Resolution Proof - Example

    • Consider the exampleEvery one who loves all animals is loved by someone.

    Anyone who kills an animal is loved by no one

    Jack loves all animals

    Either Jack or Curiosity killed the cat, who is named Tuna

    Did Curiosity kill the cat?

    • Write these sentences in predicate logic (FOL)

    • Covert them into corresponding CNF

  • 57

    Writing in FOL

    A. x [y animal(y)loves(x,y)] [y loves(y,x)]

    B. x [y animal(y) kills(x,y)] [z loves(z,x)]

    C. x animal(x) loves(Jack,x)

    D. kills(Jack,Tuna) kills(Curiosity, Tuna)E. Cat(Tuna)

    F. x cat(x) animal(x)

    G. kills(Curiosity, Tuna) Note that we have assumed that Curiosity did not kills Tuna, as

    we prove this using method of contradiction

  • 58

    Corresponding CNF

    A1 animal(F(x)) loves(G(x), x)

    A2 loves(x,F(x)) loves(G(x), x)

    B aniaml(y)kills(x,y) loves(z,x)

    C aniaml(x)loves(Jack,x)

    D kills(Jack, Tuna) kills(Curiosity, Tuna)

    E cat(Tuna)

    F cat(x) animal(x)

    G kills(Curiosity, Tuna)

  • 59

    Example of Automatic Theorem Proof:Did Curiosity kill the cat

    • Jack owns a dog. Every dog owner is an animal lover. No animal lover kills an animal. Either Jack or Curiosity killed the cat, who is named Tuna. Did Curiosity kill the cat?

    • These can be represented as follows:A. (x) Dog(x) ^ Owns(Jack,x)

    B. (x) ((y) Dog(y) ^ Owns(x, y)) => AnimalLover(x)

    C. (x) AnimalLover(x) => (y) Animal(y) => ~Kills(x,y)

    D. Kills(Jack,Tuna) v Kills(Curiosity,Tuna)

    E. Cat(Tuna)

    F. (x) Cat(x) => Animal(x)Q. Kills(Curiosity, Tuna)

  • 60

    • Convert to clause form

    A1. (Dog(D)) /* D is a skolem constant */

    A2. (Owns(Jack,D))

    B. (~Dog(y), ~Owns(x, y), AnimalLover(x))

    C. (~AnimalLover(x), ~Animal(y), ~Kills(x,y))

    D. (Kills(Jack,Tuna), Kills(Curiosity,Tuna))

    E. Cat(Tuna)

    F. (~Cat(x), Animal(x))

    • Add the negation of query:

    Q: (~Kills(Curiosity, Tuna))

  • 61

    • The resolution refutation proofR1: Q, D, {}, (Kills(Jack, Tuna))

    R2: R1, C, {x/Jack, y/Tuna},

    (~AnimalLover(Jack), ~Animal(Tuna))

    R3: R2, B, {x/Jack}, (~Dog(y), ~Owns(Jack, y),

    ~Animal(Tuna))

    R4: R3, A1, {y/D}, (~Owns(Jack, D),

    ~Animal(Tuna))

    R5: R4, A2, {}, (~Animal(Tuna))

    R6: R5, F, {x/Tuna}, (~Cat(Tuna))

    R7: R6, E, {} ()

  • 62

    Proof by contradiction

    cat(Tuna) cat(x) animal(x) kills(Jack, Tuna)kills(Curiosity, Tuna)

    kills(Curiosity, Tuna)

    animal(Tuna)

    kills(Jack, Tuna)

    aniaml(y)kills(x,y) loves(z,x)

    kills(x,Tuna)loves(z,x)

    loves(z,Jack)

    loves(x,F(x)) loves(G(x), x)

    aniaml(x)loves(Jack,x)

    aniaml(F(Jack)) loves(G(Jack), Jack)

    animal(F(x)) loves(G(x), x)

    loves(G(Jack), Jack)

    loves(z, Jack)

    { }

  • 63

    Horn Clauses

    • A Horn clause is a clause with at most one positive literal:

    (~P1(x), ~P2(x), ..., ~Pn(x) v Q(x)), equivalent to

    x P1(x) ^ P2(x) ... ^ Pn(x) => Q(x) or

    Q(x)

  • 64

    Procedural Representation

    • This is the rule-based representation of

    knowledge

    • In this approach knowledge is represented

    in the form of

    IF

    THEN

    ELSE

  • 65

    Examples– rule-based representation

    • IF you follow lectures and do assignment

    THEN you will pass the examination.

    • IF you pass the exam THEN you will find a

    job ELSE you should change the career

    path

  • 66

    Production Systems

    • Expert systems that use rule-based KR

    are called production systems

    • Rules-based KR is the most widely use

    KR technique for Expert systems

  • 67

    Inference in rule-based representation

    • Backward chaining

    – Begins with a hypothesis, matches with the

    head of a rule and tries to satisfy its body by

    matching with head of another rule

    – By default Prolog operates in this manner

    • Forward chaining

    – Begins with facts, and tries to derive moving

    towards conclusion.

  • 68

    Example – Rule-based KB

    kitchen

    br hall

    leak_in_bathroom :- hall_wet, kitechn_dry

    problem_in-kitechen :- hall_wer,bathroom_dry

    no_water_fron_out_side :- window_closed

    ; no_rain

    leak_in_kichen :- problem_in_kitchen,

    no_water_from out_side

    Some Observations as facts

    hall_wet.

    bathroom_dry.

    window_closed.

    Query ?- leak_in_kitchen.

    yes

  • 69

    Inference network

    kitechn_dry

    leak_in_bathroom

    hall_wet

    problem_in_kitchen

    bathroom_dry

    leak_in_kitchen

    window_closed

    no_water_from_outside

    no_rain

  • 70

    Backward chaining example

    • Begin with the hypothesis say, leak_in_kitchen

    • Moving backward, to confirm this we need problem_in_kitchen and

    no_water_from_outside to be true

    • The former is confirmed with hall_wet and bathroom_dry

    • Latter is confirmed, say by knowing window_is_closed

    • Thus our hypothesis is proved.

    • Note: BC begins with the goal in mind. So, good for problems when

    the goal is known.

    • E.g. diagnosis

  • 71

    Forward chaining example

    • Start with some known facts (but not from a hypothesis)

    • For example, having noticed the hall_wet and bathroom_dry concludes that problem_in_kitchen

    • Having noticed, window_closed the concludes no_water_from_outside

    • From the above two, we conclude leak_in_kitchen

    • Note: if we begin with facts, kitchen_dry and hall_wet we get unnecessary conclusion, leak_in_bath_room

    • As such FC can go ahead with unnecessary derivations, without an idea about a goal

    • Good for configuration, planning, design problems

  • 72

    Advantages of rules

    • Easy to implement

    • Easy to drive process reasoning

    • Easy to modify and maintain

    • Can extend incorporating concepts such

    as uncertainty

  • 73

    Network Representation

    • A graphical representation of knowledge

    • It comprises of nodes and links

    • The nodes represent objects/entities, while

    links represent relationships

    • Semantic Network is the well-known

    network representation of knowledge

  • 74

    Example 1 - Semantic networks

    buddithaAI

    teaches

    lecturer

    Is_a

    Human

    being

    Is_a

    writing

    enjoys

    needs

    food

    Semantic net represents inheritance

    For example, ‘budditha is_a lecturer, lecturer is_a

    human being, human being needs food infer that

    Budditha needs food

  • 75

    Example 2 – Semantic network

    Ostrich

    bird

    cannot flyhas_feature

    can fly

    has_feature

    is_a

    animal

    subset

    Can move

    has_feature

    Due to inheritance from superior

    nodes we can conclude that

    (i) Ostrich can move

    (ii) Ostrich can fly

    However, local assigned attribute can override inherited attributes

    Therefore, we can conclude that Ostrich cannot fly

  • 76

    Comments on Semantic networks

    • Easy to understand

    • Large domains may need very complex

    semantic networks

    • Cannot represent negations, disjunction,

    variables and quantifiers

    • Yet, we can include logic and rules with

    semantic networks to overcome the above

    issue

  • 77

    Structured Representation

    • There are two major types of structured

    representations of knowledge

    – Frames

    – Scripts

  • 78

    Frames

    • A frame is a collective description

    • As such, frames are more comprehensive

    than nodes in a semantics network

    • The concept of frames has been influential

    to develop the modern object-oriented

    representation too

    • A frame comprises of its name, slots

    (attribute) and filers (values)

  • 79

    Example - FrameConsider the following frame describing about a car

    Vehicle: car

    Make: Toyota

    Model: 1002

    Fuel: diesel

    Name of the frame

    slots

    value

    Note: we can define new frames by referring to values of slots of a given frame

    For example, we define new frame as vehicle:Toyota and link the new

    frame with the above frame through the slot called ‘Make’

    So we can have a network of frames

  • 80

    Comments on Frames

    • Frames are more comprehensive than

    semantics networks

    • Frames can also be manipulated through

    concepts such as inheritance

    • However, Frames can represent only the

    Static descriptions, but not dynamic

    scenarios.

  • 81

    Scripts

    • Scripts can represent dynamic scenarios

    • Its inspired by the concept of script in film

    and drama

    • As such scripts are modeled in terms of

    props, actors, acts, scene, etc.

  • 82

    Components of a script

    • Entry conditions– Assumption about the world for a script to begin (e.g. fight)

    • Results– Condition to meet once the script terminate

    • Props– Things that are involved in the scene (tables, etc.)

    • Roles– People and actions

    • Scenes– Temporal sequence of the sub-event in a script

  • 83

    Ontology

    • Ontology has many definitions

    • It’s a specification something showing related

    entities

    • It’s about categories of objects

    • More comprehensive than objects in isolation

    • Next paradigm for KR and computing

    • Many tools are available for ontological

    modelling (OntoWeb)

  • 84

    Ontology: Origins and History

    Ontology in Philosophy

    A philosophical discipline - a branch of philosophy that deals with the nature and the organisation of reality

    Science of Being (Aristotle, Metaphysics, IV, 1) Tries to answer the questions:

    What characterizes being?Eventually, what is being?

  • 85

    Ontology in Linguistics

    ReferentFormStands for

    Relates toactivates

    Concept

    [Ogden, Richards, 1923]

    “Tank“ ?

  • 86

    Ontology Definition

    Formal, explicit specification of a shared conceptualization

    commonly accepted

    understanding

    conceptual model

    of a domain

    (ontological theory)

    unambiguous

    terminology definitions

    machine-readability

    with computational

    semantics

    [Gruber93]

  • 87

    Ontology in Computer Science

    • An ontology is an engineering artifact:

    – It is constituted by a specific vocabulary used to describe a certain reality, plus

    – a set of explicit assumptions regarding the intended meaning of the vocabulary.

    • Thus, an ontology describes a formal specification of a certain domain:

    – Shared understanding of a domain of interest

    – Formal and machine manipulable model of a domain of interest

  • 88

    Structure of an Ontology

    Ontologies typically have two distinct components:

    Names for important concepts in the domain– Elephant is a concept whose members are a kind of animal

    – Herbivore is a concept whose members are exactly those animals who eat only plants or parts of plants

    – Adult_Elephant is a concept whose members are exactly those elephants whose age is greater than 20 years

    • Background knowledge/constraints on the domain– Adult_Elephants weigh at least 2,000 kg

    – All Elephants are either African_Elephants or Indian_Elephants

    – No individual can be both a Herbivore and a Carnivore

  • 89

    Ontology Example

    Concept conceptual entity of the domain

    Attributeproperty of a concept

    Relation relationship between concepts or properties

    Axiom coherent description between Concepts / Properties / Relations via logical expressions

    Person

    Student Professor

    Lecture

    isA – hierarchy (taxonomy)

    name email

    studentnr.

    researchfield

    topiclecture

    nr.

    attendsholds

    holds(Professor, Lecture) Lecture.topic Professor.researchField

  • 90

    Ontology Elements

    • Concepts (classes) + their hierarchy

    • Concept properties (slots/attributes)

    • Property restrictions (type, cardinality,

    domain)

    • Relations between concepts (disjoint,

    equality)

    • Instances

  • 91

    How to build an ontology?

    • Steps:

    – determine domain and scope

    – enumerate important terms

    – define classes and class hierarchies

    – define slots

    – define slot restrictions (cardinality, value-type

  • 92

    Step 1: Determine Domain and Scope

    Domain: geography

    Application: route planning agent

    Possible questions:Distance between two cities?

    What sort of connections exist between two cities?In which country is a city?How many borders are crossed?

  • 93

    Step 2: Enumerate Important Terms

    country

    city capital

    border

    connection

    Connection_on_land

    Connection_in_air

    Connection_on_water

    road

    railway

    currency

  • 94

    Step 3: Define Classes and Class Hierarchy

  • 95

    Step 4: Define Slots of Classes

    Geographic_entity

    Country CityHas_capital

    Capital_ofBorders_with

    ConnectionStart_point

    End_point

    Capital_city

  • 96

    Step 5: Define slot constraints

    • Slot-cardinality

    – Ex: Borders_with multiple, Start_point single

    • Slot-value type

    – Ex: Borders_with- Country

  • 97

    Many languages use “object oriented”

    model based on:

    • Objects/Instances/Individuals– Elements of the domain of discourse

    – Equivalent to constants in FOL

    • Types/Classes/Concepts– Sets of objects sharing certain characteristics

    – Equivalent to unary predicates in FOL

    • Relations/Properties/Roles– Sets of pairs (tuples) of objects

    – Equivalent to binary predicates in FOL

    • Such languages are/can be:– Well understood

    – Formally specified

    – (Relatively) easy to use

    – Amenable to machine processing

  • 98

    Ontology-development tools

    • Protégé

    • OntoEdit

    • OilEd

    • Chimaera

    • …

  • Activity

    • Create a simple ontology using protege

    99

  • Thank you

    100