Knowledge engineering
KR is first and foremost about knowledge
meaning and entailment
find individuals and properties, then encode facts sufficient for entailments
Before implementing, need to understand clearly • whatistobecomputed?
• whyandwhereinferenceisnecessary?
Example domain: soap-opera world
people, places, companies, births, marriages, divorces, deaths, events, …
Task: KB with appropriate entailments • whatvocabulary?
• whatfactstorepresent?
KR & R © Brachman & Levesque 2005 Expressing Knowledge 1
Vocabulary
Domain-dependent predicates and functions
main question:
what are the individuals?
here: people, places, companies, …
named individuals
john, countryTown, faultyInsuranceCorp, fic, johnQsmith, …
basic types
Person, Place, Man, Woman, …
attributes
Rich, Beautiful, Unscrupulous, …
relationships
LivesAt, MarriedTo, DaughterOf, HairDresserOf, HadAnAffairWith, Blackmails, …
functions
fatherOf, ceoOf, bestFriendOf, …
KR & R © Brachman & Levesque 2005 Expressing Knowledge 2
Basic facts
Usually atomic sentences and negations
type facts
Man(john),
Woman(jane), Company(faultyInsuranceCorp)
property facts
Rich(john), ¬HappilyMarried(jim), W orksFor(jim,fic)
equality facts
john = ceoOf(fic),
fic = faultyInsuranceCorp, bestFriendOf(jim) = john
Like a simple database
could store these facts in relational tables
KR & R © Brachman & Levesque 2005 Expressing Knowledge 3
Complex facts
Universal abbreviations
“y[Woman(y) Ù y 1 jane É Loves(y,john)] “y[Rich(y) Ù Man(y) É Loves(y,jane)] “x”y[Loves(x,y) É ¬Blackmails(x,y)]
possible to express without quantifiers Incomplete knowledge
Loves(jane,john) Ú Loves(jane,jim) which?
$x[Adult(x) Ù Blackmails(x,john)] who?
cannot write down more complete version
Closure axioms
“x[Person(x) É x=jane Ú x=john Ú x=jim …] “x”y[MarriedTo(x,y) É … ]
“x[ x=fic Ú x=jane Ú x=john Ú x=jim …]
limits domain of discourse
also useful to have jane 1 john …
KR & R
© Brachman & Levesque 2005 Expressing Knowledge 4
Terminological facts
General relationships among predicates. For example:
disjoint
“x[Mammal(x) É ¬Reptile(x)] subtype
“x[Mammal(x) É Animal(x)] exhaustive
“x[Day(x) É Monday(x) Ú … Ú Sunday(x)] symmetry
“x”y [RelatedTo(x,y) É RelatedTo(y,x)] inverse
“x”y [ChildOf(x,y) É ParentOf(y,x)] type restriction
“x”y [MarriedTo(x,y) É Person(x) Ù Person(y)]
full definition
“x[RichMan(x) o Rich(x) Ù Man(x)]
Usually universally quantified conditionals or
biconditionals
KR & R © Brachman & Levesque 2005 Expressing Knowledge 5
Entailments: 1
Is there a company whose CEO loves Jane?
$x [Company(x) Ù Loves(ceoOf(x),jane)] ??
Suppose I |= KB.
Then I |= Rich(john), Man(john),
and I |= “y[Rich(y)ÙMan(y) É Loves(y,jane)] so I |= Loves(john,jane).
Also I |= john = ceoOf(fic),
so I |= Loves( ceoOf(fic),jane).
Finally I |= Company(faultyInsuranceCorp), and I |= fic = faultyInsuranceCorp,
so I |= Company(fic).
Thus, I |= Company(fic) Ù Loves( ceoOf(fic),jane), and so
I |= $x [Company(x) Ù Loves(ceoOf(x),jane)]. Can extract identity of company from this proof
KR & R © Brachman & Levesque 2005 Expressing Knowledge 6
Entailments: 2
If no man is blackmailing John, then is he being blackmailed by somebody he loves?
“x[Man(x) É ¬Blackmails(x,john)] É $y[Loves(john,y) Ù Blackmails(y,john)] ??
Note: KB|=(aÉb) iff KBÈ{a}|=b Assume: I |= KB È {“x[Man(x) É ¬Blackmails(x,john)]}
Show: I |= $y[Loves(john,y) Ù Blackmails(y,john)
Have: $x[Adult(x) Ù Blackmails(x,john)] and “x[Adult(x) É Man(x) ÚWoman(x)] so $x[Woman(x) Ù Blackmails(x,john)].
Then: “y[Rich(y) Ù Man(y) É Loves(y,jane)] and Rich(john) Ù Man(john)
so Loves(john,jane)!
But: “y[Woman(y) Ù y 1 jane É Loves(y,john)]
and “x”y[Loves(x,y) É ¬Blackmails(x,y)]
so “y[Woman(y) Ù y 1 jane É ¬Blackmails(y,john)] and… Blackmails(jane,john)
Finally: Loves(john,jane) Ù Blackmails(jane,john) so: $y[Loves(john,y) Ù Blackmails(y,john)]
Proof as sequence of sentences
KR & R © Brachman & Levesque 2005 Expressing Knowledge 7
What individuals?
Sometimes useful to reduce n-ary predicates to 1-place predicates and 1-place functions
• involvesreifyingproperties:newindividuals
• typicalofdescriptionlogics/framelanguages
Flexibility in terms of arity:
Purchases(john,sears,bike) or Purchases(john,sears,bike,feb14) or Purchases(john,sears,bike,feb14,$100)
Instead introduce purchase objects
Purchase(p) Ù agent(p)=john Ù obj(p)=bike Ù source(p)=sears Ù amount(p)=… Ù…
(later)
allows purchase to be described at various levels of detail Complex relationships:
MarriedTo(x,y) vs. PreviouslyMarriedTo(x,y) vs. ReMarriedTo(x,y)
Define marital status in terms of existence of marriages and divorces.
Marriage(m) Ù partner1(m)=x Ù partner2(m)=y Ù date(m)=… Ù witness(m)=… Ù …
KR & R
© Brachman & Levesque 2005 Expressing Knowledge 8
Abstract individuals
Also need individuals for numbers, dates, times, addresses, etc.
objects about which we ask wh-questions
Quantities as individuals
age(suzy) = 14
age-in-years(suzy) = 14 age-in-months(suzy) = 168
perhaps better to have an object for the age of Suzy, whose value in years is 14
years(age(suzy)) = 14 months(x) = 12*years(x) centimeters(x) = 100*meters(x)
Similarly with locations and times instead of
time(m)=”Jan 5 1992 4:47:03EST” can use
time(m)=t Ù year(t)=1992 Ù …
KR & R © Brachman & Levesque 2005 Expressing Knowledge 9
Other sorts of facts
Statistical / probabilistic facts
• HalfofthecompaniesarelocatedontheEastSide.
• Mostoftheemployeesarerestless.
• Almostnoneoftheemployeesarecompletelytrustworthy,
Default / prototypical facts
• Companypresidentstypicallyhavesecretariesintercepting their phone calls.
• Carshavefourwheels.
• Companiesgenerallydonotallowemployeesthatwork together to be married.
Intentional facts
• JohnbelievesthatHenryistryingtoblackmailhim.
• JanedoesnotwantJimtothinkthatshelovesJohn.
Others …
KR & R © Brachman & Levesque 2005 Expressing Knowledge 10