part 7: rules and ontologies. combining rules and ontologies we now know how to represent (possibly...

40
Part 7: Rules and Ontologies

Post on 22-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Part 7: Rules and Ontologies

Combining rules and ontologies

• We now know how to represent (possibly incomplete, evolving, etc) knowledge using rules, but assuming that the ontology is known.

• We also learned how to represent ontologies.• The close the circle, we need to combine both.• The goal is to represent knowledge with rules that

make use of an ontology for defining the objects and individuals – This is still a (hot) research topic!– Crucial for using knowledge represented by rules in the

context of the Web, where the ontology must be made explicit

Full integration of rules/ontologies

• Amounts to:– Combine DL formulas with rules having no restrictions

– The vocabularies are the same

– Predicates can be defined either using rules or using DL

• This approach encounters several problems– The base assumptions of DL and of non-monotonic

rules are quite different, and so mixing them so tightly is not easy

Problems with integration

• Rule languages (e.g. Logic Programming) use some form of closed world assumption (CWA)– Assume negation by default– This is crucial for reasoning with incomplete knowledge

• DL, being a subset of 1st order logics, has no closed world assumption– The world is kept open in 1st order logics (OWA)– This is reasonable when defining concepts– Mostly, the ontology is desirably monotonic

• What if a predicate is both “defined” using DL and LP rules?– Should its negation be assumed by default?– Or should it be kept open?– How exactly can one define what is CWA or OWA is this context?

CWA vs OWA

• Consider the program Pwine(X) ← whiteWine(X)nonWhiteWine(X) ← not whiteWine(X)wine(esporão_tinto)

and the “corresponding” DL theoryWhiteWine ⊑ Wine¬WhiteWine ⊑ nonWhiteWineesporão_tinto:Wine

• P derives nonWhiteWine(esporão_tinto) whilst the DL does not.

Modeling exceptions

• The following TBox is unsatisfiableBird ⊑ FliesPenguin ⊑ Bird ⊓ ¬Flies

• The first assertion should be seen as allowing exceptions

• This is easily dealt by nonmonotonic rule languages, e.g. logic programming, as we have seen

Problems with integration (cont)

• DL uses classical negation while LP uses either default or explicit negation– Default negation is nonmonotonic

– As classical negation, explicit negation also does not assume a complete world and is monotonic

– But classical negation and explicit negation are different

– With classical negation it is not possible to deal with paraconsistency!

Classical vs Explicit Negation

• Consider the program Pwine(X) ← whiteWine(X)¬wine(coca_cola)

• and the DL theoryWhiteWine ⊑ Winecoca_cola: ¬Wine

• The DL theory derives ¬WhiteWine(coca_cola) whilst P does not.– In logic programs, with explicit negation, contraposition of

implications is not possible/desired– Note in this case, that contraposition would amount to assume that

no inconsistency is ever possible!

Problems with integration (cont)

• Decidability is dealt differently:– DL achieves decidability by enforcing restrictions on

the form of formulas and predicates of 1st order logics, but still allowing for quantifiers and function symbols

• E.g. it is still possible to talk about an individual without knowing who it is:

hasMaker.{esporão} ⊑ GoodWine

– PL achieves decidability by restricting the domain and disallowing function symbols, but being more liberal in the format of formulas and predicates

• E.g. it is still possible to express conjunctive formulas (e.g. those corresponding to joins in relational algebra):

isBrother(X,Y) ← hasChild(Z,X), hasChild(Z,Y), X≠Y

Recent approaches to full integration

• Several recent (and in progress) approaches attacking the problem of full integration of DL and (nonmonotonic) rules:– Hybrid MKNF [Motik and Rosati 2007, to appear]

• Based on interpreting rules as auto-epistemic formulas (cf. previous comparison of LP and AEL)

• DL part is added as a 1st order theory, together with the rules

– Equilibrium Logics [Pearce et al. 2006]

– Open Answer Sets [Heymans et al. 2004]

Interaction without full integration

• Other approaches combine (DL) ontologies, with (nonmonotonic) rules without fully integrating them:– Tight semantic integration

• Separate rule and ontology predicates• Adapt existing semantics for rules in ontology layer• Adopted e.g. in DL+log [Rosati 2006] and the Semantic Web

proposal SWRL [w3c proposal 2005]– Semantic separation

• Deal with the ontology as an external oracle• Adopted e.g. in dl-Programs [Eiter et al. 2005] (to be studied

next)

Nonmonotonic dl-Programs• Extend logic programs, under the answer-set semantic,

with queries to DL knowledge bases• There is a clean separation between the DL knowledge

base and the rules– Makes it possible to use DL engines on the ontology and ASP

solver on the rules with adaptation for the interface• Prototype implementations exist (see dlv-Hex)

• The definition of the semantics is close to that of answer sets

• It also allows changing the ABox of the DL knowledge base when querying– This permits a limited form of flow of information from the LP

part into the DL part

dl-Programs

• dl-Programs include a set of (logic program) rules and a DL knowledge base (a TBox and an ABox)

• The semantics of the DL part is independent of the rules– Just use the semantics of the DL-language, completely

ignoring the rules• The semantics of the dl-Program comes from the

rules– It is an adaptation of the answer-set semantics of the

program, now taking into consideration the DL (as a kind of oracle)

dl-atoms to query the DL part

• Besides the usual atoms (that are to be “interpreted” on the rules), the logic program may have dl-atoms that are “interpreted” in the DL part

• Simple example:DL[Bird](“tweety”)

– It is true in the program if in the DL ontology the concept Bird includes the element “tweety”

• Usage in a ruleflies(X) ← DL[Bird](X), not ab(X)

– The query Bird(X) is made in the DL ontology and used in the rule

More on dl-atoms• To allow flow of information from the rules to the

ontology, dl-atoms allow to add elements to the ABox before querying

DL[Penguin ⊎ my_penguin;Bird](X)– First add to the ABox p:Penguin for each individual p

such that my_penguin(p) (in the rule part), and then query for Bird(X)

• Additions can also be made for roles (with binary rule predicates) and for negative concepts and roles. Eg:

DL[Penguin ⊌ nonpenguin;Bird](X)– In this case p:¬Penguin is added for each

nonpenguin(p)

The syntax of dl-Programs

• A dl-Program is a pair (L,P) where– L is a description logic knowledge base– P is a set of dl-rules

• A dl-rule is:H A1, …, An, not B1, … not Bm (n,m 0)

where H is an atom and Ais and Bis are atoms or dl-atoms• A dl-atom is:

DL[S1 op1 p1, …, Sn opn pn;Q](t) (n 0)where Si is a concept (resp. role), opi is either ⊎ or ⊌, pi is a unary (resp. binary) predicate and Q(t) is a DL-query.

DL-queries

• Besides querying for concepts, as in the examples, dl-atoms also allow querying for roles, and concept subsumption.

• A DL-query is either– C(t) for a concept C and term t

– R(t1,t2) for a role R and terms t1 and t2

– C1 ⊑ C2 for concepts C1 and C2

Interpretations in dl-Programs

• Recall that the Herbrand base HP of a logic program is the set of all instantiated atoms from the program, with the existing constants

• In dl-programs constants are both those in the rules and the individuals in the ABox of the ontology

• As usual a 2-valued interpretation is a subset of HP

Satisfaction of atoms wrt L

• Satisfaction wrt a DL knowledge base L– For (rule) atoms

I |=L A iff A ∈ I

I |=L not A iff A ∉ I

– For dl-atomsI |=L DL[S1 op1 p1, …, Sn opn pn;Q](t) iff

L A1(I) … An(I) |= Q(t)

where– Ai(I) = {Si(c) | pi(c) ∈ I} if opi is ⊎

– Ai(I) = {¬Si(c) | pi(c) ∈ I} if opi is ⊌

Models of a Program• Models can be defined for other formulas by extending |= with:

– I |=L not A iff I |≠L A– I |=L F, G iff I |=L F and I |=L G– I |=L H G iff I |=L A or I |≠L Gfor atom H, atom or dl-atom A, and formulas F and G

• I is a model of a program (L,P) iffFor every rule H G ∈ P, I |=L H G

• I is a minimal model of (L,P) iff there is no other I’ ⊂ I that is a model of P

• I is the least model of (L,P) if it is the only minimal model of (L,P)

• It can be proven that every positive dl-program (without default negation) has a least model

Alternative definition of Models

• Models can also be defined similarly to what has been done above for normal programs, via an evaluation function ÎL:– For an atom A, ÎL(A)=1 if I |=L A, and = 0 otherwise– For a formula F, ÎL(not F) = 1 - ÎL(F)– For formulas F and G:

• ÎL((F,G)) = min(ÎL(F), ÎL(G))• ÎL(F G)= 1 if ÎL(F) ÎL(G), and = 0 otherwise

• I is a model of (L,P) iff, for all rule H B of P:

ÎL(H B) = 1• This definition easily allows for extensions to 3-valued

interpretations and models (not yet explored!)

Reduct of dl-Programs

• Let (L,P) be a dl-Program• Define the Gelfond-Lifshitz reduct P/I as for

normal programs, treating dl-atoms as regular atoms

• P/I is obtained from P by– Deleting all rules whose body contains not A and

I |=L A (being A either a regular or dl-atom)– Deleting all the remaining default literals

Answer-sets of dl-Programs

• Let least(L,P) be the least model of P wrt L, where P is a positive program (i.e. without negation by default)

• I is an answer-set of (L,P) iffI = least(L,P/I)

• Explicit negation can be used in P, and is treated just like in answer-sets of extended logic programs

Some properties

• An answer-sets of dl-Program (L,P) is a minimal model of (L,P)

• Programs without default nor explicit negation always have an answer-set

• If the program is stratified then it has a single answer-set

• If P has no DL atoms then the semantics coincides with the answer-sets semantics of normal and extended programs

An example (from [Eiter et al 2006])

• Assume the w3c wine ontology, defining concepts about wines, and with an ABox with several wines

• Besides the ontology, there is a set of facts in a LP defining some persons, and their preferences regarding wines

• Find a set of wines for dinner that makes everybody happy (regarding their preferences)

Wine Preferences Example%Get wines from the ontology

wine(X) ← DL[“Wine”](X)%Persons and preferences in the program

person(axel). preferredWine(axel,whiteWine).person(gibbi). preferredWine(gibbi,redWine)person(roman). preferredWine(roman,dryWine)

%Available bottles a person likeslikes(P,W) ← preferredWine(P,sweetWine), wine(W), DL[“SweetWine”](W).likes(P,W) ← preferredWine(P,dryWine), wine(W), DL[“DryWine”](W).likes(P,W) ← preferredWine(P,whiteWine), wine(W), DL[“WhiteWine”](W).likes(P,W) ← preferredWine(P,redWine), wine(W), DL[“RedWine”](W).

%Available bottles a person dislikesdislikes(P,W) ← person(P), wine(W), not likes(P,W)

%Generation of various possibilities of choosing winesbottleChosen(W) ← wine(W), person(P), likes(P,W), not nonChosen(P,W)nonChosen(W) ← wine(W), person(P), likes(P,W), not bottleChosen(P,W)

%Each person must have of bottle of his preferencehappy(P) ← bottleChosen(W), likes(P,W).false ← person(P), not happy(P), not false.

Wine example continued

• Suppose that later we learn about some wines, not in the ontology

• One may add facts in the program for such new wines. Eg:

white(joão_pires). ¬dry(joão_pires).• To allow for integrating this knowledge with that of

the ontology, the 1st rule must be changedwine(X) ←

DL[“WhiteWine”⊎white,“DryWine”⊌¬dry;“Wine”](X)• In general more should be added in this rule (to allow

e.g. for adding, red wines, non red, etc…)• Try more examples in dlv-Hex!

About other approaches

• This is just one of the current proposals for mixing rules and ontologies

• Is this the approach?– There is currently debate on this issue

• Is it enough to have just a loosely coupling of rules and ontologies?– It certainly helps for implementations, as it allows for

re-using existing implementations of DL alone and of LP alone.

– But is it expressive enough in practical?

Extensions• A Well-Founded based semantics for dl-Programs [Eiter et al. 2005] exists

– But such doesn’t yet exists for other approaches• What about paraconsistency?

– Mostly it is yet to be studied!• What about belief revision with rules and ontologies?

– Mostly it is yet to be studied!• What about abductive reasoning over rules and ontologies?

– Mostly it is yet to be studied!• What about rule updates when there is an underlying ontology?

– Mostly it is yet to be studied!• What about updates of both rules and ontologies?

– Mostly it is yet to be studied!• What about … regarding combination of rules and ontologies?

– Mostly it is yet to be studied!• Plenty of room for PhD theses!

– Currently it is a hot research topic with many applications and crying out for results!

Part 8: Wrap up

What we have studied (in a nutshell)• Logic rule-based languages for representing

common sense knowledge– and reasoning with those languages

• Methodologies and languages for dealing with evolution of knowledge– Including reasoning about actions

• Languages for defining ontologies• Briefly on the recent topic of combining

rules and ontologies

What we have studied (1)• Logic rule-based languages for representing

common sense knowledge– Started by pointing about the need of non-monotonicity

to reason in the presence of incomplete knowledge

– Then seminal nonmonotonic languages• Default Logics

• Auto-epistemic logics

– Focused in Logic Programming as a nonmonotonic language for representing knowledge

What we have studied (2)• Logic Programming for Knowledge

Representation– Thorough study of semantics

• of normal logic programs• of extended (paraconsistent) logic programs• including state of the art semantics and corresponding systems

– Corresponding proof procedures allowing for reasoning with Logic Programs

– Programming under these semantics• Answer-Set Programming• Programming with tabling

– Example methodology for representing taxonomies

What we have studied (3)• Knowledge evolution

– Methods and semantics for dealing with inclusion of new information (still in a static world)

• Introduction to belief revision of theories• Belief revision in the context of logic programming• Abductive Reasoning in the context of belief

revision• Application to model based diagnosis and

debugging

– Methods and languages for knowledge updates

What we have studied (4)• Methods and languages for knowledge

updates– Methodologies for reasoning about changes

• Situation calculus• Event calculus

– Languages for describing knowledge that changes

• Action languages• Logic programming update languages

– Dynamic LP and EVOLP with corresponding implementations

What we have studied (5)• Ontologies for defining objects, concepts, and

roles, and their structure– Basic notions of ontologies

– Ontology design (exemplified with Protégé)

• Languages for defining ontologies– Basic notions of description logics for representing

ontologies

• Representing knowledge with rules and ontologies– To close the circle

– Still a hot research topic

What type of issues• A mixture of:

– Theoretical study of classical issues, well established for several years

• E.g. default and autoepistemic logics, situation and event calculus, …

– Theoretical study of state of the art languages and corresponding system

• E.g. answer-sets, well-founded semantics, Dynamic LPs, Action languages, EVOLP, Description logics, …

– Practical usage of state of the art systems• E.g. programming with ASP-solvers, with XSB-Prolog, XASP, …

– Current research issues with still lots of open topics• E.g. Combining rules and ontologies

What next in UNL?For MCL only, sorry

• Semantic Web– Where knowledge representation is applied to the domain of the

web, with a big emphasis on languages for representing ontologies in the web

• Agents– Where knowledge representation is applied to multi-agent

systems, with a focus on knowledge changes and actions

• Integrated Logic Systems– Where you learn how logic programming systems are

implemented

• Project– A lot can be done in this area.– Just contact professors of these courses!

What next in partner Universities?Even more for MCL, this time 1st year only

• In FUB– Module on Semantic Web, including course on Description Logics

• In TUD– Advanced course in KRR with seminars on various topics (this year F-

Logic, abduction and induction, …)– General game playing, in which KRR is used for developing general game

playing systems– Advanced course in Description Logics

• In TUW– Courses on data and knowledge based systems, and much on answer-set

programming

• In UPM– Course on intelligent agents and multi-agent systems– Course on ontologies and the semantic web

The EndFrom now onwards it is up to you!

Study for the exam and do the project

I’ll always be available to help!