Download presentation

Presentation is loading. Please wait.

Published byDante Wynne Modified over 2 years ago

1
Most material was taken from the following source: – Grigoris Antoniou, Frank van Harmelen, A Semantic Web Primer, 2nd Edition, MIT Press, 2008, ISBN 978-0-262-01242-3. Logic and Rules

2
Lecture Outline 1. Introduction 2. Rules: Example 3. Rules: Syntax & Semantics 4. RuleML & RIF: XML Representation for Rules 5. Rules & Ontologies: OWL 2 RL & SWRL Logic and Rules 6-2

3
Knowledge Representation The subjects presented so far were related to the representation of knowledge Knowledge Representation was studied long before the emergence of WWW in AI Logic is still the foundation of KR, particularly in the form of predicate logic (first-order logic) Logic and Rules 6-3

4
The Importance of Logic High-level language for expressing knowledge High expressive power Well-understood formal semantics Precise notion of logical consequence Proof systems that can automatically derive statements syntactically from a set of premises Logic and Rules 6-4

5
The Importance of Logic (2) There exist proof systems for which semantic logical consequence coincides with syntactic derivation within the proof system – Soundness & completeness Logic and Rules 6-5

6
The Importance of Logic (3) Predicate logic is unique in the sense that sound and complete proof systems do exist. – Not for more expressive logics (higher-order logics) Logic can trace the proof that leads to a logical consequence. Logic can provide explanations for answers – By tracing a proof Logic and Rules 6-6

7
Specializations of Predicate Logic: RDF and OWL RDF/S and OWL (Lite and DL) are specializations of predicate logic – correspond roughly to a description logic They define reasonable subsets of logic Trade-off between the expressive power and the computational complexity: – The more expressive the language, the less efficient the corresponding proof systems Logic and Rules 6-7

8
Specializations of Predicate Logic: Horn Logic A rule has the form: A1,..., An B – Ai and B are atomic formulas There are 2 ways of reading such a rule: – Deductive rules: If A1,..., An are known to be true, then B is also true – Reactive rules: If the conditions A1,..., An are true, then carry out the action B Logic and Rules 6-8

9
Description Logics vs. Horn Logic Neither of them is a subset of the other It is impossible to assert that persons who study and live in the same city are “home students” in OWL – This can be done easily using rules: studies(X,Y), lives(X,Z), loc(Y,U), loc(Z,U) homeStudent(X) Rules cannot assert the information that a person is either a man or a woman – This information is easily expressed in OWL using disjoint union Logic and Rules 6-9

10
Monotonic vs. Non-monotonic Rules Example: An online vendor wants to give a special discount if it is a customer’s birthday Solution 1 R1: If birthday, then special discount R2: If not birthday, then not special discount But what happens if a customer refuses to provide his birthday due to privacy concerns? Logic and Rules 6-10

11
Monotonic vs. Non-monotonic Rules (2) Solution 2 R1: If birthday, then special discount R2’: If birthday is not known, then not special discount Solves the problem but: – The premise of rule R2' is not within the expressive power of predicate logic – We need a new kind of rule system Logic and Rules 6-11

12
Monotonic vs. Non-monotonic Rules (3) The solution with rules R1 and R2 works in case we have complete information about the situation The new kind of rule system will find application in cases where the available information is incomplete R2’ is a nonmonotonic rule Logic and Rules 6-12

13
Exchange of Rules Exchange of rules across different applications – E.g., an online store advertises its pricing, refund, and privacy policies, expressed using rules The Semantic Web approach is to express the knowledge in a machine-accessible way using one of the Web languages we have already discussed We show how rules can be expressed in XML- like languages (“rule markup languages”) Logic and Rules 6-13

14
Lecture Outline 1. Introduction 2. Rules: Example 3. Rules: Syntax & Semantics 4. RuleML & RIF: XML Representation for Rules 5. Rules & Ontologies: OWL 2 RL & SWRL Logic and Rules 6-14

15
Family Relations Facts in a database about relations: – mother(X,Y), X is the mother of Y – father(X,Y), X is the father of Y – male(X), X is male – female(X), X is female Inferred relation parent: A parent is either a father or a mother mother(X,Y) parent(X,Y) father(X,Y) parent(X,Y) Logic and Rules 6-15

16
Inferred Relations male(X), parent(P,X), parent(P,Y), notSame(X,Y) brother(X,Y) female(X), parent(P,X), parent(P,Y), notSame(X,Y) sister(X,Y) brother(X,P), parent(P,Y) uncle(X,Y) mother(X,P), parent(P,Y) grandmother(X,Y) parent(X,Y) ancestor(X,Y) ancestor(X,P), parent(P,Y) ancestor(X,Y) Logic and Rules 6-16

17
A More Complex Rule Example Brokered Trade Brokered trades take place via an independent third party, the broker The broker matches the buyer’s requirements and the sellers’ capabilities, and proposes a transaction when both parties can be satisfied by the trade The application is apartment renting an activity that is common and often tedious and time- consuming Logic and Rules 6-17

18
The Potential Buyer’s Requirements – At least 45 m 2 with at least 2 bedrooms – Elevator if on 3 rd floor or higher – Pet animals must be allowed Carlos is willing to pay: – 300 € for a centrally located 45 m 2 apartment – 250 € for a similar flat in the suburbs – An extra 5 € per m 2 for a larger apartment – An extra 2 € per m 2 for a garden – He is unable to pay more than 400 € in total Logic and Rules 6-18

19
The Potential Buyer’s Requirements (2) If given the choice, he would go for the cheapest option His second priority is the presence of a garden His lowest priority is additional space Logic and Rules 6-19

20
Formalization of Carlos’s Requirements – Predicates Used apartment(x), x is an apartment size(x,y), y is the size of apartment x (in m 2 ) bedrooms(x,y), x has y bedrooms price(x,y), y is the price for x floor(x,y), x is on the y-th floor gardenSize(x,y), x has a garden of size y Logic and Rules 6-20

21
Formalization of Carlos’s Requirements – Predicates Used (2) lift(x), there is an elevator in the house of x pets(x), pets are allowed in x central(x), x is centrally located acceptable(x), flat x satisfies Carlos’s requirements offer(x,y), Carlos is willing to pay y € for flat x Logic and Rules 6-21

22
Formalization of Carlos’s Requirements – Rules acceptable(X):- apartment(X), not(incompatible(X)). incompatible(X):- bedrooms(X,Y), Y < 2. incompatible(X):- size(X,Y), Y < 45. incompatible(X):- not(pets(X)). incompatible(X):- floor(X,Y), Y > 2, not(lift(X)). incompatible(X):- price(X,Y), Y > 400. Logic and Rules 6-22

23
Formalization of Carlos’s Requirements – Rules (2) offer(X,O) :- size(X,Y), Y ≥ 45, garden(X,Z), central(X), O = 300 + 2*Z+5*(Y-45). offer(X,O) :- size(X,Y), Y ≥ 45, garden(X,Z), not(central(X)), O = 250+ 2*Z+5*(Y-45). incompatible(X):- offer(X,Y), price(X,Z), Y < Z. Logic and Rules 6-23

24
Selecting an Apartment Auxiliary predicates cheapest(X) :- acceptable(X), price(X,P1), not( (acceptable(Y), price(Y,P2), P2 < P1) ). largestGarden(X):- acceptable(X), gardenSize(X,G1), not( (acceptable(Y), gardenSize(Y,G2), G2 > G1) ). largest(X):- acceptable(X), size(X,S1), not( (acceptable(Y), size(Y,S2), S1

25
Selecting an Apartment cll(X):- cheapest(X), largestGarden(X), largest(X). cl(X) :- cheapest(X), largestGarden(X). c(X) :- cheapest(X). rent(X):- cll(X). rent(X):- cl(X), not(cll(Y)). rent(X):- c(X), not(cl(Y)). Logic and Rules 6-25

26
Representation of Available Apartments apartment(a1) bedrooms(a1,1) size(a1,50) central(a1) floor(a1,1) pets(a1) garden(a1,0) price(a1,300) Logic and Rules 6-26

27
Representation of Available Apartments (2) FlatBed- rooms SizeCentralFloorLiftPetsGardenPrice a1150yes1noyes0300 a2245yes0noyes0335 a3265no2 yes0350 a4255no1yesno15330 a5355yes0noyes15350 a6260yes3no 0370 a7365yes1noyes12375 Logic and Rules 6-27

28
Lecture Outline 1. Introduction 2. Rules: Example 3. Rules: Syntax & Semantics 4. RuleML & RIF: XML Representation for Rules Logic and Rules 6-28

29
Rules – Syntax loyalCustomer(X), age(X) > 60 discount(X) We distinguish some ingredients of rules: – variables which are placeholders for values: X – constants denote fixed values: 60 – Predicates relate objects: loyalCustomer, > – Function symbols which return a value for certain arguments: age Logic and Rules 6-29

30
Rules B1,..., Bn A A, B1,..., Bn are atomic formulas A is the head of the rule B1,..., Bn are the premises (body of the rule) The commas in the rule body are read conjunctively Variables may occur in A, B1,..., Bn – loyalCustomer(X), age(X) > 60 discount(X) – Implicitly universally quantified Logic and Rules 6-30

31
Facts and Logic Programs A fact is an atomic formula E.g. loyalCustomer(a345678) The variables of a fact are implicitly universally quantified. A logic program P is a finite set of facts and rules. Its predicate logic translation pl(P) is the set of all predicate logic interpretations of rules and facts in P Logic and Rules 6-31

32
Goals A goal denotes a query G asked to a logic program The form: – B1,..., Bn OR – ?- B1,..., Bn. (as in Prolog) Logic and Rules 6-32

33
Proof Procedure We use a proof technique from mathematics called proof by contradiction: – Prove that A follows from B by assuming that A is false and deriving a contradiction, when combined with B In logic programming we prove that a goal can be answered positively by negating the goal and proving that we get a contradiction using the logic program – E.g., given the following logic program we get a logical contradiction Logic and Rules 6-33

34
An Example p(a) ¬ X p(X) The 2nd formula says that no element has the property p The 1st formula says that the value of a does have the property p Thus X p(X) follows from p(a) Logic and Rules 6-34 contradiction

35
First-Order Interpretation of Goals p(a) p(X) q(X) q(X) q(a) follows from the logical program X q(X) follows from the logical program Thus, “logical program” {¬ Xq(X)} is unsatisfiable, and we give a positive answer Logic and Rules 6-35

36
First-Order Interpretation of Goals (2) p(a) p(X) q(X) q(b) We must give a negative answer because q(b) does not follow from the logical program Logic and Rules 6-36

37
Carlo Example Determining Acceptable Apartments If we match Carlos’s requirements and the available apartments, we see that flat a1 is not acceptable because it has one bedroom only flats a4 and a6 are unacceptable because pets are not allowed for a2, Carlos is willing to pay $ 300, but the price is higher flats a3, a5, and a7 are acceptable Logic and Rules 6-37

38
Inference for room a1 apartment(a1).bedrooms(a1,1). acceptable(X):- apartment(X), not(incompatible(X)). incompatible(X):- bedrooms(X,Y), Y < 2. ?- acceptable(a1). FALSE apartment(a1), not(incompatible(a1)) FALSE bedrooms(a1,1), 1 < 2 TRUE Logic and Rules 6-38

39
Inference for room a3 apartment(a3). bedrooms(a3,2). size(a3,65). floor(a3,2). pets(a3). garden(a3,0). price(a3,350). acceptable(X):- apartment(X), not(incompatible(X)). ?- acceptable(a3). apartment(a3), not(incompatible(a3)) In order for «not» to become true, all alternative ways to prove incompatibility must be proven false Logic and Rules 6-39

40
Formalization of Carlos’s Requirements – Rules incompatible(a3):- bedrooms(a3,2), 2 < 2. FALSE incompatible(a3):- size(a3,65), 65 < 45. FALSE incompatible(a3):- not(pets(a3)). FALSE incompatible(a3):- floor(a3,2), 2 > 2, not(lift(a3)). FALSE incompatible(a3):- price(a3,350), 350 > 400. FALSE incompatible(a3):- offer(a3,350), price(a3,350), 350 < 350. FALSE offer(a3,350) :- size(a3,65), 65 ≥ 45, garden(a3,0), not(central(a3)), 350 = 250+ 2*0+5*(65-45). Logic and Rules 6-40

41
Selecting the “best” apartment Among the acceptable (compatible) apartments a3, a5, a7, apartments a3 and a5 are cheapest. – Of these, a5 has the largest garden. Thus a5 is suggested for renting. Logic and Rules ?- rent(a5). Yes ?- rent(a7). No ?- rent(a3). No 6-41

42
Lecture Outline 1. Introduction 2. Rules: Example 3. Rules: Syntax & Semantics 4. RuleML & RIF: XML Representation for Rules 5. Rules & Ontologies: OWL 2 RL & SWRL Logic and Rules 6-42

43
Rule Markup Language (RuleML) RuleML is an effort to develop markup of rules on the web It is a family of rule languages, corresponding to different kinds of rule languages: – derivation rules, integrity constraints, reaction rules, … The kernel of the RuleML family is Datalog – function-free Horn logic RuleML is experimental – studies various features of rule languages that are far from being standardized (e.g. nonmonotonic rules) These efforts may feed into future standards – RuleML results were important in the development of RIF Logic and Rules 6-43

44
discount customer product 7.5 percent premium customer luxury product The discount for a customer buying a product is 7.5% if the customer is premium and the product is luxury Logic and Rules 6-44

45
Atomic Formulas p(X, a, f(b, Y)) p X a f b Y Logic and Rules 6-45

46
Facts p(a). p a Logic and Rules 6-46

47
Rules r X Y p X a q Y b p(X,a), q(Y,b) r(X,Y) Logic and Rules 6-47

48
RuleML: Rule Markup Language DTD (one of the many variations) Logic and Rules 6-48

49
Carlo – RuleML equivalent incompatible x pets x Logic and Rules incompatible(X):- not(pets(X)). Negation As Failure 6-49

50
Rule Interchange Format: RIF Rule technology exhibits a broad variety – e.g. action rules, first order rules, logic programming The aim of the W3C RIF Working Group – not to develop a new rule language that would fit all purposes, – focus on the interchange among the various Web rules – A family of languages, called dialects (2 kinds) Logic-based dialects. Based on some form of logic – e.g. first-order logic, and various logic programming approaches – RIF Core, essentially corresponding to function-free Horn logic – RIF Basic Logic Dialect (BLD), Horn logic with equality. Rules with actions (Production systems and reactive rules) – Production Rule Dialect (RIF-PRD). Logic and Rules 6-50

51
RIF-BLD Corresponds to Horn logic with equality plus – Data types and built ins, and – Frames. Data Types – integer, boolean, string, date, “Built-in” Predicates – numeric-greater-than, startswith, date-less-than Functions – numeric-subtract, replace, hours-fromtime Logic and Rules 6-51

52
An actor is a movie star if he has starred in more than 3 successful movies, produced in a span of at least 5 years. A film is considered successful if it has received critical acclaim (e.g. rating >8) or was financially successful (produced >$100M in ticket sales). These rules should be evaluated against the DBpedia data set. Logic and Rules 6-52

53
RIF – use of frames The use of frames has a long tradition in OO languages and knowledge representation, – Has also been prominent in rule languages (e.g. FLogic). The basic idea is to represent objects as frames, and their properties as slots. – E.g., a class professor with slots name, office, phone, department etc. oid[slot1 -> value1 … slotn -> valuen] Logic and Rules 6-53

54
Compatibility with RDF and OWL The basic idea of combining RIF with RDF is to represent RDF triples using RIF frame formulas A triple s p o is represented as s[p -> o] Example ex:GoneWithTheWind ex:FilmYear ex:1939 ex:GoneWithTheWind[ex:FilmYear -> ex:1939] Logic and Rules 6-54

55
Inference in RIF and RDF RIF rule: the Hollywood Production Code was in place between 1930 and 1968 Group( Forall ?Film ( If And( ex:?Film[ex:Year -> ?Year] External(pred:dateGreaterThan(?Year 1930)) External(pred:dateGreaterThan(1968 ?Year))) Then ?Filmex:HollywoodProductionCode -> ex:True])) Conclusion ex:GoneWithTheWind[ex:HollywoodProductionCode -> ex:True] RIF ex:GoneWithTheWind ex:HollywoodProductionCode ex:True RDF Logic and Rules 6-55

56
Summary Horn logic is a subset of predicate logic that allows efficient reasoning, orthogonal to description logics Horn logic is the basis of monotonic rules Nonmonotonic rules are useful in situations where the available information is incomplete Representation of rules using XML-like languages is straightforward – Standardization must cope with all the different forms and types of rules Logic and Rules 6-56

57
Lecture Outline 1. Introduction 2. Rules: Example 3. Rules: Syntax & Semantics 4. RuleML & RIF: XML Representation for Rules 5. Rules & Ontologies: OWL 2 RL & SWRL Logic and Rules 6-57

58
Rules & Ontologies OWL 2 RL & SWRL

59
Description Logic Programs (DLP) Horn logic (rules) and description logics (ontologies) are orthogonal The simplest integration approach is the intersection of both logics – The part of one language that can be translated in a semantics- preserving way to the other OWL2 RL capture this fragment of OWL (previously called Description Logic Programs - DLP) – Horn-definable part of OWL, or – OWL-definable part of Horn logic Logic and Rules 6-59

60
OWL 2 RL OWL 2 is based on Description Logic. – A fragment of first-order logic – Inherits open-world assumption and non-unique- name assumption OWL 2 RL is an interesting sublanguage of OWL 2 DL – Above assumptions do not make a difference Logic and Rules 6-60

61
Open-World Assumption (OWA) We cannot conclude some statement x to be false simply because we cannot show x to be true. The opposite assumption (closed world, CWA) would allow deriving falsity from the inability to derive truth. OWL is strictly committed to the OWA – In some applications is not the right choice Logic and Rules 6-61

62
OWA vs. CWA Examples Example in favor of OWA – Question: “Did it rain in Tokyo yesterday?” – Answer: “I don’t know that it rained, but that’s not enough reason to conclude that it didn’t rain.” Example in favor of CWA – Question: “Was there a big earthquake disaster in Tokyo yesterday?” – Answer: “I don’t know, but if there had been such a disaster, I’d have heard about it. Therefore I conclude that there wasn’t such a disaster.” Logic and Rules 6-62

63
Unique-Name Αssumption (UNA) When two individuals are known by different names, they are in fact different individuals. – Sometimes works well and sometimes not In favor: when two products in a catalog are known by different codes, they are different Against: two people in our social environment initially known with different identifiers (e.g., “Prof. van Harmelen” and “Frank”) are sometimes the same person Logic and Rules 6-63

64
Unique-Name Αssumption (UNA) OWL does not make the unique-name assumption It is possible to explicitly assert of a set of identifiers that they are all unique – using owl:allDifferent Logic and Rules 6-64

65
CWA vs. OWA Databases and logic-programming systems support closed worlds and unique names Knowledge representation systems and theorem provers support open worlds and non-unique names Ontologies are sometimes in need of one and sometimes in need of the other. – Big debate in the literature Logic and Rules 6-65

66
OWL 2 RL Debate resolved by OWL 2 RL The largest fragment of OWL 2 on which the choice for CWA and UNA does not matter – OWL 2 RL is weak enough so that the differences between the choices don’t show up. – Still large enough to enable useful representation and reasoning tasks. Logic and Rules 6-66

67
OWL 2 RL Advantages (1/2) Applications that wish to make different choices on these assumptions (CWA, UNA, etc) can still exchange ontologies in OWL 2 RL without harm. Outside OWL 2 RL, they will draw different conclusions from the same statements. – They disagree on the semantics. Logic and Rules 6-67

68
OWL 2 RL Advantages (2/2) Freedom to use either OWL 2 or rules (and associated tools and methodologies) for modeling purposes Description logic reasoners or deductive rule systems can be used for implementation. – Extra flexibility - interoperability with tools Preliminary experience with using OWL 2 has shown that existing ontologies frequently use very few constructs outside the OWL 2 RL language. Logic and Rules 6-68

69
OWL 2 RL constructs Which constructs of RDF Schema and OWL 2 can be expressed in Horn logic? – They lie within the expressive power of DLP Some constructs cannot be expressed Logic and Rules 6-69

70
Allowed OWL constructors Class and property equivalence Equality- inequality between individuals Inverse, transitive, symmetric and functional properties Intersection of classes Excluded constructors – Union, existential quantification, and arbitrary cardinality constraints Logic and Rules 6-70

71
Simple RDF constructs A triple (a, P, b) is expressed as a fact P(a, b) An instance declaration type(a,C), – a is an instance of class C – expressed as C(a) C is a subclass of D C(X) → D(X) Similarly for subproperty P(X,Y) → Q(X,Y) Logic and Rules 6-71

72
More RDF Constructs Domain and Range Restrictions – C is the domain of property P P(X, Y) → C(X) – C’ is the range of property P P(X, Y) → C’(Y) Logic and Rules 6-72

73
OWL Constructs equivalentClass(C,D) – pair of rules C(X) → D(X) D(X) → C(X) Similarly for equivalentProperty(P,Q) P(X,Y) → Q(X,Y) Q(X,Y) → P(X,Y) Logic and Rules 6-73

74
More OWL Constructs Transitive Properties P(X, Y ), P(Y,Z) → P(X,Z) Boolean operators. – The intersection of C1 and C2 is a subclass of D C1(X), C2(X) → D(X) – C is a subclass of the intersection of D1 and D2 C(X) → D1(X)C(X) → D2(X) – the opposite is outside the expressive power of Horn logic Logic and Rules 6-74

75
Union (1) The union of C1 and C2 is a subclass of D C1(X) → D(X)C2(X) → D(X) The opposite direction is outside the expressive power of Horn logic. – To express that C is a subclass of the union of D1 and D2 would require a disjunction in the head of the corresponding rule Logic and Rules 6-75

76
Union (2) There are cases where the translation is possible – when D1 is a subclass of D2, then the rule C(X) → D2(X) – is sufficient to express that C is a subclass of the union of D1 and D2 There is not a translation that works in all cases Logic and Rules 6-76

77
OWL Restrictions allValuesFrom allValuesFrom(P,D) – the anonymous class of all x such that y must be an instance of D whenever P(x, y) C subClassOf allValuesFrom(P,D) C(X), P(X, Y) → D(Y) The opposite direction cannot in general be expressed Logic and Rules 6-77

78
OWL Restrictions someValuesFrom someValuesFrom(P,D) – the anonymous class of all x for which there exists at least one y instance of D, such that P(x, y). someValuesFrom(P,D) subClassOf C P(X,Y), D(Y) → C(X) The opposite direction cannot in general be expressed. Logic and Rules 6-78

79
Non-expressible constructs Cardinality constraints and Complement of classes cannot be expressed in Horn logic in the general case. Logic and Rules 6-79

80
OWL 2 RL – Conclusions Allowed constructors allow useful expressivity for many practical cases Guarantees correct interchange between OWL reasoners independent of CWA and UNA Allows for translation into efficiently implementable reasoning techniques based on databases and logic programs Logic and Rules 6-80

81
Semantic Web Rules Language (SWRL) A proposed Semantic Web language combining OWL 2 DL with function-free Horn logic, written in Datalog RuleML It allows Horn-like rules to be combined with OWL 2 DL ontologies. Logic and Rules 6-81

82
Rules in SWRL B 1, …,B n → A 1, …,A m commas denote conjunction on both sides of the arrow A 1, …,A m,B 1, …,B n can be – C(x), P(x, y), sameAs(x, y), differentFrom(x,y), – C is an OWL description, P is an OWL property, – x, y are Datalog variables, OWL individuals, or OWL data values. Logic and Rules 6-82

83
Rule Heads If the head of a rule has more than one atom the rule can be transformed to an equivalent set of rules with one atom in the head in a straightforward way – conjunction of atoms without shared variables A(X,Y)→ B(X),C(Y) – A(X,Y)→ B(X) – A(X,Y)→ C(Y) Logic and Rules 6-83

84
Complexity of SWRL Arbitrary OWL expressions (e.g. restrictions), can appear in the head or body of a rule. This adds significant expressive power to OWL, but at the high price of undecidability There can be no inference engine that draws exactly the same conclusions as the SWRL semantics. Logic and Rules 6-84

85
SWRL vs. OWL 2 RL OWL 2 RL tries to combine the advantages of both languages in their common sublanguage SWRL takes a more maximalist approach and unites their respective expressivities. The challenge is to identify sublanguages of SWRL that find the right balance between expressive power and computational tractability. – A candidate is the extension of OWL DL with DL-safe rules – Every variable must appear in a non-description logic atom in the rule body Logic and Rules 6-85

86
Example SWRL Rules: Reclassification Man(?m) → Person(?m) – Possible in OWL - subclassOf relation – Some rules are OWL syntactic sugar Person(?m) hasSex(?m,male) → Man(?m) – Possible in OWL – hasValue (sufficient) restriction – Not all such reclassifications are possible in OWL Logic and Rules 6-86

87
Example SWRL Rules: Property Value Assignment hasParent(?x, ?y) hasBrother(?y, ?z) → hasUncle(?x, ?z) – Property chaining – Possible in OWL 2 - Not possible in OWL 1.0 Person(?p) hasSibling(?p,?s) Man(?s) → hasBrother(?p,?s) – Not possible in OWL Logic and Rules 6-87

88
Example SWRL Rules: Named Individuals Person(Fred) hasSibling(Fred, ?s) Man(?s) → hasBrother(Fred, ?s) Logic and Rules 6-88

89
Example SWRL Rules: Built-ins Person(?p) hasAge(?p,?age) swrlb:greaterThan(?age,17) → Adult(?p) Built-ins dramatically increase expressivity – most rules are not expressible in OWL 1 – Some built-ins can be expressed in OWL 2 Logic and Rules 6-89

90
Example SWRL Rules: String Built-ins Person(?p) hasNumber(?p, ?number) swrlb:startsWith(?number, "+") → hasInternationalNumber(?p, true) Logic and Rules 6-90

91
Example SWRL Rules: Built-ins / Argument Binding Person(?p) hasSalaryInPounds(?p, ?pounds) swrlb:multiply(?dollars, ?pounds, 2.0) → hasSalaryInDollars(?p, ?dollars) Person(?p) hasSalaryInPounds(?p, ?pounds) swrlb:multiply(2.0, ?pounds, ?dollars) → hasSalaryInDollars(?p, ?dollars) – Arguments can bind in any position – Usually implementations support binding of the 1 st arg Logic and Rules 6-91

92
Can define new Built-in Libraries Temporal built-ins: – temporal:before("1999-11-01T10:00", "2000-02- 01T11:12:12.000") – temporal:duration(2, "1999-11-01", "2001-02-01", temporal:Years) TBox built-ins: – tbox:isDatatypeProperty(?p) – tbox:isDirectSubPropertyOf(?sp, ?p) Mathematical built-ins: – swrlm:eval(?circumference, "2 * pi * r", ?r) Logic and Rules 6-92

93
SWRLTab Built-in Libraries http://protege.cim3.net/cgi- bin/wiki.pl?SWRLTabBuiltInLibraries http://protege.cim3.net/cgi- bin/wiki.pl?SWRLTabBuiltInLibraries Logic and Rules 6-93

94
SWRL and Open World Semantics: sameAs, differentFrom Publication(?p) hasAuthor(?p, ?y) hasAuthor(?p, ?z) differentFrom(?y, ?z) → cooperatedWith(?y, ?z) Like OWL, SWRL does not adopt the unique name assumption – Individuals must also be explicitly stated to be different (using owl:allDifferents restriction) Logic and Rules 6-94

95
SWRL is Monotonic: does not Support Negated Atoms Person(?p) not hasCar(?p, ?c) → CarlessPerson(?p) Not possible - language does not support negation here Potential invalidation - what if a person later gets a car? Logic and Rules 6-95

96
SWRL is Monotonic: retraction (or modification) not supported Person(?p) hasAge(?p,?age) swrlb:add(?newage, ?age,1) → hasAge(?p, ?newage) Incorrect: – will run forever and attempt to assign an infinite number of values to hasAge property There is no retraction of old value – Even if there was, it would run forever Logic and Rules 6-96

97
SWRL is Monotonic: counting not supported Publication(?p) hasAuthor(?p,?a) → SingleAuthorPublication(?p) Not expressible - open world applies Potential invalidation - what if author is added later? Logic and Rules 6-97

98
SWRLTab A Protégé-OWL development environment for working with SWRL rules Supports editing and execution of rules Extension mechanisms to work with third-party rule engines Mechanisms for users to define built-in method libraries Supports querying of ontologies Logic and Rules 6-98

99
SWRLTab Wiki : http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTab Logic and Rules 6-99

100
What is the SWRL Editor? The SWRL Editor is an extension to Protégé- OWL that permits the interactive editing of SWRL rules. The editor can be used to create SWRL rules, edit existing SWRL rules, and read and write SWRL rules. It is accessible as a tab within Protégé-OWL. Logic and Rules 6- 100

101
SWRL Editor Logic and Rules 6- 101

102
SWRL Editor Logic and Rules 6- 102

103
Executing SWRL Rules SWRL is a language specification Well-defined semantics Developers must implement engine Or map to existing rule engines Hence, a bridge… to Jess rule engine Logic and Rules 6- 103

104
SWRL and RuleML SWRL is an extension of RuleML brother(X,Y) childOf(Z,Y) uncle(X,Z) Logic and Rules 6- 104

Similar presentations

Presentation is loading. Please wait....

OK

Artificial Intelligence

Artificial Intelligence

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on single phase and three phase dual converter circuit Ppt on programmable logic array circuit Ppt on surfing the net safely Convert word document to ppt online free Ppt on electronics and telecommunication Ppt on acid-base indicators and pka Ppt on obesity management in europe Ppt on tsunami warning system to mobile Ppt on kinetic theory of matter/gas laws Ppt on computer hardware troubleshooting