Logic Logic Logic Specializations of Logic Specializations of Logic
Total Page:16
File Type:pdf, Size:1020Kb
logic importance - high-level language for expressing knowledge - high expressive power - well-understood formal semantics - precise notion of logical consequence - systems that can automatically derive statements syntactically from a set of premises lecture 17: semantic web rules of#35# ece#627,#winter#‘13# 2# of#35# logic logic importance (2) importance (3) - proof systems for which semantic logical - trace the proof that leads to a logical consequence coincides with syntactic derivation consequence within the proof system - logic can provide explanations for answers soundness & completeness by tracing a proof - predicate logic is unique in the sense that sound and complete proof systems do exist not the case for more expressive logics (higher-order logics) ece#627,#winter#‘13# 3# of#35# ece#627,#winter#‘13# 4# of#35# specializations of logic specializations of logic RDF and OWL Horn logic - RDF/S and OWL (Lite and DL) are specializations of predicate logic – they correspond (roughly) to a rule has the form: A1, . ., An → B a description logic - Ai and B are atomic formulas - 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) ece#627,#winter#‘13# 5# of#35# ece#627,#winter#‘13# 6# of#35# specializations of logic logic: description vs Horn Horn logic OWL vs rules there are two ways of reading such a rule - deductive it is impossible to assert that a person X who is brother of Y is uncle of Z (where Z is child of Y) in if A1,..., An are known to be true, then B is also OWL true - reactive this can be done easily using rules: if the conditions A1,..., An are true, then carry brother(X,Y), childOf(Z,Y) → uncle(X,Z) out the action B ece#627,#winter#‘13# 7# of#35# ece#627,#winter#‘13# 8# of#35# logic: description vs Horn OWL vs rules (2) rule languages rules cannot assert the information that a person is either a man or a woman rule languages define how to synthesize new facts form those stored in the knowledge base this information is easily expressed in OWL using disjoint union - rule markup language – RuleML OWL needs rules !!! - semantic web rule language - SWRL ece#627,#winter#‘13# 9# of#35# ece#627,#winter#‘13# 10# of#35# rule markup language rule markup language RuleML Datalog - effort to standardize inference rules its alphabet is a set of predicate symbols, constants, - RuleML is a markup language for publishing and and variables sharing rule bases on the World Wide Web - focus is on rule interoperation between industry atom – is an expression of the form standards P(t1, t2, … , tn), where P is an n-ary predicate - provides an XML syntax for Datalog clauses symbol and t1, …, tn are terms term – is a variable or constant ece#627,#winter#‘13# 11# of#35# ece#627,#winter#‘13# 12# of#35# rule markup language rule markup language Datalog – examples Datalog – clause clause is either a fact or a rule (1): book(Semantic Web, U.K., 2007) fact is an expression of the form B (2): book(title, counry, 2005) where B is a variable-free atom rule is an expression of the form A1, …, Am → C where A1, …, Am atoms are called antecedents, C atom is called the consequent or head ece#627,#winter#‘13# 13# of#35# ece#627,#winter#‘13# 14# of#35# rule markup language rule markup language Datalog – example RuleML – example (1) book(Semantic Web, U.K., 2007) (3): book(x, U.K., y) → UKbook(x) <Atom> <Rel>book</Rel> <Ind>Semantic Web</Ind> <Ind>U.K.</Ind> <Ind>2007</Ind> </Atom> ece#627,#winter#‘13# 15# of#35# ece#627,#winter#‘13# 16# of#35# rule markup language rule markup language RuleML – example (2) RuleML – example (3) book(tilte, country, 2005) book(x, U.K., y) → UKbook(x) <Atom> <Implies> <Rel>book</Rel> <head> <Var>title</Var> <Atom> <Var>country</Var> <Rel>UKbook</Rel> <Ind>2007</Ind> <Var>x</Var> </Atom> </Atom> </head> ece#627,#winter#‘13# 17# of#35# ece#627,#winter#‘13# 18# of#35# rule markup language SWRL RuleML – example (3) continuation <body> - SWRL is an acronym for Semantic Web Rule <Atom> Language <Rel>book</Rel> - SWRL is intended to be the rule language of the <Var>x</Var> Semantic Web <Ind>U.K.</Ind> <Var>y</Var> - SWRL is based on OWL: all rules are expressed in terms of OWL concepts (classes, properties, </Atom> individuals, literals...). </body> </Implies> ece#627,#winter#‘13# 19# of#35# ece#627,#winter#‘13# 20# of#35# SWRL SWRL atoms (predicates) example (1) from Datalog C(x) C is an OWL class book(Semantic Web, U.K., 2007) P(x,y) P is an OWL predicate sameAs(x,y) sameAs belongs to the OWL 1. Book(B) 2.title(B,Semantic Web) differentFrom(x,y) differentFrom belongs to the 3. countryOfPub(B,U.K) OWL vocabulary 4. yearOfPub(B,2007) builtIn(r,x,…) r is a built-in relation x,y – are either variables, individuals, or data values ece#627,#winter#‘13# 21# of#35# ece#627,#winter#‘13# 22# of#35# SWRL SWRL atoms (predicates) atoms (predicates) – 1 differences to Datalog C(x) C is an OWL class - atoms are only unary or binary predicates (no restrictions in RuleML) holds iff x is an individual of the class description or - OWL class descriptions can be viewed as unary data range C predicates (nothing like that in RuleML) Person(John) Person(?x) ece#627,#winter#‘13# 23# of#35# ece#627,#winter#‘13# 24# of#35# SWRL SWRL atoms (predicates) – 2 atoms (predicates) – 3 P(x,y) P is an OWL predicate sameAs(x,y) sameAs belongs to the OWL vocabulary holds iff x is related to y by property P holds iff x is interpreted as the same object y hasBrother(John, Bill) hasBrother(John, ?y) sameAs(?x, ?y) hasBrother(?x, ?y) ece#627,#winter#‘13# 25# of#35# ece#627,#winter#‘13# 26# of#35# SWRL SWRL atoms (predicates) – 4 atoms (predicates) – 5 differentFrom(x,y) differentFrom belongs to the builtIn(r,x,…) r is a built-in relation OWL vocabulary holds iff the built-in relation r holds for the holds iff x and y are interpreted as different objects interpretations of the arguments differentFrom(?x, ?y) swrlb:greaterThan(?x,?y) (builtIn(greaterThan,?x,?y)) swrlb:startsWith(?x, "+") ece#627,#winter#‘13# 27# of#35# ece#627,#winter#‘13# 28# of#35# SWRL SWRL rule example – reclassification rule example – property value assignment Man(?m) Person(?m) Person(?p) ∧ hasSibling(?p, ?s) ∧ Man(?s) → hasBrother(?p, ?s) ece#627,#winter#‘13# 29# of#35# ece#627,#winter#‘13# 30# of#35# SWRL SWRL rule example – named individuals rule example – with individuals & literals Person(Fred) ∧ hasSibling(Fred, ?s) ∧ Man(?s) → Person(Fred) ∧ hasSibling(Fred, ?s) ∧ Man(?s) ∧ hasAge(?s, 40) → hasBrother(Fred, ?s) has40YearOldBrother(Fred, ?s) ece#627,#winter#‘13# 31# of#35# ece#627,#winter#‘13# 32# of#35# SWRL SWRL rule example – with built-ins rule example – with built-ins (2) hasBrother(?x1,?x2) ∧ hasAge(?x1,?age1) ∧ hasBrother(?x1,?x2) ∧ hasAge(?x1,?age1) ∧ hasAge(?x2,?age2) ∧ hasAge(?x2,?age2) ∧ swrlb:greaterThan(?age2,?age1) → swrlb:subtract(10,?age2,?age1) → hasOlderBrother(?x1,?x2) hasDecadeOlderBrother(?x1,?x2) ece#627,#winter#‘13# 33# of#35# ece#627,#winter#‘13# 34# of#35# SWRL characteristics - W3C Submission in 2004 http://www.w3.org/Submission/SWRL/ - rules saved as part of ontology - increasing tool support: Bossam, R2ML, Hoolet, Pellet, KAON2, RacerPro, SWRLTab - can work with reasoners ece#627,#winter#‘13# 35# of#35#.