description logics for conceptual modeling · 2013-06-11 · as conceptual modeling diagrams: uml...
TRANSCRIPT
Description Logics for Conceptual Modeling
Diego Calvanese
KRDB Research Centre for Knowledge and DataFree University of Bozen-Bolzano, Italy
Currently on sabbatical leave at Technical University Vienna, Austria
EPCL Basic Training Camp 2012/201310–21/12/2012 Dresden, Germany
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (1/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (2/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Modeling information systems
Information system
Is a system that collects, stores, and processes information about the state of adomain of interest.
To function properly, an information system needs to:
maintain an internal representation of the state of the domain,
provide information about the state,
change the state by performing actions.
Note: In this lecture, we ignore the dynamic aspects related to modeling theevolution of the state and the state changes, and concentrate on modeling thestatic aspects only.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (3/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Designing information systems
To design an information system, we need proper formalisms for representingthe state of the domain of interest.
We are interested in capturing the semantics of the domain of interest,through suitable constraints that rule out undesired states.
We are also interested in automated support to the design tasks, bysuitably manipulating the representation at the semantic level.
Increasingly, information systems may use the semantic representation alsoat operation time, to better support the user interaction with the system,and the functioning of the system itself.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (4/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Semantic model of the domain of interest
We aim at obtaining a description of the state of the domain of interest insemantic terms.
One can proceed as follows:
1 Represent the domain of interest as a conceptual schema, similar tothose used at design time to design a database.
2 Formalize the conceptual schema as a logical theory (also called anontology).
3 Use the resulting logical theory to:
reason about the domain of interest at design time, andextract information from the representation at run-time, through queryanswering.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (5/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Let’s start with an exercise
Requirements: We are interested in building a software application to manage filmedscenes for realizing a movie, by following the so-called “Hollywood Approach”.
Every scene is identified by a code (a string) and is described by a text in naturallanguage.
Every scene is filmed from different positions (at least one), each of this is called asetup. Every setup is characterized by a code (a string) and a text in natural languagewhere the photographic parameters are noted (e.g., aperture, exposure, focal length,filters, etc.). Note that a setup is related to a single scene.
For every setup, several takes may be filmed (at least one). Every take ischaracterized by a (positive) natural number, a real number representing the numberof meters of film that have been used for shooting the take, and the code (a string) ofthe reel where the film is stored. Note that a take is associated to a single setup.
Scenes are divided into internals that are filmed in a theater, and externals that arefilmed in a location and can either be “day scene” or “night scene”. Locations arecharacterized by a code (a string) and the address of the location, and a textdescribing them in natural language.
Write a precise specification of this domain using any formalism you like!
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (6/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Solution 1: Use conceptual modeling diagrams (UML)!
code: StringphotographicPars: Text
Setup
code: Stringdescription: Text
Scene
theater: String
Internal nightScene: BooleanExternal
1..*1..1stpForScn
Locationname: Stringaddress: Stringdescription: Text
1..*
1..10..*
tkOfStp
located
1..1
{disjoint, complete}
Takenbr: IntegerfilmedMeters: Realreel: String
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (7/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Solution 1: Use conceptual modeling diagrams –Discussion
Good points:
Easy to generate (it’s the standard in software design).
Easy to understand for humans.
Well disciplined, well-established methodologies available.
Bad points:
No precise semantics (people that use it wave hands about it).
Verification (or better validation) done informally by humans.
Machine incomprehensible (because of lack of formal semantics).
Automated reasoning and query answering out of question.
Limited expressiveness (∗).
(∗) Not really a bad point, in fact.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (8/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Solution 2: Use logic!!
Alphabet: Scene(x), Setup(x), Take(x), Internal(x), External(x), Location(x),stpForScn(x, y), tkOfStp(x, y), located(x, y), . . . .
Axioms:
∀x, y. codeScene(x, y)→ Scene(x) ∧ String(y)∀x, y. description(x, y)→ Scene(x) ∧ Text(y)
∀x, y. codeSetup(x, y)→ Setup(x) ∧ String(y)∀x, y. photographicPars(x, y)→ Setup(x) ∧ Text(y)
∀x, y. nbr(x, y)→ Take(x) ∧ Integer(y)∀x, y. filmedMeters(x, y)→ Take(x) ∧ Real(y)∀x, y. reel(x, y)→ Take(x) ∧ String(y)
∀x, y. theater(x, y)→ Internal(x) ∧ String(y)
∀x, y. nightScene(x, y)→ External(x) ∧ Boolean(y)
∀x, y. name(x, y)→ Location(x) ∧ String(y)∀x, y. address(x, y)→ Location(x) ∧ String(y)∀x, y. description(x, y)→ Location(x) ∧ Text(y)
∀x. Scene(x)→ (1 ≤ ]{y | codeScene(x, y)} ≤ 1)
∀x. Internal(x)→ Scene(x)∀x. External(x)→ Scene(x)∀x. Internal(x)→ ¬External(x)∀x. Scene(x)→ Internal(x) ∨ External(x)
∀x, y. stpForScn(x, y)→Setup(x) ∧ Scene(y)∀x, y. tkOfStp(x, y)→
Take(x) ∧ Setup(y)∀x, y. located(x, y)→
External(x) ∧ Location(y)
∀x. Setup(x)→(1 ≤ ]{y | stpForScn(x, y)} ≤ 1)∀y. Scene(y)→
(1 ≤ ]{x | stpForScn(x, y))}∀x. Take(x)→
(1 ≤ ]{y | tkOfStp(x, y)} ≤ 1)∀x. Setup(y)→
(1 ≤ ]{x | tkOfStp(x, y)})∀x. External(x)→
(1 ≤ ]{y | located(x, y)} ≤ 1)· · ·
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (9/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Solution 2: Use logic – Discussion
Good points:
Precise semantics.
Formal verification.
Allows for query answering.
Machine comprehensible.
Virtually unlimited expressiveness (∗).
Bad points:
Difficult to generate.
Difficult to understand for humans.
Too unstructured (making reasoning difficult), no well-establishedmethodologies available.
Automated reasoning may be impossible.
(∗) Not really a bad point, in fact.Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (10/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Solution 3: Use both!!!
Note: these two approaches seem to be orthogonal, but in fact they can beused together cooperatively.
Basic idea:
Assign formal semantics to constructs of the conceptual design diagrams.
Use conceptual design diagrams as usual, taking advantage ofmethodologies developed for them in Software Engineering.
Read diagrams as logical theories when needed, i.e., for formalunderstanding, verification, automated reasoning, etc.
Added values:
Inherited from conceptual modeling diagrams: ease-to-use for humans
inherit from logic: formal semantics and reasoning tasks, which are neededfor formal verification and machine manipulation.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (11/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Solution 3: Use both!!! (cont’d)
Important:
The logical theories that are obtained from conceptual modeling diagrams areof a specific form.
Their expressiveness is limited (or better, well-disciplined).
One can exploit the particular form of the logical theory to simplifyreasoning.
The aim is getting:
decidability, andreasoning procedures that match the intrinsic computational complexity ofreasoning over the conceptual modeling diagrams.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (12/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Conceptual models vs. logic
We illustrate now what we get from interpreting conceptual modeling diagramsin logic.
We will use:
As conceptual modeling diagrams: UML Class Diagrams.Note: we could equivalently use Entity-Relationship Diagrams instead of UML.
As logic:
First-Order Logic, to formally capture semantics and the different forms ofreasoning over conceptual modeling diagrams.Description Logics, to show that automated reasoning over conceptualmodeling diagrams is feasible.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (13/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOLClassesAssociationsAttributesGeneralizationsAssociations classes
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (14/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
The Unified Modeling Language (UML)
The Unified Modeling Language (UML) was developed in 1994 by unifyingand integrating the most prominent object-oriented modeling approaches:
Booch
Rumbaugh: Object Modeling Technique (OMT)
Jacobson: Object-Oriented Software Engineering (OOSE)
History:
1995, version 0.8, Booch, Rumbaugh; 1996, version 0.9, Booch,Rumbaugh, Jacobson; version 1.0 BRJ + Digital, IBM, HP, . . .
UML 1.4.2 is industrial standard ISO/IEC 19501.
Current version: 2.3 (May 2010): http://www.omg.org/spec/UML/
1999–today: de facto standard object-oriented modeling language.
References:
Grady Booch, James Rumbaugh, Ivar Jacobson, “The unified modelinglanguage user guide”, Addison Wesley, 1999 (2nd ed., 2005)
http://www.omg.org/ → UML
http://www.uml.org/
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (15/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
UML Class Diagrams
In this lecture we deal only with one of the most prominent components ofUML: UML Class Diagrams.
A UML Class Diagram is used to represent explicitly the information on adomain of interest (typically the application domain of software).
Note: This is exactly the goal of all conceptual modeling formalism, such asEntity-Relationship Diagrams (standard in Database design) or Ontologies.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (16/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
UML Class Diagrams (cont’d)
The UML class diagram models the domain of interest in terms of:
objects grouped into classes;
associations, representing relationships between classes;
attributes, representing simple properties of the instances of classes;Note: here we do not deal with “operations”.
sub-classing, i.e., ISA and generalization relationships.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (17/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Example of a UML Class Diagram
code: StringphotographicPars: Text
Setup
code: Stringdescription: Text
Scene
theater: String
Internal nightScene: BooleanExternal
1..*1..1stpForScn
Locationname: Stringaddress: Stringdescription: Text
1..*
1..10..*
tkOfStp
located
1..1
{disjoint, complete}
Takenbr: IntegerfilmedMeters: Realreel: String
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (18/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Use of UML Class Diagrams
UML Class Diagrams are used in various phases of a software design:
1 During the so-called analysis, where an abstract precise view of the domainof interest needs to be developed.; the so-called “conceptual perspective”.
2 During software development, to maintain an abstract view of the softwareto be developed.; the so-called “implementation perspective”.
In this lecture we focus on 1!
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (19/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
UML Class Diagrams and ER Schemas
UML class diagrams (when used for the conceptual perspective) closelyresemble Entity-Relationship (ER) Diagrams.
Example of UML vs. ER:
paySlipNumber: Integersalary: Integer
Employee
Manager
AreaManager
TopManager
projectCode: String
Project
1..*
1..1
worksFor
manages{disjoint, complete}
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (20/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Classes
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOLClassesAssociationsAttributesGeneralizationsAssociations classes
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (21/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Classes
Classes in UML
A class in UML models a set of objects (its “instances”) that share certaincommon properties, such as attributes, operations, etc.
Each class is characterized by:
a name (which must be unique in the whole class diagram),
a set of (local) properties, namely attributes and operations (see later).
Example
title: Stringpages: Integer
Book– the name of the class is ‘Book’– the class has two properties (attributes)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (22/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Classes
Classes in UML: instances
The objects that belong to a class are called instances of the class. They forma so-called instantiation (or extension) of the class.
Example
Here are some possible instantiations of our class Book:
{booka, bookb, bookc, bookd, booke}{bookα, bookβ}{book1, book2, book3, . . . , book500, . . . }
Which is the actual instantiation?We will know it only at run-time!!! – We are now at design time!
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (23/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Classes
Classes in UML: formalization
A class represents a set of objects. . . . But which set? We don’t actually know.
So, how can we assign a semantics to such a class?
We represent a class as a FOL unary predicate!
Example
For our class Book, we introduce a predicate Book(x).
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (24/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOLClassesAssociationsAttributesGeneralizationsAssociations classes
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (25/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
Associations
An association in UML models a relationship between two or more classes.
At the instance level, an association is a relation between the instances oftwo or more classes.
Associations model properties of classes that are non-local, in the sensethat they involve other classes.
An association between n classes is a property of each of these classes.
Example
Author
writtenBy
title: Stringpages: Integer
Book
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (26/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
Associations: formalization
CnC1A
C2...
We can represent an n-ary association A among classes C1, . . . , Cn as ann-ary predicate A in FOL.We assert that the components of the predicate must belong to the classesparticipating to the association:
∀x1, . . . , xn.A(x1, . . . , xn)→ C1(x1) ∧ · · · ∧ Cn(xn)
Example
∀x1, x2.writtenBy(x1, x2)→ Book(x1) ∧Author(x2)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (27/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
Associations: multiplicity
On binary associations, we can place multiplicity constraints, i.e., a minimaland maximal number of tuples in which every object participates as first(second) component.
Example
1..*0..*
Author
writtenBy
title: Stringpages: Integer
Book
Note: UML multiplicities for associations are look-across and are not easy to use in anintuitive way for n-ary associations. So typically they are not used at all.
In contrast, in ER Schemas, multiplicities are not look-across and are easy to use, andwidely used.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (28/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
Associations: formalization of multiplicities
Amin2..max2 min1..max1
C1
C2
Multiplicities of binary associations are easily expressible in FOL:
∀x1.C1(x1)→ (min1 ≤ ]{x2 | A(x1, x2)} ≤ max 1)∀x2.C2(x2)→ (min2 ≤ ]{x1 | A(x1, x2)} ≤ max 2)
Example
∀x.Book(x)→ (1 ≤ ]{y | written by(x, y)})
Note: this is a shorthand for a FOL formula expressing the cardinality of the setof possible values for y.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (29/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
In our example ...
code: StringphotographicPars: Text
Setup
code: Stringdescription: Text
Scene
theater: String
Internal nightScene: BooleanExternal
1..*1..1stpForScn
Locationname: Stringaddress: Stringdescription: Text
1..*
1..10..*
tkOfStp
located
1..1
{disjoint, complete}
Takenbr: IntegerfilmedMeters: Realreel: String
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (30/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
In our example ...
Alphabet: Scene(x), Setup(x), Take(x), Internal(x), External(x), Location(x),stpForScn(x, y), tkOfStp(x, y), located(x, y), . . . .
Axioms:
∀x, y. codeScene(x, y)→ Scene(x) ∧ String(y)∀x, y. description(x, y)→ Scene(x) ∧ Text(y)
∀x, y. codeSetup(x, y)→ Setup(x) ∧ String(y)∀x, y. photographicPars(x, y)→ Setup(x) ∧ Text(y)
∀x, y. nbr(x, y)→ Take(x) ∧ Integer(y)∀x, y. filmedMeters(x, y)→ Take(x) ∧ Real(y)∀x, y. reel(x, y)→ Take(x) ∧ String(y)
∀x, y. theater(x, y)→ Internal(x) ∧ String(y)
∀x, y. nightScene(x, y)→ External(x) ∧ Boolean(y)
∀x, y. name(x, y)→ Location(x) ∧ String(y)∀x, y. address(x, y)→ Location(x) ∧ String(y)∀x, y. description(x, y)→ Location(x) ∧ Text(y)
∀x. Scene(x)→ (1 ≤ ]{y | codeScene(x, y)} ≤ 1)
∀x. Internal(x)→ Scene(x)∀x. External(x)→ Scene(x)∀x. Internal(x)→ ¬External(x)∀x. Scene(x)→ Internal(x) ∨ External(x)
∀x, y. stpForScn(x, y)→Setup(x) ∧ Scene(y)∀x, y. tkOfStp(x, y)→
Take(x) ∧ Setup(y)∀x, y. located(x, y)→
External(x) ∧ Location(y)
∀x. Setup(x)→(1 ≤ ]{y | stpForScn(x, y)} ≤ 1)∀y. Scene(y)→
(1 ≤ ]{x | stpForScn(x, y))}∀x. Take(x)→
(1 ≤ ]{y | tkOfStp(x, y)} ≤ 1)∀x. Setup(y)→
(1 ≤ ]{x | tkOfStp(x, y)})∀x. External(x)→
(1 ≤ ]{y | located(x, y)} ≤ 1)· · ·
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (31/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations
Associations: most interesting multiplicities
The most interesting multiplicities are:
0..∗: unconstrained
1..∗: mandatory participation
0..1: functional participation (the association is a partial function)
1..1: mandatory and functional participation (the association is a totalfaction)
In FOL:
0..∗: no constraint
1..∗: ∀x.C1(x)→ ∃y.A(x, y)
0..1: ∀x.C1(x)→ ∀y, y′.A(x, y) ∧A(x, y′)→ y = y′
(or simply ∀x, y, y′.A(x, y) ∧A(x, y′)→ y = y′)
1..1: (∀x.C1(x)→ ∃y.A(x, y)) ∧ (∀x, y, y′.A(x, y) ∧A(x, y′)→ y = y′)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (32/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOLClassesAssociationsAttributesGeneralizationsAssociations classes
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (33/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
Attributes
An attribute models a local property of a class.
It is characterized by:
a name (which is unique only in the class it belongs to),
a type (a collection of possible values),
and possibly a multiplicity.
Example
title: Stringpages: Integer
Book– The name of one of the attributes is ‘title’.– Its type is ‘String’.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (34/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
Attributes as functions
Attributes (without explicit multiplicity) are:
mandatory (must have at least a value), and
single-valued (can have at most one value).
That is, they are total functions from the instances of the class to the valuesof the type they have.
Example
book3 has as value for the attribute ‘title’ the String: "The little digital
video book".
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (35/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
Attributes with multiplicity
More generally attributes may have an explicit multiplicity (similar to that ofassociations).
Example
title: Stringpages: Integerkeywords: String {1..5}
Book– The attribute ‘title’ has an implicit multiplicity of 1..1.– The attribute ‘keywords’ has an explicit multiplicity
of 1..5.
Note: When the multiplicity is not specified, then it is assumed to be 1..1.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (36/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
Attributes: formalization
Since attributes may have a multiplicity different from 1..1, they are betterformalized as binary predicates, with suitable assertions representing types andmultiplicity.
Given an attribute att of a class C with type T and multiplicity i..j, we captureit in FOL as a binary predicate attC(x, y) with the following assertions:
An assertion for the attribute type:
∀x, y. attC(x, y)→ C(x) ∧ T (y)
An assertion for the multiplicity:
∀x.C(x)→ (i ≤ ]{y | attC(x, y)} ≤ j)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (37/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
Attributes: example of formalization
title: Stringpages: Integerkeywords: String {1..5}
Book
∀x, y. titleB(x, y)→ Book(x) ∧ String(y)∀x.Book(x)→ (1 ≤ ]{y | titleB(x, y)} ≤ 1)
∀x, y. pagesB(x, y)→ Book(x) ∧ Integer(y)∀x.Book(x)→ (1 ≤ ]{y | pagesB(x, y)} ≤ 1)
∀x, y. keywordsB(x, y)→ Book(x) ∧ String(y)∀x.Book(x)→ (1 ≤ ]{y | keywordsB(x, y)} ≤ 5)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (38/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
In our example ...
code: StringphotographicPars: Text
Setup
code: Stringdescription: Text
Scene
theater: String
Internal nightScene: BooleanExternal
1..*1..1stpForScn
Locationname: Stringaddress: Stringdescription: Text
1..*
1..10..*
tkOfStp
located
1..1
{disjoint, complete}
Takenbr: IntegerfilmedMeters: Realreel: String
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (39/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Attributes
In our example ...
Alphabet: Scene(x), Setup(x), Take(x), Internal(x), External(x), Location(x),stpForScn(x, y), tkOfStp(x, y), located(x, y), . . . .
Axioms:
∀x, y. codeScene(x, y)→ Scene(x) ∧ String(y)∀x, y. description(x, y)→ Scene(x) ∧ Text(y)
∀x, y. codeSetup(x, y)→ Setup(x) ∧ String(y)∀x, y. photographicPars(x, y)→ Setup(x) ∧ Text(y)
∀x, y. nbr(x, y)→ Take(x) ∧ Integer(y)∀x, y. filmedMeters(x, y)→ Take(x) ∧ Real(y)∀x, y. reel(x, y)→ Take(x) ∧ String(y)
∀x, y. theater(x, y)→ Internal(x) ∧ String(y)
∀x, y. nightScene(x, y)→ External(x) ∧ Boolean(y)
∀x, y. name(x, y)→ Location(x) ∧ String(y)∀x, y. address(x, y)→ Location(x) ∧ String(y)∀x, y. description(x, y)→ Location(x) ∧ Text(y)
∀x. Scene(x)→ (1 ≤ ]{y | codeScene(x, y)} ≤ 1)
∀x. Internal(x)→ Scene(x)∀x. External(x)→ Scene(x)∀x. Internal(x)→ ¬External(x)∀x. Scene(x)→ Internal(x) ∨ External(x)
∀x, y. stpForScn(x, y)→Setup(x) ∧ Scene(y)∀x, y. tkOfStp(x, y)→
Take(x) ∧ Setup(y)∀x, y. located(x, y)→
External(x) ∧ Location(y)
∀x. Setup(x)→(1 ≤ ]{y | stpForScn(x, y)} ≤ 1)∀y. Scene(y)→
(1 ≤ ]{x | stpForScn(x, y))}∀x. Take(x)→
(1 ≤ ]{y | tkOfStp(x, y)} ≤ 1)∀x. Setup(y)→
(1 ≤ ]{x | tkOfStp(x, y)})∀x. External(x)→
(1 ≤ ]{y | located(x, y)} ≤ 1)· · ·
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (40/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOLClassesAssociationsAttributesGeneralizationsAssociations classes
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (41/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
ISA and generalizations
The ISA relationship is of particular importance in conceptual modeling: a classC ISA a class C ′ if every instance of C is also an instance of C ′.
In UML, the ISA relationship is modeled through the notion of generalization.
Example
name: String
Person
kindOfWriter: String
AuthorThe attibute ‘name’ is inherited by ‘Author’.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (42/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
Generalizations
A generalization involves a superclass (base class) and one or moresubclasses: every instance of each subclass is also an instance of the superclass.
Example
Person
Child
Adult
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (43/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
Generalizations with constraints
The ability of having more subclasses in the same generalization, allows forplacing suitable constraints on the classes involved in the generalization.
Example
{disjoint}
Person
Child
Adult
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (44/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
Generalizations with constraints (cont’d)
Most notable and used constraints:
Disjointness, which asserts that different subclasses cannot have commoninstances (i.e., an object cannot be at the same time instance of twodisjoint subclasses).
Completeness (aka “covering”), which asserts that every instance of thesuperclass is also an instance of at least one of the subclasses.
Example
{disjoint, complete}
Person
Child
Adult Teenager
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (45/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
Generalizations: formalization
...
{disjoint,complete}
C
C1
C2
Ck
ISA: ∀x.Ci(x)→ C(x), for 1 ≤ i ≤ k
Disjointness: ∀x.Ci(x)→ ¬Cj(x), for 1 ≤ i < j ≤ k
Completeness: ∀x.C(x)→∨ki=1 Ci(x)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (46/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
Generalizations: example of formalization
{disjoint, complete}
Person
Child
Adult Teenager
∀x.Child(x)→ Person(x)∀x.Teenager(x)→ Person(x)∀x.Adult(x)→ Person(x)
∀x.Child(x)→ ¬Teenager(x)∀x.Child(x)→ ¬Adult(x)∀x.Teenager(x)→ ¬Adult(x)
∀x.Person(x)→ (Child(x) ∨ Teenager(x) ∨Adult(x))
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (47/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
In our example ...
code: StringphotographicPars: Text
Setup
code: Stringdescription: Text
Scene
theater: String
Internal nightScene: BooleanExternal
1..*1..1stpForScn
Locationname: Stringaddress: Stringdescription: Text
1..*
1..10..*
tkOfStp
located
1..1
{disjoint, complete}
Takenbr: IntegerfilmedMeters: Realreel: String
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (48/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Generalizations
In our example ...
Alphabet: Scene(x), Setup(x), Take(x), Internal(x), External(x), Location(x),stpForScn(x, y), tkOfStp(x, y), located(x, y), . . . .
Axioms:
∀x, y. codeScene(x, y)→ Scene(x) ∧ String(y)∀x, y. description(x, y)→ Scene(x) ∧ Text(y)
∀x, y. codeSetup(x, y)→ Setup(x) ∧ String(y)∀x, y. photographicPars(x, y)→ Setup(x) ∧ Text(y)
∀x, y. nbr(x, y)→ Take(x) ∧ Integer(y)∀x, y. filmedMeters(x, y)→ Take(x) ∧ Real(y)∀x, y. reel(x, y)→ Take(x) ∧ String(y)
∀x, y. theater(x, y)→ Internal(x) ∧ String(y)
∀x, y. nightScene(x, y)→ External(x) ∧ Boolean(y)
∀x, y. name(x, y)→ Location(x) ∧ String(y)∀x, y. address(x, y)→ Location(x) ∧ String(y)∀x, y. description(x, y)→ Location(x) ∧ Text(y)
∀x. Scene(x)→ (1 ≤ ]{y | codeScene(x, y)} ≤ 1)
∀x. Internal(x)→ Scene(x)∀x. External(x)→ Scene(x)∀x. Internal(x)→ ¬External(x)∀x. Scene(x)→ Internal(x) ∨ External(x)
∀x, y. stpForScn(x, y)→Setup(x) ∧ Scene(y)∀x, y. tkOfStp(x, y)→
Take(x) ∧ Setup(y)∀x, y. located(x, y)→
External(x) ∧ Location(y)
∀x. Setup(x)→(1 ≤ ]{y | stpForScn(x, y)} ≤ 1)∀y. Scene(y)→
(1 ≤ ]{x | stpForScn(x, y))}∀x. Take(x)→
(1 ≤ ]{y | tkOfStp(x, y)} ≤ 1)∀x. Setup(y)→
(1 ≤ ]{x | tkOfStp(x, y)})∀x. External(x)→
(1 ≤ ]{y | located(x, y)} ≤ 1)· · ·
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (49/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations classes
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOLClassesAssociationsAttributesGeneralizationsAssociations classes
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (50/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations classes
Association classes
Sometimes we may want to assert properties of associations. In UML to do sowe resort to association classes:
That is, we associate to an association a class whose instances are inbijection with the tuples of the association.
Then we use the association class exactly as a UML class (modeling localand non-local properties).
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (51/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations classes
Association class – Example
1..*0..* Author
contribution: String
writtenBy
title: Stringpages: Integer
Book
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (52/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations classes
Association class – Example (cont’d)
Contract
with
1..1 0..1
1..*0..* Author
contribution: String
writtenBy
title: Stringpages: Integer
Book
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (53/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations classes
Association classes: formalization
...
C1
C2
Cn
A
The process of putting in correspondence objects of a class (the associationclass) with tuples in an association is formally described as reification.
That is:
We introduce a unary predicate A for the association class A.
We introduce n new binary predicates A1, . . . , An, one for each of thecomponents of the association.
We introduce suitable assertions so that objects in the extension of theunary-predicate A are in bijection with tuples in the n-ary association A.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (54/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations classes
Association classes: formalization (cont’d)
...
1..1
1..1
1..1A1 An
A2
C1
A
Cn
C2
FOL Assertions are needed for stating a bijection between instances of theassociation class and instances of the association:
∀x, y.Ai(x, y)→ A(x) ∧ Ci(y), for i ∈ {1, . . . , n}
∀x.A(x)→ ∃y.Ai(x, y), for i ∈ {1, . . . , n}
∀x, y, y′.Ai(x, y) ∧Ai(x, y′)→ y = y′, for i ∈ {1, . . . , n}
∀x, x′, y1, . . . , yn.∧ni=1(Ai(x, yi) ∧Ai(x′, yi)) → x = x′
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (55/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Associations classes
Association classes: example of formalization
1..*0..* Author
contribution: String
writtenBy
title: Stringpages: Integer
Book
∀x, y.wb1(x, y)→ writtenBy(x) ∧ Book(y)∀x, y.wb2(x, y)→ writtenBy(x) ∧Author(y)
∀x.writtenBy(x)→ ∃y.wb1(x, y)∀x.writtenBy(x)→ ∃y.wb2(x, y)∀x, y, y′.wb1(x, y) ∧ wb1(x, y′)→ y = y′
∀x, y, y′.wb2(x, y) ∧ wb2(x, y′)→ y = y′
∀x, x′, y1, y2.wb1(x, y1) ∧ wb1(x′, y1) ∧ wb2(x, y2) ∧ wb2(x′, y2) → x = x′
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (56/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (57/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Class consistency
A class is consistent, if the class diagram admits an instantiation in which theclass has a non-empty set of instances.
Let Γ be the set of FOL assertions corresponding to the UML Class Diagram,and C(x) the predicate corresponding to a class C of the diagram.
Then C is consistent iff
Γ 6|= ∀x.C(x)→ false
i.e., there exists a model of Γ in which the extension of C(x) is not the emptyset.
Note: Corresponding FOL reasoning task: satisfiability.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (58/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Class consistency: example (by E. Franconi)
Italian
Lazy LatinLover
{disjoint, complete} {disjoint}
English
Gentleman
Hooligan
Person
{disjoint}
Γ |= ∀x.LatinLover(x)→ false
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (59/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Whole diagram consistency
A class diagram is consistent, if it admits an instantiation, i.e., if its classes canbe populated without violating any of the conditions imposed by the diagram.
Let Γ be the set of FOL assertions corresponding to the UML Class Diagram.
Then, the diagram is consistent iff
Γ is satisfiable
i.e., Γ admits at least one model.(Remember that FOL models cannot be empty.)
Note: Corresponding FOL reasoning task: satisfiability.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (60/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Class subsumption
A class C1 is subsumed by a class C2 (or C2 subsumes C1), if the classdiagram implies that C2 is a generalization of C1.
Let Γ be the set of FOL assertions corresponding to the UML Class Diagram,and C1(x), C2(x) the predicates corresponding to the classes C1, and C2 of thediagram.
Then C1 is subsumed by C2 iff
Γ |= ∀x.C1(x)→ C2(x)
Note: Corresponding FOL reasoning task: logical implication.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (61/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Class subsumption: example
Italian
Lazy LatinLover
{disjoint, complete} {disjoint}
English
Gentleman
Hooligan
Person
{disjoint}
Γ |= ∀x.LatinLover(x)→ falseΓ |= ∀x. Italian(x)→ Lazy(x)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (62/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Class subsumption: another example (by E. Franconi)
Italian
Lazy
Mafioso
{disjoint, complete}
LatinLover
ItalianProf
{disjoint}
Γ |= ∀x. ItalianProf (x)→ LatinLover(x)
Note: this is an example of reasoning by cases.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (63/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Class equivalence
Two classes C1 and C2 are equivalent, if C1 and C2 denote the same set ofinstances in all instantiations of the class diagram.
Let Γ be the set of FOL assertions corresponding to the UML Class Diagram,and C1(x), C2(x) the predicates corresponding to the classes C1, and C2 of thediagram.
Then C1 and C2 are equivalent iff
Γ |= ∀x.C1(x)↔ C2(x)
Note:
If two classes are equivalent then one of them is redundant.
Determining equivalence of two classes allows for their merging, thusreducing the complexity of the diagram.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (64/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Class equivalence: example
Italian
Lazy LatinLover
{disjoint, complete} {disjoint}
English
Gentleman
Hooligan
Person
{disjoint}
Γ |= ∀x.LatinLover(x)→ falseΓ |= ∀x. Italian(x)→ Lazy(x)Γ |= ∀x.Lazy(x) ≡ Italian(x)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (65/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Implicit consequence
The properties of various classes and associations may interact to yield strictermultiplicities or typing than those explicitly specified in the diagram.
More generally . . .
A property P is an (implicit) consequence of a class diagram if P holdswhenever all conditions imposed by the diagram are satisfied.
Let Γ be the set of FOL assertion corresponding to the UML Class Diagram,and P (the formalization in FOL of) the property of interest
Then P is an implicit consequence iffΓ |= P
i.e., the property P holds in every model of Γ.
Note: Corresponding FOL reasoning task: logical implication.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (66/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Implicit consequences: example
Student
Course
1..103..15
attends
GradStudent
AdvCourse
2..50..20
gradAttends
15
Γ |= ∀x.AdvCourse(x2)→ ]{x1 | gradAttends(x1 , x2 )} ≤ 15Γ |= ∀x.GradStudent(x)→ Student(x)Γ 6|= ∀x.AdvCourse(x)→ Course(x)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (67/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Unrestricted vs. finite model reasoning
NaturalNumber
EvenNumber
1..1
1..1
double
Due to the multiplicities, the classes NaturalNumber and EvenNumberare in bijection.As a consequence, in every instantiation of the diagram, “the classesNaturalNumber and EvenNumber contain the same number of objects”.
Due to the ISA relationship, every instance of EvenNumber is also aninstance of NaturalNumber , i.e., we have that
Γ |= ∀x.EvenNumber(x)→ NaturalNumber(x)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (68/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Unrestricted vs. finite model reasoning (cont’d)
Question: Does also the reverse implication hold, i.e.,
Γ |= ∀x.NaturalNumber(x)→ EvenNumber(x) ?
if the domain is infinite, the implication does not hold.
If the domain is finite, the implication does hold.
Finite model reasoning: means reasoning only with respect to models with afinite domain.
Finite model reasoning is interesting for standard databases.
The previous example shows that in UML Class Diagrams, finite modelreasoning is different form unrestricted model reasoning.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (69/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Questions
In the above examples reasoning could be easily carried out on intuitive grounds.However, two questions come up.
1. Can we develop sound, complete, and terminating procedures for reasoningon UML Class Diagrams?
We cannot do so by directly relying on FOL!
But we can use specialized logics with better computational properties.A form of such specialized logics are Description Logics.
2. How hard is it to reason on UML Class Diagrams in general?
What is the worst-case situation?
Can we single out interesting fragments on which to reason efficiently?
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (70/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description LogicsDescription languageDescription Logics ontologies
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (71/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
What are Description Logics?
Description Logics (DLs) [Baader et al., 2003] are logics specifically designed torepresent and reason on structured knowledge:
The domain of interest is composed of objects and is structured into:
concepts, which correspond to classes, and denote sets of objectsroles, which correspond to (binary) relationships, and denote binaryrelations on objects
The knowledge is asserted through so-called assertions, i.e., logical axioms.
Hence, DLs have a purpose similar to that of conceptual modeling formalisms.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (72/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Ingredients of a Description Logic
A DL is characterized by:
1 A description language: how to form concepts and rolesHuman uMale u ∃hasChild u ∀hasChild.(Doctor t Lawyer)
2 A mechanism to specify knowledge about concepts and roles (i.e., aTBox)T = { Father ≡ Human uMale u ∃hasChild,
HappyFather v Father u ∀hasChild.(Doctor t Lawyer) }
3 A mechanism to specify properties of objects (i.e., an ABox)A = { HappyFather(john), hasChild(john, mary) }
4 A set of inference services: how to reason on a given KBT |= HappyFather v ∃hasChild.(Doctor t Lawyer)T ∪ A |= (Doctor t Lawyer)(mary)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (73/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description language
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description LogicsDescription languageDescription Logics ontologies
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (74/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description language
Formal semantics of a description language
The formal semantics of DLs is given in terms of interpretations.
Def.: An interpretation I = (∆I , ·I) consists of:
a nonempty set ∆I , called the interpretation domain (of I)
an interpretation function ·I , which maps
each atomic concept A to a subset AI of ∆I
each atomic role P to a subset P I of ∆I ×∆I
The interpretation function is extended to complex concepts and roles accordingto their syntactic structure.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (75/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description language
Concept constructors
Construct Syntax Example Semantics
atomic concept A Doctor AI ⊆ ∆I
atomic role P hasChild P I ⊆ ∆I ×∆I
atomic negation ¬A ¬Doctor ∆I \AI
conjunction C uD Hum uMale CI ∩DI
(unqual.) exist. res. ∃R ∃hasChild { o | ∃o′. (o, o′) ∈ RI }value restriction ∀R.C ∀hasChild.Male {o | ∀o′. (o, o′) ∈ RI → o′ ∈ CI}bottom ⊥ ∅
(C, D denote arbitrary concepts and R an arbitrary role)
The above constructs form the basic language AL of the family of ALlanguages.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (76/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description language
Additional concept and role constructors
Construct AL· Syntax Semantics
disjunction U C tD CI ∪DI
top > ∆I
qual. exist. res. E ∃R.C { o | ∃o′. (o, o′) ∈ RI ∧ o′ ∈ CI }(full) negation C ¬C ∆I \ CI
number N (≥ k R) { o | #{o′ | (o, o′) ∈ RI} ≥ k }restrictions (≤ k R) { o | #{o′ | (o, o′) ∈ RI} ≤ k }qual. number Q (≥ k R.C) { o | #{o′ | (o, o′) ∈ RI ∧ o′ ∈ CI} ≥ k }restrictions (≤ k R.C) { o | #{o′ | (o, o′) ∈ RI ∧ o′ ∈ CI} ≤ k }inverse role I R− { (o, o′) | (o′, o) ∈ RI }role closure reg R∗ (RI)∗
Many different DL constructs and their combinations have been investigated.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (77/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description Logics ontologies
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description LogicsDescription languageDescription Logics ontologies
5 Reasoning on UML Class Diagrams using Description Logics
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (78/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description Logics ontologies
Structural properties vs. asserted properties
We have seen how to build complex concept and roles expressions, whichallow one to denote classes with a complex structure.
However, in order to represent real world domains, one needs the ability toassert properties of classes and relationships between them (e.g., as done inUML class diagrams).
The assertion of properties is done in DLs by means of an ontology (orknowledge base).
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (79/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description Logics ontologies
Description Logics ontology (or knowledge base)
Is a pair O = 〈T ,A〉, where T is a TBox and A is an ABox:
Def.: Description Logics TBox
Consists of a set of assertions on concepts and roles:
Inclusion assertions on concepts: C1 v C2
Inclusion assertions on roles: R1 v R2
Property assertions on (atomic) roles:(transitive P ) (symmetric P ) (domain P C)(functional P ) (reflexive P ) (range P C) · · ·
Def.: Description Logics ABox
Consists of a set of assertions on individuals: (we use ci to denote individuals)
Membership assertions for concepts: A(c)
Membership assertions for roles: P (c1, c2)
Equality and distinctness assertions: c1 ≈ c2, c1 6≈ c2
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (80/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description Logics ontologies
Description Logics ontology – Example
Note: We use C1 ≡ C2 as an abbreviation for C1 v C2, C2 v C1.
TBox assertions:
Inclusion assertions on concepts:Father ≡ Human uMale u ∃hasChild
HappyFather v Father u ∀hasChild.(Doctor t Lawyer t HappyPerson)HappyAnc v ∀descendant.HappyFather
Teacher v ¬Doctor u ¬Lawyer
Inclusion assertions on roles:hasChild v descendant hasFather v hasChild−
Property assertions on roles:(transitive descendant), (reflexive descendant), (functional hasFather)
ABox membership assertions:
Teacher(mary), hasFather(mary, john), HappyAnc(john)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (81/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description Logics ontologies
Semantics of a Description Logics ontology
The semantics is given by specifying when an interpretation I satisfies anassertion α, denoted I |= α.
TBox Assertions:
I |= C1 v C2 if CI1 ⊆ CI2 .
I |= R1 v R2 if RI1 ⊆ RI2 .
I |= (prop P ) if P I is a relation that has the property prop.(Note: domain and range assertions can be expressed by means of conceptinclusion assertions.)
ABox Assertions:We need first to extend the interpretation function ·I , so that it maps eachindividual c to an element cI of ∆I .
I |= A(c) if cI ∈ AI .
I |= P (c1, c2) if (cI1 , cI2 ) ∈ P I .
I |= c1 ≈ c2 if cI1 = cI2 .
I |= c1 6≈ c2 if cI1 6= cI2 .
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (82/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Description Logics ontologies
Model of a Description Logics ontology
Def.: Model
An interpretation I is a model of:
an assertion α, if it satisfies α.
a TBox T , if it satisfies all assertions in T .
an ABox A, if it satisfies all assertions in A.
an ontology O = 〈T ,A〉, if it is a model of both T and A.
Note: We use I |= β to denote that interpretation I is a model of β(where β stands for an assertion, TBox, ABox, or ontology).
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (83/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description LogicsReducing reasoning in UML to reasoning in DLsReducing reasoning in DLs to reasoning in UML
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (84/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
DLs vs. UML Class Diagrams
There is a tight correspondence between variants of DLs and UML ClassDiagrams [Berardi et al., 2005; Artale et al., 2007].
We can devise two transformations:
one that associates to each UML Class Diagram D a DL TBox TD.one that associates to each DL TBox T a UML Class Diagram DT .
The transformations are not model-preserving, but are based on acorrespondence between instantiations of the Class Diagram and models ofthe associated TBox.
The transformations are satisfiability-preserving, i.e., a class C isconsistent in D iff the corresponding concept is satisfiable in T .
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (85/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description LogicsReducing reasoning in UML to reasoning in DLsReducing reasoning in DLs to reasoning in UML
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (86/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding UML Class Diagrams in DLs
The ideas behind the encoding of a UML Class Diagram D in terms of a DLTBox TD are quite natural:
Each class is represented by an atomic concept.
Each attribute is represented by a role.
Each binary association is represented by a role.
Each non-binary association is reified, i.e., represented as a conceptconnected to its components by roles.
Each part of the diagram is encoded by suitable assertions.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (87/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of classes and attributes
A UML class C is represented by an atomic concept C
Each attribute a of type T for C is represented by an atomic role a.
To encode the typing of a:
∃a v C ∃a− v T
To encode the multiplicity [m..n] of a:
C v (≥ ma) u (≤ na)
When m is 0, we omit the first conjunct.When n is ∗, we omit the second conjunct.When the multiplicity is [0..∗] we omit the whole assertion.When the multiplicity is missing (i.e., [1..1]), the assertion becomes:
C v ∃a u (≤ 1 a)
Note: We have assumed that different classes don’t share attributes.
The encoding can be extended also to operations of classes.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (88/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of classes and attributes – Example
number[1..*]: String
brand: String
lastDialed(): String
callLength(String): Integer
class name
attributes
operations
Phone
To encode the class Phone, we introduce a concept Phone.
Encoding of the attributes number and brand:
∃number v Phone∃brand v Phone
∃number− v String∃brand− v String
Encoding of the multiplicities of the attributes number and brand:
Phone v ∃numberPhone v ∃brand u (≤ 1 brand)
We do not consider the encoding of the operations: lastDialed() andcallLength(String).
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (89/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of associations
The encoding of associations depends on:
the presence/absence of an association class;
the arity of the association.
Without WithArity association class association class
Binary via a DL role via reificationNon-binary via reification via reification
Note: an aggregation is just a particular kind of binary association withoutassociation class and is encoded via a DL role.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (90/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of binary associations without association class
min1 ..max1 C2
AC1
min2 ..max2
An association A between C1 and C2 is represented by a DL role A, with:
∃A v C1 ∃A− v C2
To encode the multiplicities of A:
each instance of class C1 is connected through association A to at leastmin1 and at most max1 instances of C2:
C1 v (≥ min1 A) u (≤ max1 A)
each instance of class C2 is connected through association A− to at leastmin2 and at most max2 instances of C1:
C2 v (≥ min2 A−) u (≤ max2 A−)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (91/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Binary associations without association class – Example
reference
1..1 1..∗ PhoneCallPhoneBill
∃reference v PhoneBill∃reference− v PhoneCall
PhoneBill v (≥ 1 reference)PhoneCall v (≥ 1 reference−) u (≤ 1 reference−)
Note: an aggregation is just a particular kind of binary association withoutassociation class.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (92/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of associations via reification
A
C1 Cn
C2
. . .A1
A2An
a
A1 AnA2
C1 C2. . . Cn
o1 o2 on
A
An association A is represented by a concept A.
Each instance a of A represents an instance (o1, . . . , on) of the association.
n (binary) roles A1, . . . , An are used to connect an object a representing atuple to objects o1, . . . , on representing the components of the tuple.
To ensure that the instances of A correctly represent tuples:
∃Ai v A, for i ∈ {1, . . . , n}∃A−i v Ci, for i ∈ {1, . . . , n}A v ∃A1 u · · · u ∃An u (≤ 1A1) u · · · u (≤ 1An)
Note: when the roles of A are explicitly named in the class diagram, we can usesuch role names instead of A1, . . . , An.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (93/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of associations via reification
We have not ruled out the existence of two instances a1, a2 of concept Arepresenting the same instance (o1, . . . , on) of association A:
a2
a1
C1
A
. . .
A
An
A2
An
A2A1
A1
Cno2 onC2o1
To rule out such a situation we could addan identification assertion (see later):
(id A A1, . . . , An)
Note: in a tree-model the above situation cannot occur.
; By the tree-model property of DLs, when reasoning on a KB, we can restrictthe attention to tree-models.Hence we can ignore the identification assertions.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (94/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Multiplicities of binary associations with association class
A2
C2min1 ..max1
C1min2 ..max2
A
A1
We can encode the multiplicities of association A by means of numberrestrictions on the inverses of roles A1 and A2:
each instance of class C1 is connected through association A to at leastmin1 and at most max1 instances of C2:
C1 v (≥ min1 A−1 ) u (≤ max1 A
−1 )
each instance of class C2 is connected through association A− to at leastmin2 and at most max2 instances of C1:
C2 v (≥ min2 A−2 ) u (≤ max2 A
−2 )
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (95/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Associations with association class – Example
from
0..∗call
1..1 Phone
place: String
Origin
PhoneCall
∃place v Origin ∃place− v StringOrigin v ∃place u (≤ 1 place)∃call v Origin ∃call− v PhoneCall∃from v Origin ∃from− v PhoneOrigin v ∃call u (≤ 1 call) u
∃from u (≤ 1 from)PhoneCall v (≥ 1 call−) u (≤ 1 call−)
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (96/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of ISA and generalization
C1
C
C1 v C
C2
C
C1 . . . Ck
C1 v C...
Ck v C
When the generalization is disjoint:
Ci v ¬Cj for 1 ≤ i < j ≤ k
When the generalization is complete:
C v C1 t · · · t Ck
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (97/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding of ISA between associations
Without reification:
C1 C2
C′2C′
1
A
A′
Role inclusion assertion: A′ v A
With reification:
C1 C2
C′1 C′
2
A′
A
A1
A′1
A2
A′2
Concept inclusion assert.: A′ v A
Role inclusion assertions: A′1 v A1
A′2 v A2
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (98/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
ISA and generalization – Example
ETACSphone GSMphone UMTSphone
CellPhone
{disjoint, complete}
ETACSphone v CellPhone ETACSphone v ¬GSMPhone
GSMSphone v CellPhone ETACSphone v ¬UMTSPhone
UMTSSphone v CellPhone GSMphone v ¬UMTSPhone
CellPhone v ETACSphone t GSMphone t UMTSPhone
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (99/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding UML Class Diagrams in DLs – Example
fromMO
referencePhoneBill PhoneCall Phone
MobileCall CellPhone FixedPhone
MobileOrigin
Origin
{disjoint, complete}place: String
callO fromO
callMO
1..1 1..*
0..*
0..* 0..*
1..1
∃reference v PhoneBill∃reference− v PhoneCall
PhoneBill v (≥ 1 reference)PhoneCall v (≥ 1 reference−) u
(≤ 1 reference−)
∃place v Origin∃place− v String
Origin v ∃place u (≤ 1 place)
∃callO v Origin∃callO− v PhoneCall∃fromO v Origin∃fromO− v Phone
Origin v ∃callO u (≤ 1 callO) u∃fromO u (≤ 1 fromO)
PhoneCall v (≥ 1 callO−) u (≤ 1 callO−)
∃callMO v MobileOrigin∃callMO− v MobileCall∃fromMO v MobileOrigin∃fromMO− v CellPhone
MobileOrigin v ∃callMO u (≤ 1 callMO) u∃fromMO u (≤ 1 fromMO)
MobileOrigin v OrigincallMO v callO
fromMO v fromO
MobileCall v PhoneCall
CellPhone v PhoneFixedPhone v Phone u ¬CellPhone
Phone v CellPhone t FixedPhone
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (100/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Encoding UML Class Diagrams in DLs – Example 2
empCode: Integersalary: Integer
Employee
Manager
AreaManager
TopManager
1..*
1..1
boss
projectName: String
Project1..*
1..1
1..1
worksFor
manages
3..*
{disjoint, complete}
Manager v EmployeeAreaManager v ManagerTopManager v Manager
AreaManager v ¬TopManagerManager v AreaManager t
TopManager
∃salary− v Integer∃salary v Employee
Employee v ∃salary u (≤ 1 salary)
∃worksFor v Employee∃worksFor− v Project
Employee v ∃worksForProject v (≥ 3 worksFor−)
manages v worksFor· · ·
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (101/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in UML to reasoning in DLs
Reasoning on UML Class Diagrams using DLs
The encoding shows that we can reason over UML Class Diagrams as follows:
1 Transform the UML Class Diagram D into a DL TBox TD.
2 Use standard techniques to reason on TD, and transfer the results to D.
Hence, reasoning over UML Class Diagrams:
is computationally not harder than reasoning over ontologies in expressiveDLs, i.e., in ExpTime.
can be done effectively by using state-of-the-art reasoners for expressiveDLs.
Questions
Is it actually necessary to make use of a formalism with such a highcomputational complexity?Can we use instead an encoding in a computationally simpler formalism?
We will show in the following that this complexity is intrinsic in UML ClassDiagrams, unless we pose some restrictions on the form of the diagram.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (102/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Outline
1 Introduction to conceptual modeling
2 Formalizing UML Class Diagrams in FOL
3 Forms of reasoning on UML Class Diagrams
4 Brief overview of Description Logics
5 Reasoning on UML Class Diagrams using Description LogicsReducing reasoning in UML to reasoning in DLsReducing reasoning in DLs to reasoning in UML
6 References
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (103/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Reducing reasoning in ALC to reasoning in UML
We show how to reduce reasoning over ALC TBoxes to reasoning on UMLClass Diagrams:
We restrict the attention to so-called primitive ALC− TBoxes, where theconcept inclusion assertions have a simplified form:
there is a single atomic concept on the left-hand side;there is a single concept constructor on the right-hand side.
Given a primitive ALC− TBox T , we construct a UML Class Diagram DTsuch that:
an atomic concept A in T is satisfiableiff
the corresponding class A in DT is satisfiable.
Note: We preserve satisfiability, but do not have a direct correspondencebetween models of T and instantiations of DT .
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (104/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Encoding DL TBoxes in UML Class Diagrams
Given a primitive ALC− TBox T , we construct DT as follows:
For each atomic concept A in T , we introduce in DT a class A.
We introduce in DT an additional class O that generalizes all the classescorresponding to atomic concepts.
For each atomic role P , we introduce in DT :
a class CP (that reifies P );two functional associations P1, P2, representing the two components of P .
For each inclusion assertion in T , we introduce suitable parts of DT , asshown in the following.We need to encode the following kinds of inclusion assertions:
A v BA v ¬BA v B1 tB2
A v ∃P .BA v ∀P .B
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (105/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Encoding of inclusion and of disjointness
For each assertion A v B of T , add the following to DT :
A B
For each assertion A v ¬B of T , add the following to DT :
{disjoint}
O
A B
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (106/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Encoding of union
For each assertion A v B1 tB2 of T , introduce an auxiliary class B, and addthe following to DT :
{complete}
A B
B1 B2
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (107/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Encoding of existential quantification
For each assertion A v ∃P .B of T , introduce the auxiliary class CPABand the
associations PAB1 and PAB2, and add the following to DT :
1..1
PAB1
1..1
1..*
PAB2P2P1
1..1 1..1O
A B
CP
CPAB
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (108/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Encoding of universal quantification
For each assertion A v ∀P .B of T , introduce the auxiliary classes A, CPAB,
and CPAB, and the associations PAB1, PAB1, and PAB2, and add the following
to DT :
{disjoint}
{complete}
1..1
P1
1..1
P2
1..1
PAB1
PAB1
1..1
PAB2
1..1
O
B
A A
CPAB CPAB
CP
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (109/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Complexity of reasoning on UML Class Diagrams
Lemma
An atomic concept A in a primitive ALC− TBox T is satisfiable if and only ifthe class A is satisfiable in the UML Class Diagram DT .
Reasoning over primitive ALC− TBoxes is ExpTime-hard.From this, we obtain:
Theorem
Reasoning over UML Class Diagrams is ExpTime-hard.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (110/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
Reasoning on UML Class Diagrams using DLs
The two encodings show that DL TBoxes and UML Class Diagramsessentially have the same computational properties.
Hence, reasoning over UML Class Diagrams has the same complexity asreasoning over ontologies in expressive DLs, i.e., ExpTime-complete.
This is somewhat surprising, since UML Class Diagrams are so widely usedand yet reasoning on them (and hence fully understanding the implicationthey may give rise to), in general is a computationally very hard task.
The high complexity is caused by:1 the possibility to use disjunction (covering constraints)2 the interaction between role inclusions and functionality constraints
(maximum 1 cardinality – see encoding of universal and existentialquantification)
Note: Without (1) and restricting (2), reasoning becomes simpler [Artale et al., 2007;Artale et al., 2009]:
NLogSpace-complete in combined complexity
in LogSpace in data complexity
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (111/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
Reducing reasoning in DLs to reasoning in UML
UML Class Diagrams for efficient access to data
We are interested in using UML Class Diagrams to specify ontologies that aresuitable for accessing data efficiently, i.e., we are interested in using UML ClassDiagrams for ontology-based data access:
Besides intensional reasoning, one is interested in query answering.
The relevant complexity measure is data complexity, i.e., the complexitymeasured in the size of the data only.
Questions
Which is the right combination of constructs to allow in UML ClassDiagrams to be used for OBDA?
Are there techniques for query answering in this case that can be derivedfrom Description Logics?
Can query answering be done efficiently in the size of the data?
If yes, can we leverage relational database technology for query answering?
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (112/113)
unibz.itunibz.it
Introduction UML in FOL Forms of reasoning Intro to DLs Reasoning in UML via DLs References
References I
[Artale et al., 2007] Alessandro Artale, Diego Calvanese, Roman Kontchakov, VladislavRyzhikov, and Michael Zakharyaschev.
Reasoning over extended ER models.
In Proc. of the 26th Int. Conf. on Conceptual Modeling (ER 2007), volume 4801 of LectureNotes in Computer Science, pages 277–292. Springer, 2007.
[Artale et al., 2009] Alessandro Artale, Diego Calvanese, Roman Kontchakov, and MichaelZakharyaschev.
The DL-Lite family and relations.
J. of Artificial Intelligence Research, 36:1–69, 2009.
[Baader et al., 2003] Franz Baader, Diego Calvanese, Deborah McGuinness, Daniele Nardi,and Peter F. Patel-Schneider, editors.
The Description Logic Handbook: Theory, Implementation and Applications.
Cambridge University Press, 2003.
[Berardi et al., 2005] Daniela Berardi, Diego Calvanese, and Giuseppe De Giacomo.
Reasoning on UML class diagrams.
Artificial Intelligence, 168(1–2):70–118, 2005.
Diego Calvanese (FUB) DLs for Conceptual Modeling EPCL BTC – 10–21/12/2012 (113/113)