logics and reasoning - sesa tutorial · reasoning is an act of deriving a conclusion from certain...

67
Logics and Reasoning - SESA Tutorial Darko Anicic [email protected] Digital Enterprise Research Institute (DERI) Leopold-Franzens Universität Innsbruck, Austria Seoul – September 10-13, 2007

Upload: others

Post on 23-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

  • Logics and Reasoning - SESA Tutorial

    Darko [email protected]

    Digital Enterprise Research Institute (DERI)Leopold-Franzens Universität

    Innsbruck, Austria

    Seoul – September 10-13, 2007

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Agenda

    Logics and Reasoning

    Agenda for day 2nd: Logics and Reasoning

    1 Ontologies and Reasoning2 The WSML Language3 IRIS Reasoner4 Hands-on Session

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Introduction

    Ontology Definition

    Figure: Ontology Definition

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Introduction

    Ontology Example

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Introduction

    Reasoning

    Reasoning is an act of deriving a conclusion from certainpremises.The process of inferring implicit knowledge about somedomain of discourse from a given (formal) knowledge ofthat domain.Reasoning is a critical success factor for Semantic Webapplications.Reasoning problems: satisfiability, model finding,deduction...

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Introduction

    Practical ReasonsGiven key role of ontologies in e-Science and Semantic Web, it is essential toprovide tools and services to help users:

    Design and maintain high quality ontologies, e.g.:

    Meaningful - all named classes can have instancesCorrect - captured intuitions of domain expertsMinimally redundant - no unintended synonymsRichly axiomatised - (sufficiently) detailed descriptions

    Store (large numbers) of instances of ontology classes, e.g.:

    Annotations from web pages (or gene product data)Answer queries over ontology classes and instances, e.g.:

    Find more general/specific classesRetrieve annotations/pages matching a given description

    Integrate and align multiple ontologies

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Ontology Languages

    Requirements:- Expressivity

    knowledge representation and ontology theory supportDimensions to Consider: Open vs. Closed WorldSemantics, Classical vs. Default neg, performance etc.

    - Reasoning support

    sound (unambiguous, decidable)support reasoners / inference engines (query answering,classification, logical ent., consistency check...)

    Semantic Web languages:- Web compatibility- Existing W3C Recommendations: XML, RDF, OWL

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Layer Cake 2005

    Figure: Tim Berners Lee, International Semantic Web Conference,2005

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Simplified Stack (from a logicians point of view)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Open-World Assumption vs. Closed-WorldAssumption

    Logic Programming

    hasFather(peter,john)hasFather(john,michael)grandchild(x)←hasFather(x,y), hasFather(y,z),Person(x).

    Every person is a grandchild is not deducible due to closeddomain of interpretation!Domain bounded to known objects: peter is a grandchild.No tree model property required

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Open-World Assumption vs. Closed-WorldAssumption

    Description LogicPerson(peter ) Peter is a person.Person v ∃ father.Person Each person has a father

    who is a person.∃ father.(∃ father.Person) v Grandchild Things having a father of

    a father who is a person aregrandchildren.

    Every person is a grandchild is deducible due to opendomain of interpretation!hasAunt(x,y) ← hasParent(x,z),hasSibling(z,y), Female(y)Arbitrary rule is not possible to express due to the need fortree model property

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Classical vs. Default Negation

    Default Negation(i.e., negation as failure)

    Rules:male(x) :- father(x).female(x) :- person(x), ¬male(x).grandchild(x)←hasFather(x,y), hasFather(y,z),Person(x).

    Facts:person(joe), person(bill), father(joe)

    Value Computation:male(joe)female(bill)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Classical vs. Default Negation

    Classical Negation

    Rules:male(x) :- father(x).female(x) :- person(x), ¬male(x).grandchild(x)←hasFather(x,y), hasFather(y,z),Person(x).

    Facts:person(joe), person(bill), father(joe)

    Value Computation:male(joe)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Basic Model of RDF (S)

    RDF triples:

    A model is a set of statementsStatement := (predicate,subject,object)Predicate is a resourceSubject is a resourceObject is either a resource or a literal

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    RDF(S) - Core Classes and Properties

    RDFS CLASS represents the generic concept of a type or category andcan be defined to represent almost everything, e.g. Web pages, people,document types...

    RDFS PROPERTY represents the subset of RDFS resources that areproperties

    RDFS SubClassOf defines a subset or superset relation betweenclasses. This property is transitive!

    RDFS SubPropertyOf is used to indicate that one property is aspecialization of another property

    RDFS RANGE is used to define that the values of a property areinstances of one or more stated classes

    RDFS DOMAIN is used to state that any resource that has a givenproperty is an instance of one or more classes

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    RDF(S) - Schema Example

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    RDF(S) - Summary

    Simple Triple Data ModelBasic Ontology Modeling PrimitivesURIs for IdentificationRDFS too weak to describe resources in sufficient detail

    No localised range and domain constraintsNo existence/cardinality constraintsNo transitive, inverse or symmetrical properties

    Difficult to provide reasoning support (No "native"reasoners for non-standard semantics)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    OWL - DL based ontology language

    DLs are a family of logic based KR formalismsDLs - languages mainly characterised by:

    Set of constructors for building complex concepts and rolesfrom simpler onesSet of axioms for asserting facts about concepts, roles andindividuals

    DL is a monotonic LogicThis is due to the open world assumption.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    OWL - Language

    Three species of OWL[3]OWL full is union of OWL syntax and RDFOWL DL restricted to DL fragment (1/4 DAML+OIL)OWL Lite is "simpler" subset of OWL DL

    Semantic layeringOWL DL based on OWL full within DL fragment

    OWL DL based on SHOIN (D) Description LogicOWL DL benefits from many years of DL research

    Well defined semanticsFormal properties well understood (complexity, decidability)Known reasoning algorithmsImplemented systems (highly optimized)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    DL Concept and Role Constructors

    Range of other constructors found in DLs, including:

    Number restrictions (cardinality constraints) on roles, e.g.,>3 hasChildQualified number restrictions, e.g., >2 hasChild.FemaleNominals (singleton concepts), e.g., KoreaConcrete domains (datatypes), e.g., hasAge.(21)Inverse roles, e.g., hasChildp (hasParent)Transitive roles, e.g., locatedInRole composition, e.g., hasParent o hasBrother (uncle)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    OWL Class Constructors

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    OWL as DL: Axioms

    Axioms (mostly) reducible to inclusion (v):C ≡ D iff both C v D and D v C

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    OWL - Inference Tasks

    Knowledge is correct (captures intuitions)Does C subsume D w.r.t. ontology O? (in every model Iof O, CI ⊆ DI)

    Knowledge is minimally redundant (no unintendedsynonyms)

    Is C equivalent to D w.r.t. O? (in every model I of O, CI= DI)

    Knowledge is meaningful (classes can have instances)Is C satisfiable w.r.t. O? (there exists some model I of O,s.t. CI 6= ∅)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    OWL - Inference Tasks (2)

    Querying knowledgeIs x an instance of C w.r.t. O? (in every model I of O, xI∈ CI)Is an instance of R w.r.t. O? (in every model I of O,(xI , yI) ∈ RI)

    Knowledge base consistencyA KB K is consistent iff there exists some model I of K

    All inference tasks reducible to KB satisfiability or conceptsatisfiability w.r.t. a KB

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    OWL DL Architecture

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    First Order Logic - Basic Facts

    In opposition to DLs and HLs it provides significant moreflexibility in writing down required axioms.This language is not easy to support in terms of scalablereasoning serviceMany interesting theorems can be proven and the theoremprover community has made significant progress over thelast years.First order language could define the common umbrella,where DLs and HLs are sublanguages and unified.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Web Service Modeling Language (WSML)

    1 Aims to provide a language (or a set of interoperablelanguages) for representing the elements of WSMO:Ontologies, Web services, Goals, Mediators

    2 WSML provides a formal language for the conceptualelements of WSMO, based on:

    Description LogicsLogic ProgrammingFirst-Order LogicF-Logic

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Rationale of WSML

    1 Provide a Web Service Modeling Language based on theWSMO conceptual model

    Concrete syntaxSemantics

    2 Provide a Rule Language for the Semantic Web3 Many current Semantic Web languages have

    undesirable computational propertiesunintuitive conceptual modeling featuresinappropriate language layering

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Variants of WSML

    Figure: Variants of WSML

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Syntaxes for WSML

    Human-readable syntax:- Modular syntax

    WSMO-syntax functions as "umbrella"Modules for different WSML variants with clear layering

    - Syntax:Inspired by OIL/OWL and F-LogicConceptual syntaxLogical Expression Syntax

    - Semantics is fixed in WSML variantsXML syntax- provides syntax transport layerRDF syntax- provides basic relational language and simple ontologicalprimitives

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Syntaxes for WSML

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    WSML- Example

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    WSML Logical Expressions

    Frame and first order based concrete syntaxElements:

    Function symbols (e.g. f())Molecules (e.g. Human subClassOf Animal, JohnmemberOf Human, John[name hasValue "John Smith"]).Predicates (e.g. distance(?x,?y,?z))Logical connectives (or, and, not, implies, equivalent,impliedBy, forall, exists)

    Example: axiom WomanDefinitiondefinedBy ?x memberOf Woman equivalent?x memberOf Female and ?x memberOf Human.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    WSML-Core

    Intersection of Description Logics and Horn Logic:description logic programsFeatures:

    classesattributesbinary relationsinstancesclasses and relation hierarchiesdatatype and datatype predicates

    Compatible with OWLSome limitations in conceptual modeling of Ontologies:

    no cardinality constraintsonly "inferring" range of attributesno meta-modeling

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Example WSML-Core

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Example WSML-Core (2)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    WSML-DL

    Extension of WSML-Core capturing the Description Logic SHIQ(D)entailment is decidableclose to DL species of Web Ontology Language OWLmany efficient subsumption reasoners (FaCT++, Pellet,Racer)

    Some limitations in conceptual modeling of Ontologies:no cardinality constraintsonly "inferring" range of attributesno meta-modeling

    Limitations in logical expressions: -From Logic Programmingpoint-of-view, there is a lack of:

    n-ary predicateschaining variables over predicates(default) negation

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    WSML-Flight

    Extension of WSML-Core, equivalent to Datalog withinequality and (stratified) default negationFeatures:

    powerful rule-based language (n-ary predicates allowed)meta-modelingconstraintsnonmonotonic negation (conclusions can be retracted atlater points of time)

    Query answering supported by WSML2Reasoner andunderlying Datalog reasoner

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    Example WSML-Flight

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    WSML-Rule

    Extension of WSML-Flight in the direction of LogicProgrammingFeatures:

    function symbolsunsafe rules

    Query answering is undecidable

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Ontology LanguagesRDF (S)OWLFirst Order LogicWSML

    WSML-Full

    WSML-Full unifies WSML-DL and WSML-Rule under aFirst-Order umbrellaVery expressiveQuery answering is undecidableSpecification of WSML-Full is now in progress

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Mission

    WSML GoalEfficient and extensible reasoning engine for expressiverule-based languages: WSML Core/Flight/Rule.

    Research GoalFramework consisting of a collection of components whichcover various aspects of reasoning with formally representedknowledge. Development of effective optimization algorithms aswell as memory and storage management strategies forreasoning with large data sets.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Mission

    WSML GoalEfficient and extensible reasoning engine for expressiverule-based languages: WSML Core/Flight/Rule.

    Research GoalFramework consisting of a collection of components whichcover various aspects of reasoning with formally representedknowledge. Development of effective optimization algorithms aswell as memory and storage management strategies forreasoning with large data sets.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Research Methodology

    WSML Core/Flight Reasoner

    Datalog extended with locally stratified negation.

    1 Full Datalog support2 Support for (stratifed) default negation3 Built-in predicates4 Integrity constraints (for checking datatypes)

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Architecture

    Figure: Evaluation strategies

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Integration of IRIS with WSML

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Query-Sub-Query Recursive Framework

    1 Top-down, direct evaluation [1].2 Avoid the calculation of tuples that are not used for deriving

    answer.3 Begin with constants in a query "pushing" them from goals

    to subgoals.4 Use "sideways information passing" to pass constant

    binding information from one atom to the next in subgoals.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Adornments

    Consider the rule:rsg(X,Y) :- up(X,X1), rsg(Y1,X1), down(Y1,Y).

    Suppose that a subquery involving rsgbf is invoked (e.g.rsg(’a’,Y)):

    rsgbf (X,Y) :- up(X,X1), rsgfb(Y1,X1), down(Y1,Y).rsgfb(X,Y) :- up(X,X1), rsgfb(Y1,X1), down(Y1,Y).

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Supplementary Relations

    Goal: to store information during intermediate stages ofevaluation.

    Consider the rule:rsgbf (X,Y) :- up(X,X1), rsgfb(Y1,X1), down(Y1,Y).

    Supplementary relations, for head adorned by rsgbf , are:sup0[X]sup1[X,X1]sup2[X,Y1]sup3[X,Y]

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    QSQR Evaluation - Examplersg(X,Y) :- flat(X,Y).rsg(X,Y) :- up(X,X1), rsg(Y1,X1), down(Y1,Y).?- rsg(’a’,Y).

    Figure: ProgramDarko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    QSQR Evaluation - Example

    Figure: QSQR evaluationDarko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Magic Sets

    Bottom-up technique whose efficiency rivals with top-downapproaches [1, 2].Given a query, the magic set rewriting method generates amodified program in order to take advantage of boundvariables from the query.A bottom-up evaluation procedure is used to evaluate thenew program (e.g., seminaive evaluation).The bottom-up evaluation produces only the set of factsproduced by the top-down approaches such as QSQ.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Relational Algebra and Logical Rules

    Relational algebra

    Compute relations for logical rules and evaluate them usingrelational algebra operations [4].

    Relational algebra expressions:

    1 Take given relations as arguments and produce relationsas results;

    2 Can be combined to form complex expressions;3 Can be efficiently evaluated using RDBMS.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Computing the Relations

    Input: Datalog rulesq(X,Y) :- p(X,b) & X=Y.q(X,Y) :- p(X,Z) & s(Z,Y).

    Output: Relational algebra expressionsπX (σZ=b(P(X,Z)))σX=Y (πX (σZ=b(P(X,Z))) × πY (P(Y,W)))

    Q(X,Y)=σX=Y (πX (σZ=b(P(X,Z))) × πY (P(Y,W)))∪ πX ,Y (P(X,Z) ./ S(Z,Y))

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Rectification

    Non-rectified rules:q(’a’,X,Y) :- r(X,Y).q(X,Y,X) :- r(Y,X).

    Making heads equal:q(U,V,W) :- r(X,Y) & U=a & V=X & W=Y.q(U,V,W) :- r(Y,X) & U=X & V=Y & W=X.

    Rectified rules:q(U,V,W) :- r(V,W) & U=a.q(U,V,W) :- r(V,U) & W=U.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Semi-Naive Algorithm

    Computes the least fixed point of the equations to which it isapplied, with respect to the given EDB relations [5]:

    for i := 1 to m doPi := ∅;

    repeatfor i := 1 to m doQi := Pi ; //save old values

    for i := 1 to m doPi := EVAL(pi , R1,...,Rk ,Q1,...,Qm);

    until Pi = Qi for all i, 1≤i≤m;output Pi ’s

    Figure: Naive evaluationDarko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Algorithm

    Computes the least fixed point based on incremental relationsfor the IDB predicates [5]:for i := 1 to m do

    ∆Pi := EVAL(pi , R1,...,∅,...,∅);Pi := ∆Pi ;

    end;repeat

    for i := 1 to m do∆Qi := ∆Pi ; //save old ∆P’s

    for i := 1 to m do begin∆Pi := EVAL-INCR(pi ,R1,...,Rk ,P1,...,Pm,∆Q1,∆Qm);∆Pi := ∆Pi - Pi // Removes "new" tuples that actually appeared before

    endfor i := 1 to m do

    Pi := Pi ∪ ∆Pi ;until ∆Pi = ∅ for all i; output Pi ’s

    Figure: Semi-Naive evaluationDarko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Negation

    Consider the rules:p(X) :- r(X) & ¬ q(X).q(X) :- r(X) & ¬ p(X).

    For R={1} the least fixed point is not unique:S1: P=1, Q=∅S2: Q=1, P=∅

    IRIS supports safe, stratified rules! Algorithms for checkingsafeness and stratification are implemented.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Handling Negation

    Consider the rule:trueCousin(X,Y) :- cousin(X,Y) & ¬ sibling(X,Y).

    The rule may be evaluated as:C(X,Y) ./ S (X,Y)

    DOM - union of the symbols appearing in the EDB relationsand in the rules themselves.

    DOM × DOM - S(X,Y)

    In general for ¬ s(X1,...,Xn):DOM × ... × DOM (n times) - S

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    The IRIS Roadmap

    1 Query optimization2 Performance and scalability3 Storage management4 Support for function symbols5 Wellfounded semantics implementation

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Combining Reasoning with Search

    1 Goal: Provide an infrastructure that scales for realisticsemantic computing applications

    2 What: A plugable & distributed infrastructure forWeb-reasoning and search

    3 Project: LarCK4 Like: Search for Extraterrestrial Intelligence (SETI),

    Folding@Home and Google techniques for large scaleparallelized computing

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    IRIS Code Access

    IRIS is an open source project developed under LGPL andavailable at:

    http://sourceforge.net/projects/iris-reasoner

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Serge Abiteboul, Richard Hull, and Victor Vianu.Foundations of Databases.Addison-Wesley, 1995.

    Y. Chen.Magic sets and stratified databases.Int. Journal of Intelligent Systems, 12(3):203–231, 1997.

    Ian Horrocks and Alan Rector.The semantic web: Ontologies and owl.

    Jeffrey D. Ullman.Principles of Database and Knowledge-Base Systems,Volume I.Computer Science Press, 1988.

    Jeffrey D. Ullman.Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Principles of Database and Knowledge-Base Systems,Volume II.Computer Science Press, 1989.

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    IntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Thank you!Questions, comments, suggestions please...

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Examples Using WSMT

    1 Set up WSMT;2 Browsing ontologies using WSMT GUI3 Editing ontologies using WSML Text Editor4 Execute a query;

    Darko Anicic SESA Tutorial - Logics and Reasoning

  • ����

    IntroductionOntologies and Reasoning

    Ontology Languages & WSMLIRIS Reasoner

    Hands-on Session

    Examples Using Java API

    1 Set up required WSMO4J factories;2 Parse and load an ontology (written in WSML) in the

    reasoner;3 Create a query;4 Execute a query;5 Print the loaded ontology and results after the query

    execution.

    Darko Anicic SESA Tutorial - Logics and Reasoning

    IntroductionAgenda

    Ontologies and ReasoningIntroduction

    Ontology Languages & WSMLOntology LanguagesRDF (S)OWLLogic Programming / F-Logic (Horn)First Order LogicWSML

    IRIS ReasonerIntroductionEvaluation TechniquesThe Magic-SetsThe Bottom-Up Evaluation in IRIS

    Hands-on Session