SemanticWeb - Reasoning

Semantic Web GEIST

5 - Reasoning, Logic and Rules Outline Rules for the Semantic Web

Combining Datalog rules with OWL2 GEIST Research Group Predicate Logic and Datalog http://geist.agh.edu.pl Semantic Web Rule Language Description Logic Rules DL-safe rules Tools and Applications DL Reasoners The End AGH University of Science and Technology, POLAND

Using slides according to license from: P. Hitzler  Knowledge Representation for the Semantic Web course based on P. Hitzler, M. Krötzsch, S. Rudolph  Foundations of Semantic Web Technologies Ontology Modeling Languages course at ESSLLI 2009 in Bordeaux.

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 1 / 53 Outline

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog 1 Rules for the Semantic Web rules with OWL2 Predicate Logic and Datalog Semantic Web Rule 2 Combining Datalog rules with OWL2 Language Description Logic Rules DL-safe rules 3 Tools and Applications Tools and Applications DL Reasoners 4 The End The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 2 / 53 Rules for the Semantic Web

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 3 / 53 Rules for the Semantic Web

SemanticWeb - Reasoning

GEIST

Outline Why Rules? Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule OWL may not suffice for all applications Language Description Logic There are statements that cannot be expressed in OWL Rules • DL-safe rules (cf. Lecture 4) Tools and Modeling constructs of OWL not always adequate or most Applications • DL Reasoners desirable The End • First-order logic in general may be insufficient (e.g. if non-monotonic negation is desired)

→ “Rules” as an alternative paradigm for knowledge modeling

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 2

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 4 / 53 Rules for the Semantic Web

SemanticWeb - Reasoning

GEIST

Outline What is a Rule? Rules for the Semantic Web

Combining Datalog • Logical Rules (predicate logic implications) rules with OWL2 Predicate Logic and – “F → G” (equivalent to “¬F v G”) Datalog – Semantic Web Rule Logical extension of a knowledge base (static) Language – Open World Description Logic Rules – Declarative (descriptive) DL-safe rules • Procedural Rules (e.g. production rules) Tools and – “If X then Y else Z” Applications DL Reasoners – Executable machine directive (dynamic) The End – Operational (meaning = effect on execution) • Logic Programming (e.g. Prolog, F-Logic) – “man(x) :- person(X), not woman(X)” – Approximating logical semantics with procedural aspects, built-ins possible – Typically Closed World – “semi-declarative” • Deduction rules of a calculus (e.g. rules for RDF semantics, lecture 1) – Rules not part of the knowledge base, “meta-rules” Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 3

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 5 / 53 Rules for the Semantic Web

SemanticWeb - Reasoning

GEIST

Outline Which Rule Language? Rules for the Semantic Web

Combining Datalog rules with OWL2 Rule languages are hardly compatible with each other → Predicate Logic and Datalog important to chose adequate rule language Semantic Web Rule Language Description Logic Rules Possible criteria: DL-safe rules Tools and – Clear specification of syntax and semantics? Applications – Support by software tools? DL Reasoners The End – Which expressive features are needed? – Complexity of implementation? Performance? – Compatibility with other formats, e.g. OWL? – Declarative (describing) or operational (programming)? – …

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 4

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 6 / 53 Rules for the Semantic Web

SemanticWeb - Reasoning

GEIST

Outline Which Rule Language? Rules for the Semantic Web

Combining Datalog rules with OWL2 • Logical Rules (predicate logic implications) Predicate Logic and – Clearly defined, extensively researched, well understood Datalog Semantic Web Rule – Very well compatible with OWL and RDF Language Description Logic – Not decidable if unrestricted Rules • Procedural Rules (e.g. production rules) DL-safe rules – Many independent approaches, vague definition Tools and Applications – Used like programming languages, relation to RDF and OWL not clear DL Reasoners – Efficient processing possible The End • Logic Programming (e.g. Prolog, F-Logic) – Clearly defined, but many independent approaches – Partly compatible with OWL and RDF – Decidability/complexity depends very much on the chosen approach

→ In this lecture: predicate logic rules (which are also the basis for logic programming)

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 5

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 7 / 53 Rules for the Semantic Web

SemanticWeb - Rule Representation Reasoning GEIST

Outline

Rules for the Semantic Web Rule Representation for the Semantic Web Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language Description Logic Rules DL-safe rules Tools and Syntax Semantics Architecture Applications DL Reasoners The End

RIF, RuleML FOL, F-logic hybrid, homogeneous

e.g.: SWRL → OWL+RuleML syntax, FOL semantics, homogeneous

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 8 / 53 Rules for the Semantic Web

SemanticWeb - Syntax  Rule Markup Reasoning GEIST Objective Outline

Rules for the rule encoding (markup) Semantic Web interoperability among application Combining Datalog rules with OWL2 Predicate Logic and data processing, ontology mapping, ad hoc reasoning (RIF) Datalog Semantic Web Rule Language Description Logic Rules Markup Languages DL-safe rules Tools and Applications RuleML  Rule Markup Language DL Reasoners RIF  The End

Features XML-based syntax extensible interoperable with RDF/OWL

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 9 / 53 Rules for the Semantic Web

SemanticWeb - Semantics  Rule Meaning Reasoning GEIST Ideas from various rule systems Outline

Logic Programming (LP), Production Rules Systems, Automatic Rules for the Theorem Provers, Bussiness Rules, application-specic rules etc. Semantic Web Combining Datalog rules with OWL2 Predicate Logic and Challenges for rules and ontologies integration Datalog Semantic Web Rule Language Description Logic OWA in ontologies, CWA in LP and Rule-Based Systems Rules DL-safe rules Unique Name Assumption (UNA) in RBS Tools and Applications Monotonic reasoning in ontology-based systems DL Reasoners The End

Semantic for rules  most popular choices

First Order Logic (FOL) OWL ontologies based on Description Logic  subset of FOL Frame logic (F-logic) Stable Model Semantics, no xed semantics

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 10 / 53 Rules for the Semantic Web

SemanticWeb - Hybrid/Homogeneous Architecture Reasoning GEIST

Outline

Rules for the Hybrid Approach Homogeneous Approach Semantic Web Combining Datalog rules with OWL2 loose integration, semantic a single logical language Predicate Logic and Datalog separation between: Semantic Web Rule no syntactic or semantic Language an ontology component  Description Logic distinctions Rules based on a DL variant DL-safe rules a rule component  can be interpreted by a Tools and single reasoning engine Applications usually a variant of DL Reasoners Datalog union or intersection of the The End unidirectional or component languages bidirectional communication

The union of the entire LP and DL fragments within First Order Logic is undecidable!

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 11 / 53 Rules for the Semantic Web

SemanticWeb - Semantic Web Rule Languages Zoo Reasoning GEIST

1 Semantic Web Rule Language (SWRL) Outline

expressive, yet undecidable, OWL and Horn rules union Rules for the Semantic Web 2 DL-safe rules Combining Datalog SWRL rules applied to known individuals rules with OWL2 Predicate Logic and Datalog 3 Description Logic Programs (DLP) Semantic Web Rule Language decidable, limited expressivity, OWL and Horn rules Description Logic Rules intersection DL-safe rules Tools and 4 OWL 2 DL Applications OWL 2 EL  simple terminology (TBox) reasoning DL Reasoners OWL 2 RL  reasoning about individuals (ABox) The End Not only OWL!

5 Web Rule Language (WRL) supports CWA and UNA, Well Founded/Perfect Model Semantics

6 TRIPLE language Datalog-like rules cast on RDF data model, based on F-logic

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 12 / 53 Rules for the Semantic Web

SemanticWeb - Semantic Web Rule Languages Zoo Reasoning GEIST

1 Semantic Web Rule Language (SWRL) Outline

expressive, yet undecidable, OWL and Horn rules union Rules for the Semantic Web 2 DL-safe rules Combining Datalog SWRL rules applied to known individuals rules with OWL2 Predicate Logic and Datalog 3 Description Logic Programs (DLP) Semantic Web Rule Language decidable, limited expressivity, OWL and Horn rules Description Logic Rules intersection DL-safe rules Tools and 4 OWL 2 DL Applications OWL 2 EL  simple terminology (TBox) reasoning DL Reasoners OWL 2 RL  reasoning about individuals (ABox) The End Not only OWL!

5 Web Rule Language (WRL) supports CWA and UNA, Well Founded/Perfect Model Semantics

6 TRIPLE language Datalog-like rules cast on RDF data model, based on F-logic

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 12 / 53 Combining Datalog rules with OWL2

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 13 / 53 Combining Datalog rules with OWL2 Predicate Logic and Datalog

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 14 / 53 Combining Datalog rules with OWL2 Predicate Logic and Datalog

SemanticWeb - Reasoning

GEIST

Outline Predicate Logic as a Rule Language Rules for the Semantic Web

Combining Datalog Rules as first-order logic implications (Horn clauses): rules with OWL2 • Predicate Logic and Datalog Semantic Web Rule A1 ∧ A2 ∧ . . . ∧ An → H (“Body → Head”) Language Description Logic Rules Example: “Man(x) ∧ happilyMarriedWith(x,y) → HappyHusband(x)” DL-safe rules Tools and Constants, variables, function symbols can be used; but no negation Applications • DL Reasoners • Quantifiers are omitted: free variables considered universally quantified The End • Datalog: rules without function symbols – Originally developed for deductive databases – Knowledge bases (“datalog programs”) are sets of function-free Horn clauses – Decidable – efficiently implementable for large datasets (overall complexity ExpTime, i.e. “Draughts” or “Chess”)

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 6

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 15 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 16 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Reasoning

GEIST

Outline SWRL Rules for the Semantic Web

Combining Datalog rules with OWL2 How can datalog and OWL be combined? Predicate Logic and Datalog Semantic Web Rule Language Description Logic SWRL – Semantic Web Rule Language [swirl] Rules DL-safe rules • Proposal for a rule extension for OWL (W3C member Tools and Applications submission) DL Reasoners • Idea: datalog rules referring to an OWL ontology The End → Symbols in rules can be OWL identifiers or new symbols • Various further features and syntactic forms (not relevant here)

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 8

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 17 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Reasoning

GEIST

Outline Semantics of SWRL Rules for the Semantic Web

Combining Datalog rules with OWL2 Combined semantics OWL DL + datalog? Predicate Logic and Datalog → use first-order mapping of OWL (lecture 2) Semantic Web Rule Language Description Logic Rules In effect: DL-safe rules Tools and – OWL individuals are datalog constants Applications DL Reasoners – OWL classes are unary datalog predicates The End – OWL properties are binary datalog predicates

→ A first-order interpretation can at the same time be a model for an OWL ontology and a datalog program → Entailment over OWL+datalog (SWRL) well-defined

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 9

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 18 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Reasoning

GEIST

Outline Example: SWRL knowledge base Rules for the Semantic Web

Combining Datalog For readability, we abbreviate URIs strongly here; the datalog syntax does not follow a rules with OWL2 formal specification (SWRL XML is too verbose here) Predicate Logic and Datalog Semantic Web Rule (1) Vegetarian(x) ∧ Fishproduct(y) → dislikes(x,y) Language Description Logic (2) ordered(x,y) ∧ dislikes(x,y) → Unhappy(x) Rules (3) ordered(x,y) → Dish(y) DL-safe rules (4) dislikes(x,z) ∧ Dish(y) ∧ contains(y,z) → dislikes(x,y) Tools and (5) → Vegetarian(markus) Applications (6) Happy(x) ∧ Unhappy(x) → DL Reasoners The End (7) markus rdf:type [ rdf:type owl:Restriction; owl:onProperty ordered; owl:someValuesFrom ThaiCurry ] (8) ThaiCurry rdfs:subClassOf [ rdf:type owl:Restriction; owl:onProperty contains; owl:someValuesFrom Fishproduct ]

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 10

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 19 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Reasoning

GEIST

Outline Example: SWRL knowledge base Rules for the Semantic Web

Combining Datalog OWL DL can be translated to first-order logic: rules with OWL2 Predicate Logic and Datalog Semantic Web Rule (1) Vegetarian(x) ∧ Fishproduct(y) → dislikes(x,y) Language Description Logic (2) ordered(x,y) ∧ dislikes(x,y) → Unhappy(x) Rules (3) ordered(x,y) → Dish(y) DL-safe rules (4) dislikes(x,z) ∧ Dish(y) ∧ contains(y,z) → dislikes(x,y) Tools and (5) → Vegetarian(markus) Applications (6) Happy(x) ∧ Unhappy(x) → DL Reasoners The End (7) y.ordered(markus,y) ∧ ThaiCurry(y) 9 (8) x.ThaiCurry(x) → ( y.contains(x,y) ∧ FishProduct(y)) 8 9

→ Semantics completely defined → Expected conclusion: Unhappy(markus)

Note: empty rule heads correspond to “false” (rule body must never be true) empty rule bodies correspond to “true” (rule head must always be true) Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 11

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 20 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Reasoning

GEIST

Outline How Hard is SWRL? Rules for the Semantic Web

Combining Datalog rules with OWL2 • Deduction for OWL DL is NExpTime-complete Predicate Logic and Datalog Deduction for OWL 2 DL is N2ExpTime-complete Semantic Web Rule • Language Description Logic • Deduction in datalog is ExpTime-complete Rules DL-safe rules → How hard is deduction for SWRL? Tools and Applications DL Reasoners Deduction for SWRL is undecidable The End (for OWL and thus for OWL 2, even for OWL EL)

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 12

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 21 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Reasoning

GEIST

Outline Undecidability of SWRL Rules for the Semantic Web

Combining Datalog rules with OWL2 SWRL is undecidable: Predicate Logic and Datalog There is no algorithm that can draw all logical conclusions from Semantic Web Rule Language all SWRL knowledge bases, even with unlimited time and Description Logic Rules resources. DL-safe rules Tools and Applications Practically possible: DL Reasoners The End • Algorithms that draw all conclusions for some SWRL knowledge bases • Algorithms that draw some conclusions from all SWRL knowledge bases → Both trivial if “some” refers to very few things

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 13

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 22 / 53 Combining Datalog rules with OWL2 Semantic Web Rule Language

SemanticWeb - Reasoning

GEIST

Outline Decidable Fragments of SWRL Rules for the Semantic Web

Combining Datalog rules with OWL2 Which classes of SWRL knowledge bases allow Predicate Logic and Datalog for complete inference algorithms? Semantic Web Rule Language – Description Logic All SWRL knowledge bases consisting only of OWL (2) Rules axioms DL-safe rules Tools and – All SWRL knowledge bases only consisting of datalog Applications rules DL Reasoners The End – Every fixed finite class of SWRL knowledge bases → Which more interesting decidable fragments exist? – Description Logic Rules – DL-safe Rules

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 14

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 23 / 53 Combining Datalog rules with OWL2 Description Logic Rules

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 24 / 53 Combining Datalog rules with OWL2 Description Logic Rules

SemanticWeb - Reasoning

GEIST

Outline Description Logic Rules Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language Observation: Description Logic Rules Some SWRL-rules can already be expressed in OWL 2. DL-safe rules Tools and Applications DL Reasoners • Identifying all such Description Logic Rules leads to a The End decidable fragment • Goal: Exploit “hidden” expressivity of OWL 2 • Implementation directly by OWL 2 tools

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 15

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 25 / 53 Combining Datalog rules with OWL2 Description Logic Rules

SemanticWeb - Reasoning

GEIST

Outline Simple Rules in OWL 2: Examples Rules for the Semantic Web

Combining Datalog rules with OWL2 • Simple OWL 2 axioms correspond to rules: Predicate Logic and Datalog Semantic Web Rule Class1 rdfs:subClassOf Class2 . Language Description Logic Property1 rdfs:subPropertyOf Property2 . Rules DL-safe rules correspond to Tools and Applications DL Reasoners Class1(x) → Class2(x) The End Property1(x,y) → Property2(x,y) .

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 16

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 26 / 53 Combining Datalog rules with OWL2 Description Logic Rules

SemanticWeb - Reasoning

GEIST

Outline Simple Rules in OWL 2: Examples Rules for the Semantic Web

Combining Datalog rules with OWL2 • Some classes can be decomposed in rules: Predicate Logic and Datalog Semantic Web Rule [ owl:intersectionOf ( Happy Unhappy ) ] Language rdfs:subClassOf owl:Nothing . Description Logic Rules DL-safe rules [ rdf:type owl:Restriction; Tools and owl:onProperty livesIn; Applications owl:someValuesFrom [ rdf:type owl:Restriction; DL Reasoners owl:onProperty locatedIn; The End owl:someValuesFrom EUCountry ] ] ] rdfs:subClassOf EUCitizen . correspond to

Happy(x) ∧ Unhappy(x) → livesIn(x,y) ∧ locatedIn(y,z) ∧ EUCountry(z) → EUCitizen(x)

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 17

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 27 / 53 Combining Datalog rules with OWL2 Description Logic Rules

SemanticWeb - Reasoning

GEIST

Outline Simple Rules in OWL 2: Examples Rules for the Semantic Web

Combining Datalog rules with OWL2 • Property chains provide further rule-like axioms: Predicate Logic and Datalog Semantic Web Rule hasUncle owl:PropertyChainAxiom ( hasParent hasBrother ). Language Description Logic Rules correspond to DL-safe rules Tools and Applications hasParent(x,y) ∧ hasBrother(y,z) → hasUncle(x,z) DL Reasoners The End

→ In all examples, mapping can also be inverted (expressing rules in OWL 2)

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 18

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 28 / 53 Combining Datalog rules with OWL2 Description Logic Rules

SemanticWeb - Can all rules be expressed in OWL2? Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and No, but signicantly more than in SWRL based on OWL(1) Datalog Semantic Web Rule some restrictions overcome by special OWL2 constructs and Language Description Logic mechanisms Rules DL-safe rules inverting properties, Tools and replacing concepts with properties  hasSelf Applications DL Reasoners The is an algorithm for transforming rules into OWL2 The End And a denition when an SWRL rule is DRL

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 29 / 53 Combining Datalog rules with OWL2 DL-safe rules

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 30 / 53 Combining Datalog rules with OWL2 DL-safe rules

SemanticWeb - Reasoning

GEIST

Outline DL-safe Rules Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Observation: Datalog is decidable since rules can be Semantic Web Rule Language applied in only finitely many ways: variables represent only Description Logic Rules constants. DL-safe rules Tools and Applications DL Reasoners • Variables in SWRL might represent arbitrarily many The End infered individuals • Goal: Make rules “safe” by restricting possible variable assignments • DL-safe rules as another decidable fragment of SWRL

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 29

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 31 / 53 Combining Datalog rules with OWL2 DL-safe rules

SemanticWeb - Reasoning

GEIST

Outline DL-safe Rules: Definition Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language Rules now may also include non-OWL predicates: Description Logic Rules – A datalog atom is an atom with a predicate symbol that does not occur DL-safe rules as a class or property in any OWL axiom. Tools and Applications DL Reasoners A SWRL rule is DL-safe if: The End – Every variable in the rule head occurs in a datalog atom in the body.

→ Only constant symbols relevant when considering variable assignments in datalog atoms.

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 30

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 32 / 53 Combining Datalog rules with OWL2 DL-safe rules

SemanticWeb - Reasoning

GEIST

Outline Enforcing DL-Safety Rules for the Semantic Web

Combining Datalog • Example: rules with OWL2 Predicate Logic and Datalog Semantic Web Rule ordered(x,y) ∧ dislikes(x,y) → Unhappy(x) Language Description Logic Rules → not DL-safe if ordered or dislikes occur in OWL axioms DL-safe rules Tools and • Enforcing DL-safety by restricting rules to named individuals: Applications DL Reasoners The End ordered(x,y) ∧ dislikes(x,y) ∧ O(x) ∧ O(y) → Unhappy(x)

where a fact → O(a) is added for all individuals a.

→ Rule only applicable to named OWL individuals

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 31

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 33 / 53 Combining Datalog rules with OWL2 DL-safe rules

SemanticWeb - Reasoning

GEIST

Outline DL-Safe Rules in Practice Rules for the Semantic Web

Combining Datalog rules with OWL2 • OWL 2 with DL-safe rules is decidable Predicate Logic and Datalog Naïve implementation: each rule expressible by finitely many Semantic Web Rule • Language DL rules where all variables are replaced by individual Description Logic Rules symbols in all possible ways (very inefficient) DL-safe rules Tools and • No increase in worst-case complexity Applications DL Reasoners The End Implementations: • Basic support in some reasoners (KAON2, Pellet) • Implementation in tableau-based tools complicated

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 32

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 34 / 53 Combining Datalog rules with OWL2 DL-safe rules

SemanticWeb - Reasoning

GEIST

Outline Summary: Rules Rules for the Semantic Web

Combining Datalog rules with OWL2 • SWRL (“OWL+ datalog”) is undecidable Predicate Logic and Datalog • Semantic Web Rule Description Logic Rules: Language Description Logic – SWRL fragment expressible in OWL 2 Rules – Supported indirectly by OWL 2 reasoners DL-safe rules Tools and – Definition and translation based on dependency graph Applications DL Reasoners • DL-safe rules: The End – SWRL fragment where variables can only assume concrete values – Support by some OWL reasoners – DL-safety can be enforced (also done implicitly in some tools) • Combination OWL 2 + DL Rules + DL-safe rules possible

Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 35

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 35 / 53 Combining Datalog rules with OWL2 DL-safe rules

SemanticWeb - Reasoning

GEIST

Outline Rules for the Semantic Web? Rules for the Semantic Web

Combining Datalog rules with OWL2 • Standards and best-practices for rules still missing Predicate Logic and Datalog • Semantic Web Rule SWRL syntax most widely used in applications Language Description Logic • W3C RIF (Rule Interchange Format) Working Group Rules DL-safe rules – Standard for various rule languages, also SWRL-like rules Tools and – Various new features, e.g. syntax from Frame Logic Applications DL Reasoners – Official specification expected by end 2009 The End • Many studies on interfacing Logic Programming and OWL • OWL 2 RL: a profile that can be translated to datalog rules (note: inverse direction of Description Logic Rules) → enables some interoperability OWL 2 ↔ RIF • Operational “inference rules” or “production rules” supported by some RDF-stores (e.g. Jena) Markus Krötzsch, Sebastian Rudolph: Semantic Web Modeling Languages, ESSLLI 2009, Bordeaux semantic-web-book.org 36

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 36 / 53 Tools and Applications

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 37 / 53 Tools and Applications DL Reasoners

SemanticWeb - Outline Reasoning GEIST

Outline

Rules for the 1 Rules for the Semantic Web Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and 2 Combining Datalog rules with OWL2 Datalog Semantic Web Rule Predicate Logic and Datalog Language Description Logic Semantic Web Rule Language Rules Description Logic Rules DL-safe rules Tools and DL-safe rules Applications DL Reasoners The End 3 Tools and Applications DL Reasoners

4 The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 38 / 53 Tools and Applications DL Reasoners

SemanticWeb - Bossam Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog RETE algorithm Semantic Web Rule Language Description Logic OWL, SWRL, RuleML ontologies, RDF(S), Bossam Rules documents DL-safe rules Tools and standard ontology tasks Applications DL Reasoners no SPARQL support The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 39 / 53 Tools and Applications DL Reasoners

SemanticWeb - Hoolet Reasoning GEIST FOL reasoning for OWL DL and SWRL Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language Description Logic Rules DL-safe rules Tools and Applications DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 40 / 53 Tools and Applications DL Reasoners

SemanticWeb - Pellet Reasoning GEIST

Outline

Rules for the Semantic Web

tableaux algorithm Combining Datalog rules with OWL2 OWL DL, all OWL 2 languages Predicate Logic and Datalog Semantic Web Rule standard ontology tasks Language Description Logic ontology analysis and repairing Rules DL-safe rules debugging Tools and Applications incremental reasoning DL Reasoners The End SPARQL-DL support datatype reasoning SWRL support

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 41 / 53 Tools and Applications DL Reasoners

SemanticWeb - KAON2 Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog infrastructure for managing OWL, SWRL, F-logic ontologies Semantic Web Rule Language Description Logic API for ontology management Rules SPARQL support DL-safe rules Tools and Applications DIG interface DL Reasoners instance import from RDB The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 42 / 53 Tools and Applications DL Reasoners

SemanticWeb - FaCT++ Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule tableau algorithms Language Description Logic Rules OWL Lite, OWL DL, partly OWL 2 DL-safe rules incremental and partial datatype reasoning Tools and Applications DIG interface DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 43 / 53 Tools and Applications DL Reasoners

SemanticWeb - RACER (Pro) Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog commercial, tableaux algorithm Semantic Web Rule Language Description Logic OWL, partly OWL2 Rules class relationships, incremental reasoning DL-safe rules Tools and Applications nRLQ engine DL Reasoners interfaces: RacerPorter, JRacer, LRacer, DIG The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 44 / 53 Tools and Applications DL Reasoners

SemanticWeb - RacerPorter Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language Description Logic Rules DL-safe rules Tools and Applications DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 45 / 53 Tools and Applications DL Reasoners

SemanticWeb - RACER: nRQL Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language Description Logic Rules DL-safe rules Tools and Applications DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 46 / 53 Tools and Applications DL Reasoners

SemanticWeb - HermiT Reasoning GEIST

Outline

Rules for the Semantic Web novel hypertableau algorithm Combining Datalog rules with OWL2 Predicate Logic and standard ontology tasks Datalog Semantic Web Rule class relationships Language Description Logic Rules DL-safe rules Tools and Applications DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 47 / 53 Tools and Applications DL Reasoners

SemanticWeb - CEL Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language polynomial-time classier for OWL 2 EL ontologies Description Logic Rules standard ontology tasks DL-safe rules Tools and relationships among classes Applications DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 48 / 53 Tools and Applications DL Reasoners

SemanticWeb - Quonto Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule OWL DL-Lite Language Description Logic relationships among classes Rules DL-safe rules queries Tools and Applications concepts, roles and attributes satisability DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 49 / 53 Tools and Applications DL Reasoners

SemanticWeb - Owlgres Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule fast scalable reasoner Language Description Logic SPARQL-DL support Rules DL-safe rules transaction support Tools and Applications cooperates with PostgreSQL DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 50 / 53 Tools and Applications DL Reasoners

SemanticWeb - Tests  Conclusions Reasoning GEIST CEL is best for OWL2EL ontologies Outline

FaCT++ (Protege 4.02) is usually the fastest Rules for the Pellet (Protege 4.02) failed in 3 tests. However, for those Semantic Web Combining Datalog tests it passed Pellet had the best average speed rules with OWL2 Predicate Logic and Datalog HermiT (Protege 4.1)  the slowest Semantic Web Rule Language Pellet(Incremental) (Protege 4.1)  as the only one has Description Logic Rules passed all tests DL-safe rules Tools and dierent tools are better for dierent ontologies (e.g. big Applications TBox vs. big ABox) DL Reasoners The End

See also: http://ai.ia.agh.edu.pl/wiki/pl:dydaktyka:miw:2010: dltls:start http://ai.ia.agh.edu.pl/wiki/pl:dydaktyka:miw:2010: owl2tls:start http://www.cs.man.ac.uk/~sattler/reasoners.html

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 51 / 53 The End

SemanticWeb - Questions Reasoning GEIST

Outline

Rules for the Semantic Web

Combining Datalog rules with OWL2 Predicate Logic and Datalog Semantic Web Rule Language Description Logic Rules Any questions? DL-safe rules Tools and Applications DL Reasoners The End

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 52 / 53 The End

SemanticWeb - Thank you Reasoning GEIST

Outline

Thank you for your attention! Rules for the Semantic Web

Combining Datalog http://geist.agh.edu.pl rules with OWL2 GEIST Research Group Predicate Logic and Datalog Semantic Web Rule Language Description Logic Rules DL-safe rules Tools and Applications DL Reasoners The End

Powered by LATEX

GEIST (AGH-UST) SemanticWeb - Reasoning 2014/2015 53 / 53