reasoning with rules
play

Reasoning with Rules SWRL as Example Jan Pettersen Nytun, UIA 1 - PowerPoint PPT Presentation

Reasoning with Rules SWRL as Example Jan Pettersen Nytun, UIA 1 JPN, UiA 2 What is a rule? Consist of premise and a conclusion. Meaning: In any situation where the premise applies the conclusion must also hold. premise conclusion


  1. Reasoning with Rules SWRL as Example Jan Pettersen Nytun, UIA 1

  2. JPN, UiA 2

  3. What is a rule? • Consist of premise and a conclusion. • Meaning: In any situation where the premise applies the conclusion must also hold. premise  conclusion JPN, UiA 3

  4. Agenda  Different Types of Reasoning • Inductive reasoning • Deductive reasoning • Abductive reasoning  Why rules?  The Semantic Web Rule Language (SWRL)  SWRL Types of Atoms  SWRL Example  SWRL Exercise 4

  5. Inductive Reasoning From Wikipedia, the free encyclopedia … the premises are viewed as supplying strong evidence for the truth of the conclusion. … conclusion of a deductive argument is certain, the truth of the conclusion of an inductive argument is probable , based upon the evidence given. … premise  conclusion Not as strong as for deductive reasoning JPN, UiA 5

  6. Inductive Reasoning S O P From Wikipedia, the free encyclopedia …the premises of an inductive logical argument indicate some degree of support for the conclusion but do not entail it ... derives general principles from specific observations based on observations premise  conclusion Likely to be true JPN, UiA 6

  7. Inductive Reasoning Example Many observations indicate that humans eventually dies, i.e., humans are mortals. Human(x)  Mortal(x) JPN, UiA 7

  8. Deductive Reasoning also Called Deductive Logic, Logical Deduction From Wikipedia, the free encyclopedia • If all premises are true, and the rules of deductive logic are followed, then the conclusion reached is necessarily true. • In inductive reasoning, the conclusion is reached by generalizing or extrapolating from specific cases to general rules, i.e., there is … uncertainty. • However, induction used in mathematical proofs is actually a form of deductive reasoning. JPN, UiA 8

  9. Deductive Reasoning Example All men are mortal. Socrates is a man. ------------------------------ Therefore, Socrates is mortal. JPN, UiA 9

  10. Deductive Reasoning Example in First Order Predicate Logic All men are mortal. Socrates is a man. ------------------------------ Therefore, Socrates is mortal. ∀ x.Man(x)  Mortal(x) -- All men are mortal Man(Socrates) -- Socrates is a man -------------------------------------------------------------------------- Man(Socrates)  Mortal(Socrates). -- Socrates is mortal JPN, UiA 10

  11. From Wikipedia, the free encyclopedia JPN, UiA 11

  12. [https://explorable.com/inductive-reasoning] Theories have to be tested and hypotheses answered before the scientific community accepts them as truth. JPN, UiA 12

  13. Abductive Reasoning From Wikipedia, the free encyclopedia Example: The grass is wet; if it rained last night, then it would be unsurprising that the grass is wet. Therefore, by abductive reasoning, the possibility that it rained last night is reasonable. RaindLastNight  GrassIsWeet Some other process could have also resulted in a wet grass, such as sprinklers. Consequently, abducing that it rained last night from the observation of wet grass can lead to a false conclusion. SprinklerWasOn  GrassIsWeet JPN, UiA 13

  14. Abductive Reasoning Continues… • Inference to the best explanation. • Given a true conclusion and a rule , it attempts to select some possible premises that, if true also, can support the conclusion , though not uniquely. RaindLastNight  GrassIsWeet SprinklerWasOn  GrassIsWeet • Can be used to develop a hypothesis, which in turn can be tested by additional reasoning or data. JPN, UiA 14

  15. Abductive Reasoning Example ref.: https://www.quora.com/What-is-a-good-example-of-abductive-reasoning • The doctor hears her patients symptoms, including the regular shortness of breath on cold days and when exercising and abduces that the best explanation of these symptoms is that her patient is an asthma sufferer. • The scientist observes the test tube and sees the chemical turn purple. She abduces that either there is potassium in the sample or her colleague is playing yet another prank on her. JPN, UiA 15

  16. Agenda  Different Types of Reasoning • Inductive reasoning • Deductive reasoning • Abductive reasoning  Why rules?  The Semantic Web Rule Language (SWRL)  SWRL Types of Atoms  SWRL Example  SWRL Exercise 16

  17. In some cases we need both Structure and Rules JPN, UiA 17

  18. Example of rule using The Semantic Web Rule Language ( SWRL ): hasParent(?x,?parent) ∧ hasBrother(?parent,?uncle) ⇒ hasUncle(?x,?uncle) • Some statements cannot be expressed in OWL. • Modeling constructs of OWL not always adequate or most desirable. Knowledge Representation, Part II, JPN, UiA 18

  19. Agenda  Different Types of Reasoning • Inductive reasoning • Deductive reasoning • Abductive reasoning  Why rules?  The Semantic Web Rule Language (SWRL)  SWRL Types of Atoms  SWRL Example  SWRL Exercise 19

  20. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ The Semantic Web Rule Language (SWRL) • An expressive OWL-based rule language. • SWRL allows users to write rules that can be expressed in terms of OWL concepts to provide more powerful deductive reasoning capabilities than OWL alone. JPN, UiA 20

  21. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ SWRL Rule head body atom ^ atom .... → atom ^ atom body and head consist of positive conjunctions of atoms (only AND between atoms) Atom p(arg1, arg2, ... argn) p is a predicate symbol; arg1 , arg2 , ..., argn are the terms of the expression. JPN, UiA 21

  22. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ All variables in SWRL are treated as universally quantified (  ), with their scope limited to a given rule. E.g., given: hasParent(?x,?parent) ∧ hasBrother(?parent,?uncle) ⇒ hasUncle(?x,?uncle) This rule applies for all ?x, all ?parent and all ?uncle. JPN, UiA 22

  23. Agenda  Different Types of Reasoning • Inductive reasoning • Deductive reasoning • Abductive reasoning  Why rules?  The Semantic Web Rule Language (SWRL)  SWRL Types of Atoms  SWRL Example  SWRL Exercise 23

  24. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ SWRL provides seven types of atoms: • Class Atoms • Individual Property atoms • Data Valued Property atoms • Different Individuals atoms • Same Individual atoms • Built-in atoms • Data Range atoms JPN, UiA 24

  25. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ Class Atom OWL named class or class expression and a single argument representing an OWL individual Examples: Person(?p) Man(Fred) Man(?p) -> Person(?p) JPN, UiA 25

  26. Example of Class Expression (hasChild >= 1)(?x) -> Parent(?x) JPN, UiA 26

  27. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ Individual Property Atom OWL object property and two arguments representing OWL individuals. Examples: hasBrother(?x, ?y) hasSibling(Fred, ?y) Person(?p) ^ hasSibling(?p,?s) ^ Man(?s) -> hasBrother(?p,?s) JPN, UiA 27

  28. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ Data Valued Property OWL data property and two arguments, the first representing an OWL individual, and the second a data value. Examples: hasAge(?x, ?age) hasHeight(Fred, ?h) hasAge(?x, 232) hasName(?x, "Fred") Person(?p) ^ hasCar(?p, true) -> Driver(?p) Person(Fred) ^ hasCar(Fred, true) -> Driver(Fred) JPN, UiA 28

  29. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ Different Individuals Atom Arguments representing OWL individuals. Examples: differentFrom(?x, ?y) differentFrom(Fred, Joe) Same Individual Atom Arguments representing OWL individuals. Examples: sameAs(?x, ?y) sameAs(Fred, Freddy) JPN, UiA 29

  30. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ Data Range Atom A datatype name or a set of literals and a single argument representing a data value. Examples: xsd:int(?x) [3, 4, 5](?x) ?x is a variable representing a data value. JPN, UiA 30

  31. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ Built-In Atom SWRL support user-defined built-ins. A built-in is a predicate that takes one or more arguments and evaluates to true if the arguments satisfy the predicate. SWRL contained many built-ins. Example - Person with an age of greater than 17 is an adult is: : Person(?p) ^ hasAge(?p, ?age) ^ swrlb:greaterThan(?age, 17) -> Adult(?p) (swrlb is a namespace) JPN, UiA 31

  32. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ A rule that uses a core SWRL string built-in to determine if a person's telephone number starts with the international access code "+" can be written as follows: Person(?p) ^ hasNumber(?p, ?number) ^ swrlb:startsWith(?number, "+")  hasInternationalNumber(?p, true) JPN, UiA 32

  33. Ref.: https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ Rectangle(?r) ^ hasWidthInMeters(?r, ?w) ^ hasHeightInMeters(?r, ?h) ^ swrlb:multiply(?areaInSquareMeters, ?w, ?h)  hasAreaInSquareMeters(?r, ?areaInSquareMeters) JPN, UiA 33

  34. Agenda  Different Types of Reasoning • Inductive reasoning • Deductive reasoning • Abductive reasoning  Why rules?  The Semantic Web Rule Language (SWRL)  SWRL Types of Atoms  SWRL Example  SWRL Exercise 34

Recommend


More recommend