semantic model-driven engineering - uni koblenz-landaustaab/presentations/staab... · pim psm code...

84
Web Science & Technologies University of Koblenz Landau, Germany Semantic Model-driven Engineering Steffen Staab with Gerd Gröner, Fernando Silva Parreiras, Tobias Walter

Upload: trannga

Post on 07-Feb-2019

216 views

Category:

Documents


0 download

TRANSCRIPT

Web Science & TechnologiesUniversity of Koblenz ▪ Landau, Germany

Semantic Model-driven Engineering

Steffen Staabwith

Gerd Gröner, Fernando Silva Parreiras, Tobias Walter

Steffen [email protected]

Reasoning Web2 of 84

WeST

Semantic WebDr. Janik

Web RetrievalDr. Sizov

Interactive WebDr. Scherp

Multimedia WebDr. Grzegorzek

Software WebF. Silva Parreiras

Prof. Dr. Staab Prof. Dr. Sure

EU WeGovEU X-Media

HP Synth DocsEU WeKnowItDFG Multipla EU Most

BMBF CollabCloudEU NeOn

EU Tagora

Who we are

GESISProf. Sure

EU WeGovEU ASG

EU aceMediaEU kspace

EU Net2

Steffen [email protected]

Reasoning Web3 of 84

WeST

Two Worlds of Models

MDA / MDE

IngredientsModels: representing complementaryviews of a system

StructuralBehavioral

Metamodeling: Linguistic instantiation of syntactic class descriptionsTransformations:Towards target platformAdding refinements

Description Logics / Ontologies

IngredientsOntologies: representing complementaryviews of a system

Structural(Behavioral)

Metamodeling: Ontological instantiation of logical class descriptionsTransformations:Between knowledgebases/ontologies

Steffen [email protected]

Reasoning Web4 of 84

WeST

Model-driven Engineering

Refinements in several dimensionsRefinements along metamodeling levels

DSL User

DSL DesignerDSL

Metamodel

uses

specifies

Domain Modelbuilds

MetamodelingLanguage

uses

Framework Developer specifies

M1

M2

M3

Steffen [email protected]

Reasoning Web5 of 84

WeST

Model-driven Engineering

Refinements in several dimensionsRefinements along metamodeling levelsRefinements along model specification

From business developer to software developer

Steffen [email protected]

Reasoning Web6 of 84

WeST

Model-driven Engineering

Refinements in several dimensionsRefinements along model specification

From business developer to software developerRefinements along metamodeling levelsRefinements along platform specification

For Ontology Translations

Classical MDA

PIM PSM Code

JAVAUML UML

Steffen [email protected]

Reasoning Web7 of 84

WeST

Model-driven Engineering

Refinements in several dimensionsRefinements along metamodeling levelsRefinements along model specification

From business developer to software developerRefinements along platform specification

For Ontology TranslationsRefinements along time

Metamodel evolution• Suggesting changes to transformations

by DL reasoningOntology API Co-evolution

Steffen [email protected]

Reasoning Web8 of 84

WeST

Agenda

Description Logics Reasoning by Example

Model-driven engineering with OWL

Refinements in several dimensionsRefinements along metamodeling levels [Models 2009, ECMFA 2010]Refinements along model specification [DL 2009, EKAW 2010]

• From business developer to software developerRefinements along platform specification [ER 2008]

• For Ontology TranslationsRefinements along time

• Metamodel evolution [ISWC2010]– Suggesting changes to transformations

by DL reasoning• Ontology API Generation/Co-evolution[ICSC 2009]

Steffen [email protected]

Reasoning Web9 of 84

WeST

Description Logics

Description Logics (DLs) are logics designed to represent and reason on structured knowledgeThe domain of interest is structured into (TBox):

concepts, which correspond to classes, and denote sets of individualsroles, which correspond to associations, and denote binary relations on individuals

The knowledge is asserted through so-called assertions (ABox)They provide formal semanticsDLs provide the foundations for standard ontology languages, like OWL2

BUT: Why should a software engineer care?

Steffen [email protected]

Reasoning Web10 of 84

WeST

Model-driven Software Development using DL

General Problems from Knowledge Representation (KR) perspective

Representational View• Lack of formal semantics in modeling languages• metamodel to check syntax but not semantics of a model• If there is a formal semantics, modeling languages are often

too expressive to have sound and complete, full-fledged, general purpose reasoner

Operational ViewReasoning Tasks are not well automated

Transformations from Models to Description Logics as an asset, not as a silver bullet

Steffen [email protected]

Reasoning Web11 of 84

WeST

Example: Satisfiability Checking in the MDE Process

Reasoning on UML class diagrams

Classical MDA

PIM PSM Code

Translation

OWL

JAVAUML UML

[Calvanese et al, AIJ 2005]

Steffen [email protected]

Reasoning Web12 of 84

WeST

Example: Satisfiability Checking

Every

WebPortalAccount

is used by at

most one Researcher

UserAccount User0..n 10..n 1Owns

Student

Uses {complete, disjoint}

WebPortalAccount Researcher1..n0..1

Researcheris disjoint from

Student

if Researcher is empty, User and Student will be

redundantUnsatisfiable

Steffen [email protected]

Reasoning Web13 of 84

WeST

Example: Satisfiability Checking

UserAccount User0..n 10..n 1Owns

Student

Uses {complete, disjoint}

WebPortalAccount Researcher1..n0..1

Unsatisfiable

Advantage for software engineering:

Models with provably higher quality

Steffen [email protected]

Reasoning Web14 of 84

WeST

Ontology Driven Software Development (ODSD)

Using ontologies to formalize modelsModeling relationships between artifactsInferring relationships between artifacts, e.g. traceability relationships Ensuring semantic correctness by constraint validationGuiding the development by reasoning (reasoning in process/model development)

Steffen [email protected]

Reasoning Web15 of 84

WeST

Agenda

Description Logics Reasoning by Example

Model-driven engineering (with OWL)

Refinements in several dimensionsRefinements along metamodeling levels [Models 2009, ECMFA 2010]Refinements along model specification [DL 2009, EKAW 2010]

• From business developer to software developerRefinements along platform specification [ER 2008]

• For Ontology TranslationsRefinements along time

• Metamodel evolution [ISWC2010]– Suggesting changes to transformations

by DL reasoning• Ontology API Generation/Co-evolution[ICSC 2009]

Steffen [email protected]

Reasoning Web16 of 84

WeST

A note on Software Languages as a field of research

Grammarware Modelware

Java

C#

Scala C

Fortran

MOF

BPEL

UML

Ecore

BPMNPetrinets

ER diagramsLispHaskell

OntoWare

Ruby

OWL-DLRIF

OCL

F-Logic

Software Language

Engineering

Steffen [email protected]

Reasoning Web17 of 84

WeST

Objectives

ContextSoftware LanguagesOntology Languages

Language BridgesTransforming Software Languages to OWLIntegrating Software Languages with OWL

ServicesReasoning ServicesQuerying Services

Steffen [email protected]

Reasoning Web18 of 84

WeST

MDE/MDA is based on Metamodeling

Model hierarchyEcore Metametamodel

Ecore‐based Metamodel

Model Model

instanceOf

instanceOf instanceOf

Real World Systems

representationOf representationOf

Language User

Language Designer

Steffen [email protected]

Reasoning Web19 of 84

WeST

Ecore vs. UML

MOF simplifies UML Class DiagramsNo n-ary associationsNo association classesUsed for metamodeling

Ecore: two aspectsimplements MOF as part of EclipseSpecification language like MOF (minus some bugs)

Steffen [email protected]

Reasoning Web20 of 84

WeST

Example for 4-layered architecture

Model

Ecore‐based Metamodel

Ecore Metametamodel

conformsTo

conformsTo

Language User

Language Designer

Example: Process modeling

Steffen [email protected]

Reasoning Web21 of 84

WeST

Example: Process Model

Model (Activity Diagram)designed by language user

[orderaccepted]

Receive Order Close Order

Accept Payment

Ship OrderFill Order

Send Invoice Make Payment

Invoice

[orderrejected]

Language User

Steffen [email protected]

Reasoning Web22 of 84

WeST

Example: Metamodel for Process Models

M2 metamodel (Activity Diagram)conforms to Ecore M3 metametamodelvisualized using concrete syntax of UML class diagrams

Language Designer

Steffen [email protected]

Reasoning Web23 of 84

WeST

Example: Metamodel for Process Models (2)Ecore-based metamodel (Activity Diagram)

conforms to Ecore M3 metametamodelvisualized using textual concrete syntax

abstract class ActivityNode {reference incoming [0-*] : ActivityEdge oppositeOf target;reference outgoing [0-*] : ActivityEdge oppositeOf source;

}class ObjectNode extends ActivityNode { }class Action extends ActivityNode {attribute name : String;

}

abstract class ControlNode extends ActivityNode { }class Initial extends ControlNode { }class Final extends ControlNode { }class Fork extends ControlNode { }class Join extends ControlNode { }class Merge extends ControlNode { }class Decision extends ControlNode { }

abstract class ActivityEdge {reference source [1-1] : ActivityNode;reference target [1-1] : ActivityNode;

}class ObjectFlow extends ActivityEdge { }class ControlFlow extends ActivityEdge { }

Language Designer

Steffen [email protected]

Reasoning Web24 of 84

WeST

Example: Metametamodel for Process Models

Ecore M3 metametamodel

Steffen [email protected]

Reasoning Web25 of 84

WeST

Exercise

Take 10 minutesWrite down a metamodel for Java method declarations (or for your other favorite language)

Suggestion: write down 3 example method declarations first

Steffen [email protected]

Reasoning Web26 of 84

WeST

Exercise 2

Take 5 minutesWrite down a metametamodel i.e. a metamodel language for the metamodel describing Java method declarations

Steffen [email protected]

Reasoning Web27 of 84

WeST

General Scheme for Metametamodel based Transformations

Steffen [email protected]

Reasoning Web28 of 84

WeST

So far

Metamodels as abstract grammar for our modelsAbstract grammar defines what is related to what

Undefined: word orderUndefined: semanticsUndefined: visual syntax

(e.g. textual or diagrammatic syntax)

Now: ontologies are models, too!

Steffen [email protected]

Reasoning Web29 of 84

WeST

Ontologies as Target Software Models

OWL2 Metamodel (excerpt)

http://www.w3.org/TR/owl2-syntax/

Steffen [email protected]

Reasoning Web30 of 84

WeST

Ontologies as Target Software ModelsLinguistic instantiation of the OWL2 metamodel in

OWL2 Functional Style Syntax (axiom-based)SubClassOf(ActivityEdge owl:Thing)

SubClassOf(ActivityNode owl:Thing)

ObjectPropertyDomain(to ActivityEdge)ObjectPropertyRange(to ActivityNode)

ObjectPropertyDomain(outgoing ActivityNode)ObjectPropertyRange(outgoing ActivityEdge)

ObjectPropertyDomain(from ActivityEdge)ObjectPropertyRange(from ActivityNode)

ObjectPropertyDomain(incoming ActivityNode)ObjectPropertyRange(incoming ActivityEdge)

ClassAssertion(action1 Action)

http://www.w3.org/TR/owl2-syntax/

Steffen [email protected]

Reasoning Web31 of 84

WeST

Ontologies as Target Software Models

OWL2 Manchester Style Syntax (frame-based) requires a different metamodel

Class: ActivityEdgeSubClassOf: owl:Thing

Class: ActivityNodeSubClassOf: owl:Thing

ObjectProperty: toDomain: ActivityEdgeRange: ActivityNode

ObjectProperty: outgoingDomain: ActivityNode Range: ActivityEdge

ObjectProperty: fromDomain: ActivityEdge Range: ActivityNode

ObjectProperty: incomingDomain: ActivityNode Range: ActivityEdge

Individual: action1Types: Action

http://www.w3.org/TR/owl2-manchester-syntax/

Steffen [email protected]

Reasoning Web32 of 84

WeST

Translating ontology syntaxesOWL2 Functional Syntax

metamodelOWL2 Manchester Syntax

metamodel

SubClassOf(ActivityEdge owl:Thing)

SubClassOf(ActivityNode owl:Thing)

ObjectPropertyDomain(to ActivityEdge)ObjectPropertyRange(to ActivityNode)

ObjectPropertyDomain(outgoing ActivityNode)ObjectPropertyRange(outgoing ActivityEdge)

ObjectPropertyDomain(from ActivityEdge)ObjectPropertyRange(from ActivityNode)

ObjectPropertyDomain(incoming ActivityNode)ObjectPropertyRange(incoming ActivityEdge)

ClassAssertion(action1 Action)

Class: ActivityEdgeSubClassOf: owl:Thing

Class: ActivityNodeSubClassOf: owl:Thing

ObjectProperty: toDomain: ActivityEdgeRange: ActivityNode

ObjectProperty: outgoingDomain: ActivityNode Range: ActivityEdge

ObjectProperty: fromDomain: ActivityEdge Range: ActivityNode

ObjectProperty: incomingDomain: ActivityNode Range: ActivityEdge

Individual: action1Types: Action

define mapping

derive translation

Steffen [email protected]

Reasoning Web33 of 84

WeST

Comparing Ecore with OWL

Many similar constructs

Reasoners use logic-based languageRepresentation of software models in a logic-based language

We need bridges!

Ecore OWLpackage ontologyclass classinstance and literals individual and literalsreference, attribute object, data propertydata types data typesenumeration enumerationmultiplicity cardinalityOpposite reference Inverse object properties

Steffen [email protected]

Reasoning Web34 of 84

WeST

Software Language Bridges

2 kinds of Language BridgesM3 Transformation bridgeM3 Integration bridge Just one (of many)

possible pictures

Steffen [email protected]

Reasoning Web35 of 84

WeST

M3 Transformation Bridge

Transformation of Ecore Technical Space with Ontology Language OWL2

Transformation of Ecore-based MetamodelsTransformation of conforming Models

Transformation Definition

Transformation Use

Steffen [email protected]

Reasoning Web36 of 84

WeST

M3 Transformation Bridge

OWLizerTransforming Software Metamodels to Ontology TBoxTransforming Software Models to Ontology ABox

OW

Lizing

Language User

Language Designer

Just one (of many)

possible pictures

Steffen [email protected]

Reasoning Web37 of 84

WeST

Example: Ecore to OWL - OWLizer

Language User

Language Designer

• Definition of Transformation Bridge• Model transformation rules according to mappings

of constructs similar in Ecore and OWL2

Steffen [email protected]

Reasoning Web38 of 84

WeST

Example: Ecore to OWL - OWLizer

Language User

Language Designer

SubClassOf(ActivityEdge owl:Thing)SubClassOf(ActivityNode owl:Thing)

ObjectPropertyDomain(to ActivityEdge)ObjectPropertyRange(to ActivityNode)ObjectPropertyDomain(from ActivityEdge)ObjectPropertyRange(from ActivityNode)

...

ClassAssertion(A Action)ClassAssertion(B Action)ClassAssertion(C Action)

ClassAssertion(e1 ObjectFlow)ClassAssertion(e2 ObjectFlow)

ObjectPropertyAssertion(to e1 B)ObjectPropertyAssertion(from e1 A)

...

use of transformation bridge

use of transformation bridge

Steffen [email protected]

Reasoning Web39 of 84

WeST

Video

Transforming Ecore Models and Metamodels into OWL using the OWLizer.mp4

Steffen [email protected]

Reasoning Web40 of 84

WeST

Some observations

Transforming some class-like structures to OWL is sort of trivial

But:A metamodel-based approach saves work if multiple output formats are expectedReasoning on the output/input structures may be helpfulThe demonstrations neglect (so far) the distinction between:

Ecore: Linguistic instantiation• The way how things may be phrased in a sentence is constrained

OWL: Semantic instantiation• The way how things are factually related in the world is constrained

Steffen [email protected]

Reasoning Web41 of 84

WeST

How it works: Extending Software Metamodels

Integration of Ecore Technical Space with Ontology Language OWL2

Integration of abstract Syntax• OWL2 metamodel + Ecore Metametamodel

Integration of concrete Syntax• OWL2 concrete syntax + Ecore concrete Syntax

Create Ecore-based metamodels with integrated• OWL2 axioms• OWL2 expressions

Steffen [email protected]

Reasoning Web42 of 84

WeST

How it works: Integration of abstract Syntax

Metamodel Integration by using Integration OperationsMerge of concepts

Relation of concepts by• Specialization Relationship

• Association

Steffen [email protected]

Reasoning Web43 of 84

WeST

How it works: Ecore Metametamodel + OWL2 Metamodel

Integration of abstract SyntaxResult: Integrated Metametamodel

Steffen [email protected]

Reasoning Web44 of 84

WeST

Textual Concrete Syntax for Coding Metamodels• Simple Syntax, similar to Java

Grammar (concrete Syntax):

How it works: Ecore concrete syntax

class ::= ["abstract"] "class" name [supertypes] "{" features "}";...

feature ::= attribute | reference;...

attribute ::= "attribute" name multiplicity ":" typeref ";";...

reference ::= "reference" name multiplicity [iscontainer] ":“typeref ["oppositeOf" name] ";";

...

Steffen [email protected]

Reasoning Web45 of 84

WeST

How it works: Example of Ecore Textual Concrete Syntax

(textual) Activity Diagram Metamodelabstract class ActivityNode {

reference incoming [0-*] : ActivityEdge oppositeOf target;reference outgoing [0-*] : ActivityEdge oppositeOf source;

}class ObjectNode extends ActivityNode { }class Action extends ActivityNode {attribute name : String;

}

abstract class ControlNode extends ActivityNode { }class Initial extends ControlNode { }class Final extends ControlNode { }class Fork extends ControlNode { }class Join extends ControlNode { }class Merge extends ControlNode { }class Decision extends ControlNode { }

abstract class ActivityEdge {reference source [1-1] : ActivityNode;reference target [1-1] : ActivityNode;

}class ObjectFlow extends ActivityEdge { }class ControlFlow extends ActivityEdge { }

Steffen [email protected]

Reasoning Web46 of 84

WeST

How it works: Extension of textual concrete syntax

• New non-terminals:• classAxioms: produces a list of OWL Class Axioms

• objectPropertyAxioms: produces a list of OWL Object Property Axioms

• dataPropertyAxioms: produces a list of OWL Data Property Axioms

class ::= ["abstract"] "class" name [supertypes] [classAxioms] "{" features "}";

classAxioms ::= ClassAxiom { "," ClassAxiom};

reference ::= "reference" name multiplicity iscontainer ":" typeref "oppositeOf“name [objectPropertyAxioms] ";";

objectPropertyAxioms ::= ObjectPropertyAxiom { "," ObjectPropertyAxiom};

attribute ::= "attribute" name multiplicity ":" typeref [dataPropertyAxioms] ";";

dataPropertyAxioms ::= DataPropertyAxiom { "," DataPropertyAxiom};

Steffen [email protected]

Reasoning Web47 of 84

WeST

How it works: Example

• Extended Metamodel of Activity Diagram (excerpt)class ActivityNode equivalentWith restrictionOn edge with some Final{reference incoming [0-*] : ActivityEdge oppositeOf target;reference outgoing [0-*] : ActivityEdge oppositeOf source;

transitive reference edge [0-*] : ActivityNode isChain(outgoing, target);}

...

class Initial extends ControlNode, subClassOf restrictionOn outgoing with some

(restrictionOn with some (Action or ControlNode)){

}

Steffen [email protected]

Reasoning Web48 of 84

WeST

Transforming software model to OWL

Why?

Its the reasoning, stupid!

Steffen [email protected]

Reasoning Web49 of 84

WeST

Video

extending ecore models with owl annotations.mp4

Steffen [email protected]

Reasoning Web50 of 84

WeST

Reasoning Services

Steffen [email protected]

Reasoning Web51 of 84

WeST

Consistency Checking

Name Consistency CheckingSignature boolean consistency (Ontology O)Description Checks if the given ontology O is consistent, i.e. if there exists a model

(a model-theoretic instance) for O. If ontology O is consistent, thenreturn true. Otherwise return false.

Pattern b = consistency (O)Input An Ontology OOutput b = true iff O is consistent,

b = false otherwise

Steffen [email protected]

Reasoning Web52 of 84

WeST

Consistency Checking in Software Modeling

Accomplished ServiceEnsures that a Model does not contain any contradictory facts with regard to its Language Metamodel

Requirements for Language Designers• Possibility to define Constraints and Restrictions• Define Axioms

Benefits for Language User• Sound Models

Steffen [email protected]

Reasoning Web53 of 84

WeST

Consistency Checking (be aware of OWA!)

class ActivityNode equivalentWith restrictionOn edge with some Final{reference incoming [0-*] : ActivityEdge oppositeOf target;reference outgoing [0-*] : ActivityEdge oppositeOf source;

transitive reference edge [0-*] : ActivityNode isChain(outgoing, target);}

M2 Metamodel

M1 ModelInconsistency:

Disallowed Edge to Initial Action

Receive Order

Steffen [email protected]

Reasoning Web54 of 84

WeST

Satisfiability Checking

Name Satisfiability checkingSignature Set<Concept> GetUnsatisfiable (Ontology O)Description Find all unsatisfiable concepts in given ontology O. A concept in an

ontology is unsatisfiable if it is an empty set. Return NULL if thereis not any unsatisfiable concept.

Pattern b = GetUnsatisfiable (O)Input An Ontology OOutput b = NULL iff there is no unsatisfiable concept

b = a set of unsatisfiable concepts otherwise

Steffen [email protected]

Reasoning Web55 of 84

WeST

Satisfiability Checking in Software Modeling

Accomplished ServiceFinds unsatisfiable classes in a metamodel

Benefits for Language DesignersHigher quality metamodels, where all classes can beinstantiated

Benefits for Language UsersLess inconsistencies in models (because instances of unsatisfiable classes lead to inconsistencies)

Steffen [email protected]

Reasoning Web56 of 84

WeST

Satisfiability Checking (Example)

class ActivityNode equivalentWith restrictionOn edge with some Final{reference incoming [0-*] : ActivityEdge oppositeOf target;reference outgoing [0-*] : ActivityEdge oppositeOf source;

transitive reference edge [0-*] : ActivityNode isChain(outgoing, target);}

class Final extends ControlNode subClassOf (restrictionOn edge with some ActivityNode) and

not(restrictionOn edge with some ActivityNode){ }

M2 Metamodel

Unsatisfiable Class:two contradictory

restrictions

Steffen [email protected]

Reasoning Web57 of 84

WeST

Classification

Name ClassificationSignature boolean classifiesAs (Ontology O, concept A, individual i)Description Checks if the given individual i is an instance of concept A in the

ontology ref, then return true. Otherwise return false.Pattern b = classifiesAs ( O, A, i)Input An Ontology O, Concept A and Individual iOutput b = true iff i is an instance of A,

b = false otherwise

Steffen [email protected]

Reasoning Web58 of 84

WeST

Classification in Software Modeling

Accomplished ServiceDetermines the most specific type an Model Element belongs toWith respect to all Attributes and Properties in the Context of the Model Element

Requirements for Language DesignersDefine AxiomsPossibility to define Constraints and Restrictions

Benefits for Language UsersAutomatically Refinement of Model ElementsSuggestions of suitable domain concepts to be used

Steffen [email protected]

Reasoning Web59 of 84

WeST

Classification (Example)

class ObjectNode extends ActivityNode equivalentWith ((restrictionOn incoming with some ObjectFlow)

and (restrictionOn outgoing with some ObjectFlow))

{ }

M2 Metamodel

M1 Model

Send Invoice Make PaymentInvoice

Classify Invoice NodeResult: It is of type

ObjectNode

Steffen [email protected]

Reasoning Web60 of 84

WeST

Subsumption Checking

Name Subsumption CheckingSignature boolean subsumes (Ontology O, concept A, concept B)Description Checks whether the interpretation of A is a subset of the interpretation

of B in the given ontology O. If the interpretation of A is a subset ofthe interpretation of B, then return true. Otherwise returns false.

Pattern b = subsumes (O,A,B)Input An Ontology O and concepts A, BOutput b = true iff the interpretation of A is a subset of the interpretation

of B in the ontology O,b = false otherwise

Steffen [email protected]

Reasoning Web61 of 84

WeST

Subsumption Checking in Software Modeling

Accomplished ServiceComputes a Subsumption Hierarchy of all Classesbased on all Class Expressions and Axioms in the Ontology

Requirements for Language DesignersDefine AxiomsPossibility to define Expressions and Restrictions

Steffen [email protected]

Reasoning Web62 of 84

WeST

Explanation

Name ExplanationSignature Set<Axiom> getExplanation (Ontology O, axiom Ax)Description Retrieve the set of axioms that entail axiom Ax in the given ontology,

then return them.Pattern b = getExplanation (O,Ax)Input An Ontology O and axiom AxOutput b = set of axioms that entail the given axiom Ax.

b = NULL otherwise

Steffen [email protected]

Reasoning Web63 of 84

WeST

Explanation for Software Modeling

Accomplished ServiceExplanations for subsumptions and unsatisfiable classes in metamodelsExplanations for inconsistencies in models

Benefits for Language DesignersDebugging of metamodels

Benefits for Language UsersDebugging of models

Steffen [email protected]

Reasoning Web64 of 84

WeST

Explanation (Example Unsatisfiability)

class ActivityNode equivalentWith restrictionOn edge with some Final{reference incoming [0-*] : ActivityEdge oppositeOf target;reference outgoing [0-*] : ActivityEdge oppositeOf source;

transitive reference edge [0-*] : ActivityNode isChain(outgoing, target);}

class Final extends ControlNode subClassOf (restrictionOn edge with some ActivityNode) and

not(restrictionOn edge with some ActivityNode){ }

M2 Metamodel

Explanation from TwoUse Toolkit---------------------------------------Unsatisfiability of Final:Explanation:

Final equivalentTo not edge some ActivityNodeand edge some ActivityNode

Steffen [email protected]

Reasoning Web65 of 84

WeST

Querying

Name Query answeringSignature Set answering (Ontology O, query q)Description checks the answer sets of a query q to ontology O.Pattern res = answering (Ontology O, query q)Input An Ontology O, and a query qOutput res = a set of answers of the query to the ontology iff there is a answer

setres = NULL if there is not any answer

Steffen [email protected]

Reasoning Web66 of 84

WeST

Querying Service for Software Modeling

Accomplished ServiceQuery for model elements and metamodel elementUse of OWL2 entailment regime

Benefits for Language DesignersRetrieving information on concepts

Benefits for Language UsersRetrieving existing and complex parts of modelsE.g. [Tappolet-2010].

Steffen [email protected]

Reasoning Web67 of 84

WeST

Querying (Example)Find all actions, that are executed before „Ship Order“:

M1 Model

[orderaccepted]

Receive Order Close Order

Accept Payment

Ship OrderFill Order

Send Invoice Make Payment

Invoice

[orderrejected]

Query ( ClassAssertion(?i Action), ObjectPropertyAssertion(InverseInverseObjectProperties(edge)

?i shiporder))

Results:-----------------| c |=================| fillorder || receiveorder |-----------------

Steffen [email protected]

Reasoning Web68 of 84

WeST

Querying (Example)

Find all unsatisfiable classes:

Find all concepts that do not go via edge to Final:

Query ( SubClassOf(?c owl:Nothing) )

Results:------------| c |============| Nothing || Final |------------

Query ( EquivalentClasses(?c Not(ObjectSomeValuesFrom(edge Final))))

Results:-------------------| c |===================| ActivityDiagram |-------------------

Steffen [email protected]

Reasoning Web69 of 84

WeST

Special notes: Open vs. Closed World

Mapping to:Abox: Incomplete vs. Complete modelsTbox: no problem

Tools support:Open World yesClosed Domain yesClosed World not really

Steffen [email protected]

Reasoning Web70 of 84

WeST

Conclusion for this part

Ontologies are software modelsMetamodeling facilitates life:

Use of established modeling toolsdefinition of translations

Reasoning not restricted to UML Class Diagrams

Classical MDA

PIM PSM Code

Translation

OWL

SoftwareModel Model

Steffen [email protected]

Reasoning Web71 of 84

WeST

Discussion…

… Questions?

Steffen [email protected]

Reasoning Web72 of 84

WeST

Semantic Model-driven Engineering

Improving Design Patterns by Description Logics: An integration bridge

Steffen Staab with

Gerd Gröner, Fernando Silva Parreiras, Tobias Walter

Steffen [email protected]

Reasoning Web73 of 84

WeST

Agenda

Description Logics Reasoning by Example

Model-driven engineering with OWL

Refinements in several dimensionsRefinements along metamodeling levels [Models 2009, ECMFA 2010]Refinements along model specification [DL 2009, EKAW 2010]

• From business developer to software developerRefinements along platform specification [ER 2008, DKE2010]

• For Ontology TranslationsRefinements along time

• Metamodel evolution [ISWC2010]– Suggesting changes to transformations

by DL reasoning• Ontology API Generation/Co-evolution [ICSC 2009]

Steffen [email protected]

Reasoning Web74 of 84

WeST

This part of the tutorial is about

Software Design Patterns

Cla

ssifi

catio

n

Infe

renc

e

Varia

ntM

anag

emen

t

Factorization of common functionality

Algorithm Encapsulation

Choice of implementations

Sel ec torSel ec tor

Pa tter nPa tter n

Description Logics(OWL)Weaving features of Description

Logics into the Strategy Pattern under the variant management subset of software design patterns.

Steffen [email protected]

Reasoning Web75 of 84

WeST

Running Example

An order-processing system for an international e-commerce company in the United StatesThis system must be able to process sales orders in many different countries, like the USA and Germany, and handle different tax calculations.

Steffen [email protected]

Reasoning Web76 of 84

WeST

Strategy Pattern

How to improve it?

TaskController

so : SalesOrder

getRulesForCountry() : Taxprocess()

USTax GermanTaxCountry

name : String

TaxtaxAmount()

Customer

SalesOrderprocess(tax : Tax)

context TaskController::getRulesForCountry():Taxbody:if so.customer.country.name = 'USA' then

USTax.new()elseif so.customer.country.name = 'GERMANY' then

GermanTax.new()endif

endif

Drawbacks:

Tangling

Coupling

Context

StrategiesClient

2. 3.

4.

1.

Steffen [email protected]

Reasoning Web77 of 84

WeST

Building Blocks

- The TwoUse solutionUses an Ontology to describe Context and StrategiesClassifies dynamically the Context- Hybrid Diagram- Metamodel- Transformation Process

TaskController

so : SalesOrder

getRulesForCountry(): Taxprocess()

USTax GermanTaxCountry

name:String

TaxtaxAmount()

Customer

SalesOrderprocess(tax : Tax) Context

Strategies

Client

Steffen [email protected]

Reasoning Web78 of 84

WeST

Hybrid Diagram: Strategy Pattern + OWL

TaskController process()

(USSalesOrder)«owlClass»

USTax

«owlClass»Country

«owlClass»

Customer«owlClass»

TaxtaxAmount()

SalesOrder«owlClass»

process()getRulesForCountry()

«rdfSubClassOf»«rdfSubClassOf»

context SalesOrder::getRulesForCountry():OclTypebody:Select ?T where ?self directType ?T

USCustomer«owlRestriction»

«owlValue» {hasValue = USA} country : Country

«owlValue» {someValuesFrom=USCustomer} hasCustomer

GermanCustomer«owlRestriction»

«owlValue» {hasValue = GERMANY} hasCountry : Country«owlValue» {someValuesFrom=GermanCustomer} hasCustomer

«owlRestriction»

«equivalentClass»

«owlRestriction»

«equivalentClass»

UML

OWL

TwoUse

Dynamic Classification

GermanTax(GermanSalesOrder)

Reuse

Flexibility

No Coupling

No Tangling

Steffen [email protected]

Reasoning Web79 of 84

WeST

TwoUse Metamodels Organization

UML

SPARQL

TwoUse

MOFM3

M2

OWL

InstanceOf

Steffen [email protected]

Reasoning Web80 of 84

WeST

Transformation Process

PIM PSM Source Code

Java

UMLProfiled 4TwoUse

Con

cret

e S

ynta

xA

bstra

ct S

ynta

x M2

M1

UMLProfiled4Java

TwoUseJava Java

InstanceOf

Java MetamodelTwoUse

Metamodel

Metamodel Grammar Ontology

RDF XMLSyntax

OWL

OWLUML

Profiled4 OWL

OWL

PSM

1.

2.

2.

3.

OWL Metamodel

UML

UMLMetamodel

ReasonerAPI

Steffen [email protected]

Reasoning Web81 of 84

WeST

Key Messages

The Ontology can be:reused independently of platform;modeled and evolved independently of the execution logic;tested automatically by logical unit tests.

Changes required for adoption are minor.

Steffen [email protected]

Reasoning Web82 of 84

WeST

ReferencesSoftware Language Engineering, 3rd Int. Conf, October 2010, EindhovenApplying model-driven engineering for the Semantic Web

S. Brockmans, R. Volz, A. Eberhart, and P. Löffler. Visual modeling of OWL DL ontologiesusing UML. In Proc. of ISWC 2004, pages 198–213, 2004.Gasevic, D., Djuric, D., Devedzic, V.: Model Driven Engineering and OntologyDevelopment, 2nd Ed. Springer (2009)F. S. Parreiras, G. Gröner, T. Walter, S. Staab. A model-driven approach for using templates in OWL ontologies. In: Proc. of the European Conference on Knowledge Acquisition and Management – EKAW-2010. Lisbon, Portugal, October 2008, LNCS, Springer.F. Silva Parreiras, C. Saathoff, T. Walter, T. Franz, S. Staab: APIs `a gogo: Automatic Generation of Ontology APIs. In: IEEE Int. Conference on Semantic Computing, IEEE Press, 2009.F. Silva Parreiras, S. Staab, S. Schenk, A. Winter. Model Driven Specification of Ontology Translations. ER 2008 – 27th International Conference on Conceptual Modeling, LNCS, Springer, 2008.

Applying RDF/OWL querying for software engineeringJonas Tappolet, Christoph Kiefer, Abraham Bernstein, Semantic web enabledsoftware analysis, Journal of Web Semantics: Science, Services and Agents on the World Wide Web 8, July 2010G. Gröner, S. Staab. Modeling and Query Patterns for Process Retrieval in OWL. In: Proc. of ISWC-2009 – International Semantic Web Conference, Westfield, USA, Oct 25-29, 2009.

Steffen [email protected]

Reasoning Web83 of 84

WeST

ReferencesApplying ontology reasoning for software engineering

G. Gröner, S. Staab. Specialization and Validation of Statecharts in OWL. In: Proc. of the European Conference on Knowledge Acquisition and Management – EKAW-2010. October 2008, LNCS, Springer.F. Silva Parreiras, S. Staab, A. Winter. Improving Design Patterns by Description Logics: An Use Case with Abstract Factory and Strategy. In: Proc. of Modellierung 2008. LNI, Gi e.V, März 2008.Wang, H., Li, Y., Sun, J., Zhang, H., Pan, J.: Verifying Feature Models using OWL. J of Web Semantics 5(2) (2007) 117-129Y. Ren, G. Gröner, J. Lemcke, T. Rahmani, A. Friesen, Y. Zhao, J. Z. Pan, S. Staab. Validating Process Refinement with Ontologies. In: The 22nd International Workshop on Description Logics (DL2009). 27 to 30 July 2009, Oxford, United Kingdom.

Steffen [email protected]

Reasoning Web84 of 84

WeST

References

Integrating software and ontology engineering practices: F. Silva Parreiras, S. Staab, A. Winter. On Marrying Ontological and Metamodeling Technical Spaces. In: ESEC/ACM FSE-2007 – Proceedings of the 6th joint meeting of the European software engineering conference and the 14th ACM SIGSOFT symposium on Foundations of software engineering, September 03 - 07, 2007, Dubrovnik, Croatia. ACM 2007, pp. 439 - 448F. S. Parreiras, S. Staab. Using Ontologies with UML Class-based Modeling: The TwoUseApproach. In: Data & Knowledge Engineering, Elsevier, to appear.

Integrating software and ontology engineering practices: Creating Domain-specific languages with OWLT. Walter, F. S. Parreiras, S. Staab, J. Ebert. Joint Language and Domain Engineering. In: B. Selic & T. Kühne (eds.). Proc. of ECMFA-2010 – 6th European Conference on ModellingFoundations and Applications (formerly ECMDA-FA), LNCS, Springer, Paris, France, June 15-18. T. Walter, F. Silva Parreiras, S. Staab. OntoDSL: An Ontology-based Development Environment for Domain-specific Languages. In: Proc. of Models-2009 - ACM/IEEE 12th Int. Conference on Model Driven Engineering Languages and Systems. Denver, Colorado, October 4-9, 2009.

Upcoming booksUwe Assmann, Jeff Pan, Steffen Staab, Yuting (eds.) Marrying ontology and softwaretechnologies, book, by Springer´, 2011F. Parreiras, TwoUse book, by Wiley, early 2011