leanCoR: lean connection-based DL Reasoner By Adriano S. T. de Melo Supervisor Frederico L. G. Freitas
Jul 22, 2015
leanCoR: lean connection-based DL Reasoner
By Adriano S. T. de Melo
!Supervisor
Frederico L. G. Freitas
–Tim Berners-Lee
“The semantic web is not a separate Web but an extension of the current one, in which information is
given well-defined meaning, better enabling computers and people to work in cooperation.”
4
Description Logics (DL)
• Logical formalism underpinning Web Ontology Language (OWL), an ontology language for the Semantic Web;
• Family of logic-based knowledge representation languages, • describe domain in terms of concepts, roles and
individuals; • Characterized by formal semantics and provision of
inference services.
5
Reasoning over Description Logics
• Draws conclusions that are not explicitly stated; • Provides tools and services to help users:
• design and maintain high quality ontologies, • answer queries over ontology classes and instances.
6 http://www.cs.man.ac.uk/~horrocks/Slides/lpar05.ppt
Problem
• Despite many optimization techniques implemented by DL reasoners, it is easy to find ontologies where just few reasoners can perform well.
• Major inefficiency sources can be due to: • the high degree of non-determinism introduced by some
axioms, • the interaction between language constructors, • the construction of large models in memory.
7Baader et al, the description logic handbook
Connection Method (CM)
• Provides a general framework for automated deduction. • CM has some interesting features for dealing with DL
knowledge bases: • conservative use of memory, • efficient search strategy, • can utilize optimizations from tableau.
8W. Bibel, automated theorem proving
Goals• Develop a practical implementation of a DL reasoner from
a first-order logic theorem prover based on the connection method.
• Provide a mapping from DL axioms to the normal form used by CM • Translation rules: transformation from DL axioms to a
matricial representation • Normalization: method to guarantee that a formula is in
the normal form
9
first-order logics
• Letters a,b,c or lower case: constants • Letters x,y,z: variables • Letters P,Q,R,S: predicate symbols • Letters f,g: functions • Letters s,t: terms (composed of constants, variables or
symbols) • connectives →,∧,∨,¬ denote implication, conjunction,
disjunction and negation, respectively.
11
disjunctive normal form• Atomic formulae or atoms are built from predicate symbols
and terms, e.g. P(a), P(s), Q(b). • A literal, denoted by L, is either an atomic formula or a
negated atomic formula, e.g. P(a), ¬Q(b). • A clause, denoted by C, takes the form L1 ⋀ … ⋀ Ln where
Li is a literal, e.g. P(a) ⋀ Q(b) ⋀ ¬Q(s).
• A formula in disjunctive normal form (DNF) or clausal form has the form C1 ⋁ … ⋁ Cn where Ci is a clause.
• A formula in DNF can also be written as {C1,...,Cn} and is called matrix.
12
Connection method (1/3)• Given a formula in DNF,
!
!
!
• A path through a matrix M = {C1,...,Cn} is a set of occurrences of literals, exactly one from each clause Ci ∈ M.
{P(x), Q(x), ¬P(c), R(c)}
{¬R(x), Q(x), ¬P(c), R(c)}
{P(x), ¬R(x), ¬P(c), R(c)}
{¬R(x), ¬R(x), ¬P(c), R(c)}
13
P(x) ¬R(x)
Q(x) ¬R(x)
¬P(c) R(c)
Connection method (2/3)• A connection in a matrix is an unordered pair of occurrences of
complementary literals, i.e. {P(s1,...,sn),¬P(s1,...,sn)}. A path is said to be complementary iff it contains a connection.
{P(x), Q(x), ¬P(c), R(c)}
{¬R(x), Q(x), ¬P(c), R(c)}
{P(x), ¬R(x), ¬P(c), R(c)}
{¬R(x), ¬R(x), ¬P(c), R(c)} • A unification σ is a mapping from the set of variables to the set of
terms. In σ (L), all occurrences of a variable contained in the literal L are substituted according to their mapping in σ.
σ (x) = c
14
Connection method (3/3)
• A formula is valid iff every path through its matrix representation is complementary.
{P(x), Q(x), ¬P(c), R(c)}
{¬R(x), Q(x), ¬P(c), R(c)}
{P(x), ¬R(x), ¬P(c), R(c)}
{¬R(x), ¬R(x), ¬P(c), R(c)}
where σ (x) = c
15
Connection calculus (1/2)
16
Start rule (St) is the first rule to be applied in a proof search, then Reduction rule (Red) and Extension Rule (Ext) are repeatedly applied until every branch reaches Axiom (Ax).
A formula M in disjunctive normal form is valid in classical logic iff there is a derivation for
“ε,M,ε” in the connection calculus so all leaves are
axioms.
Connection calculus (2/2)• Consider the formula M = {{P(x), ¬R(x)}, {Q(x), ¬R(x)},
{¬P(c)}, {R(c)}}. A proof for M in the connection calculus with σ (x) = c is given below.
17
Description Logics (1/2)• DL alphabet used in this presentation
• Letters A, B or camel case: Atomic concepts • Letters C, D: Concept descriptions • Letters a, b or lower case: Individuals
• Letters R,S or camel back case: Roles
• Concept descriptions are constructed as (limited to DL ALC):
C,D ::= A | ⊤ | ⊥ | C⨆D | C⨅D |¬C | ∃R.C | ∀R.C
• A TBox is a set of statements of the form C⊑D or C≡D, they are called general concept inclusions (GCI).
• An ABox consists of statements of the form C(a) or R(a,b)
24
Description Logics (2/2)
ChildlessPerson ≡ Person ⨅ ¬Parent (ChildlessPersons are exactly those who are persons and who are not parents)
Parent ≡ ∃hasChild.Person (Parents are exactly those who have at least one child which is a Person)
25
DL Semantics (1/2)• Semantics defined by interpretations • An interpretation I = (ΔI, ∙I), where
• ΔI is the domain (a non-empty set)
• ∙I is an interpretation function that maps
• Atomic concept A to a set AI ⊆ ΔI
• Atomic role R to a binary relation R I ⊆ ΔI⨉ΔI
• Individual a to an element aI ⊆ ΔI
26
DL Semantics (2/2)• Interpretation of complex concepts and roles follows from
the interpretation of the basic entities.
27
figure: examples of concept semantics
table 2.1
Reasoning tasks
• Subsumption checking: A concept C is subsumed by a concept D (C⊑D) with respect toT if CI⊆DI for every model
I of T. In this case we write T ⊨ C⊑D.
• Classification: Use of subsumption checking to arrange TBox concepts in a hierarchical way.
28more reasoning tasks can be found at dissertation
Translation
• We call translation the process of transform a description logic axiom or concept descriptions into a matricial form.
• Given a query KB ⊨ α, all formulas in KB are negated and α is transformed in its positive form. We can express this query as a first-order logic formula ¬KB ⋁ α.
30
31
ChildlessPerson(x) [¬Person(x) Parent(x)]
For instance, the axiom
ChildlessPerson ⊑ Person ⨅ ¬Parent
can be expressed in FOL as
∀x ChildlessPerson(x) ⟶ Person(x) ∧ ¬Parent(x)
if it is in KB, we are interested in its negation:
¬(∀x ChildlessPerson(x) ⟶ Person(x) ∧ ¬Parent(x))
∃x ChildlessPerson(x) ∧ (¬Person(x) ⋁ Parent(x))
and then, in a matricial form:
Translation Rules (axioms)28 3.3. TRANSLATION RULES
Name DL formula FOL mapping DNF Negated Matrixmapping
Concept inclusion C v D 8x : C(x)! D(x)
C(x)¬D(x)
�
Concept equality C ⌘ D 8x : C(x)$ D(x)
C(x) ¬C(y)¬D(x) D(y)
�
Concept disjointness C v ¬D 8x : C(x)! ¬D(x)
C(x)D(x)
�
Concept assertion C(a) C(a)⇥¬C(a)
⇤
Negative conceptassertion
¬C(a) ¬C(a)⇥C(a)
⇤
Role inclusion R(a,b)v S(x,y) 8x,y : r(x,y)!s(x,y)
r(x,y)¬s(x,y)
�
Role equality R⌘ S 8x,y : r(x,y)$s(x,y)
r(x,y) ¬r(z,w)¬s(x,y) s(z,w)
�
Role assertion R(a,b) r(a,b)⇥¬r(a,b)
⇤
Negative roleassertion
¬R(a,b) ¬r(a,b)⇥r(a,b)
⇤
Role domain 9R.>vC 8x,y : r(x,y)!C(x)
r(x,y)¬C(x)
�
Role range >v 8R.C 8x,y : r(x,y)!C(y)
r(x,y)¬C(y)
�
Reflexive role >v 9R.Sel f 8x : r(x,x)⇥¬r(x,x)
⇤
Irreflexive role >v ¬9R.Sel f 8x : ¬r(x,x)⇥r(x,x)
⇤
Transitive role Trans(R)8x,y,z : r(x,y)^r(y,z)! r(x,z)
2
4r(x,y)r(y,z)¬r(x,z)
3
5
Table 3.1: Tranlation rules for axioms
Translation Rules (axioms)
28 3.3. TRANSLATION RULES
Name DL formula FOL mapping DNF Negated Matrixmapping
Concept inclusion C v D 8x : C(x)! D(x)
C(x)¬D(x)
�
Concept equality C ⌘ D 8x : C(x)$ D(x)
C(x) ¬C(y)¬D(x) D(y)
�
Concept disjointness C v ¬D 8x : C(x)! ¬D(x)
C(x)D(x)
�
Concept assertion C(a) C(a)⇥¬C(a)
⇤
Negative conceptassertion
¬C(a) ¬C(a)⇥C(a)
⇤
Role inclusion R(a,b)v S(x,y) 8x,y : r(x,y)!s(x,y)
r(x,y)¬s(x,y)
�
Role equality R⌘ S 8x,y : r(x,y)$s(x,y)
r(x,y) ¬r(z,w)¬s(x,y) s(z,w)
�
Role assertion R(a,b) r(a,b)⇥¬r(a,b)
⇤
Negative roleassertion
¬R(a,b) ¬r(a,b)⇥r(a,b)
⇤
Role domain 9R.>vC 8x,y : r(x,y)!C(x)
r(x,y)¬C(x)
�
Role range >v 8R.C 8x,y : r(x,y)!C(y)
r(x,y)¬C(y)
�
Reflexive role >v 9R.Sel f 8x : r(x,x)⇥¬r(x,x)
⇤
Irreflexive role >v ¬9R.Sel f 8x : ¬r(x,x)⇥r(x,x)
⇤
Transitive role Trans(R)8x,y,z : r(x,y)^r(y,z)! r(x,z)
2
4r(x,y)r(y,z)¬r(x,z)
3
5
Table 3.1: Tranlation rules for axioms
Translation Rules (concept descriptors)
29 3.3. TRANSLATION RULES
Name DL formula FOL mapping DNF Negated Matrixmapping
RHS Intersection A v B1 uB28x : A(x)!
B1(x)^B2(x)
A(x) A(x)
¬B1(x) ¬B2(x)
�
LHS Intersection A1 uA2 v B 8x : A1(x)^A2(x)!B(x)
2
4A1(x)A2(x)¬B(x)
3
5
RHS localreflexivity A v 9R.Sel f 8x : A(x)! r(x,x)
A(x)
¬r(x,x)
�
LHS localreflexivity 9R.Sel f v A 8x : r(x,x)! A(x)
r(x,x)¬A(x)
�
RHS existentialrestriction
A v 9R.B8x : A(x)! (9y :
r(x,y)^B(y))
A(x) A(x)
¬r(x, f (x)) ¬B( f (x))
�
LHS existentialrestriction
9R.A v B8x : (9y :
r(x,y)^A(y))! B(x)
2
4A(x)
r(x,y)¬B(y)
3
5
RHS universalrestriction
A v 8R.B8x : A(x)! (8y :r(x,y)! B(y))
2
4A(x)
r(x,y)¬B(y)
3
5
LHS universalrestriction
8R.A v B8x : (8y : r(x,y)!
A(y))! B(x)
¬r(x, f (x)) A( f (x))¬B(x) ¬B(x)
�
Table 3.2: Tranlation rules for concept descriptors
Translation Rules (concept descriptors)
29 3.3. TRANSLATION RULES
Name DL formula FOL mapping DNF Negated Matrixmapping
RHS Intersection A v B1 uB28x : A(x)!
B1(x)^B2(x)
A(x) A(x)
¬B1(x) ¬B2(x)
�
LHS Intersection A1 uA2 v B 8x : A1(x)^A2(x)!B(x)
2
4A1(x)A2(x)¬B(x)
3
5
RHS localreflexivity A v 9R.Sel f 8x : A(x)! r(x,x)
A(x)
¬r(x,x)
�
LHS localreflexivity 9R.Sel f v A 8x : r(x,x)! A(x)
r(x,x)¬A(x)
�
RHS existentialrestriction
A v 9R.B8x : A(x)! (9y :
r(x,y)^B(y))
A(x) A(x)
¬r(x, f (x)) ¬B( f (x))
�
LHS existentialrestriction
9R.A v B8x : (9y :
r(x,y)^A(y))! B(x)
2
4A(x)
r(x,y)¬B(y)
3
5
RHS universalrestriction
A v 8R.B8x : A(x)! (8y :r(x,y)! B(y))
2
4A(x)
r(x,y)¬B(y)
3
5
LHS universalrestriction
8R.A v B8x : (8y : r(x,y)!
A(y))! B(x)
¬r(x, f (x)) A( f (x))¬B(x) ¬B(x)
�
Table 3.2: Tranlation rules for concept descriptors
Normalization (1/2)
• Some axioms can’t be direct mapped into clausal form using the translation rules
• Normalization is the process of transforming a non-clausal matrix into a clausal matrix
34
for instance, the axiom A⊑B⨆¬C⨆(¬D⨅E)⨆(F⨅¬G⨅H) can generate the non-clausal matrix
A ¬B C
[D ¬E] [¬F G ¬H]
A ¬B C N1 N2
There are several approaches to normalize this matrix,
¬N1 D
¬N1 ¬E
¬N2 ¬F
¬N2 G
¬N2 ¬H
A ¬B C D
¬F
A ¬B C
¬E G
A ¬B C D
¬H
A ¬B C
¬E ¬F
A ¬B C D G
A ¬B C
¬E ¬H
35
Command-line interface
38
Parameters are given by OWL Reasoner Evaluation Workshop (ORE) command-line interface
Parser
• Takes an ontology and builds a data structure representing the knowledge base
• Can be reused in other systems written in Prolog • Can be extended to include new axioms • Supports ontologies written in OWL 2 Functional-Style
syntax
39
Exemplo de ontologia
40
Prefix(:=<http://www.semanticweb.org/amelo/ontologies/2014/7/untitled-ontology-10#>) Prefix(owl:=<http://www.w3.org/2002/07/owl#>) Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>) Prefix(xml:=<http://www.w3.org/XML/1998/namespace>) Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>) Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>) !!Ontology(<http://www.semanticweb.org/amelo/ontologies/2014/7/untitled-ontology-10> ! Declaration(Class(:Parent)) Declaration(Class(:Person)) Declaration(ObjectProperty(:hasChild)) EquivalentClasses(:Parent ObjectSomeValuesFrom(:hasChild :Person)) )
Query resolver• Assemble queries in the format KB ⊨ α to the theorem
prover, where α is a new axiom.
41
For instance, suppose the following KB: Person⊑Man⨆Woman
Man⊑¬Woman
We want classify this KB. The new concept inclusions can be obtained by trying to proof KB ⊨ α, with α ∈ {Man⊑Person, Woman⊑Person, Man⊑Woman, Woman⊑Man, Person⊑Man,
Person⊑Woman}
Modified leanCoP
• We optimized the use of knowledge base database to reuse all axioms in different queries;
• Start clause C is chosen from α, in KB ⊨ α, and the method does not backtrack for the start clause.
42
Normalization
• Module responsible for guarantees that a formula is in clausal form;
• We are using the second approach shown in slide 25.
43
Skolemization• This module is responsible for adding skolem functions to
formulas. • A function is generated for each skolem function and takes
the form fn(x), where n is an integer.
• For instance, the axiom A ⊑ ∃R.B ⨅ ∃S.C is mapped to:
44
A(x) ¬r(x, f1(x))
A(x) ¬B(f1(x))
A(x) ¬C(f2(x))
A(x) ¬s(x, f2(x))
Performance• In order to compare our system to a state-of-the-art reasoner and evaluate
our results, we selected three ontologies to classify and compete against ELK, a consequence-based reasoner winner of the ORE 2013 competition.
!!!!!!
• The result of the benchmark shows that a naïve implementation without optimizations can’t compete with a modern reasoner;
• New axioms derived from the classification are correct when them only need axioms included in DL ALC.
45
Contributions
• Implementation of a DL reasoner based on connection method that can be easily extended and modified for experimenting reasoning over description logics.
• Normalization procedures independent of concept inclusion side.
• Translation rules for all axioms of OWL 2 (DL SROIQ).
47
Open Work
• Finish the development of leanCoR: • Execution of all reasoning tasks supported by modern
reasoners; • Support more expressive DL languages, such as SROIQ.
48
Future Work
• Incorporate all optimizations of the state-of-the-art reasoners to truly compare the connection calculus performance to other proof procedures.
• Develop implementations in languages with more features for concurrency such as erlang and go.
49