Semantic Model-driven Engineering - userpages

3 downloads 25643 Views 2MB Size Report
... specification. ◇ From business developer to software developer .... Ship Order. Fill Order. Send Invoice. Make Payment. Invoice. [order rejected]. Language.
Web Science & Technologies University of Koblenz ▪ Landau, Germany

Semantic Model-driven Engineering

Steffen Staab with Gerd Gröner, Fernando Silva Parreiras, Tobias Walter

Who we are Prof. Dr. Staab

Semantic Web Web Retrieval Dr. Janik

Dr. Sizov

EU NeOn

DFG Multipla

BMBF CollabCloud HP Synth Docs EU Net2

WeST

Prof. Dr. Sure

Interactive Web Multimedia Web Software Web Dr. Scherp

Dr. Grzegorzek

F. Silva Parreiras

Prof. Sure

EU WeGov

EU WeKnowIt

EU X-Media

EU Most

EU WeGov

EU kspace

EU ASG

EU Tagora

Steffen Staab [email protected]

EU aceMedia

Reasoning Web 2 of 84

GESIS

Two Worlds of Models

MDA / MDE

Description Logics / Ontologies

Ingredients

Ingredients

ƒ Models: representing complementary views of a system Š Structural Š Behavioral ƒ Metamodeling: Linguistic instantiation of syntactic class descriptions ƒ Transformations: Towards target platform Adding refinements

ƒ Ontologies: representing complementary views of a system Š Structural Š (Behavioral) ƒ Metamodeling: Ontological instantiation of logical class descriptions ƒ Transformations: Between knowledge bases/ontologies

WeST

Steffen Staab [email protected]

Reasoning Web 3 of 84

Model-driven Engineering

Refinements in several dimensions ƒ Refinements along metamodeling levels

M3 Framework Developer

specifies

Metamodeling Language

uses

M2 DSL Designer

specifies

DSL Metamodel

uses

M1 WeST

DSL User Steffen Staab [email protected]

builds Reasoning Web 4 of 84

Domain Model

Model-driven Engineering

Refinements in several dimensions ƒ Refinements along metamodeling levels ƒ Refinements along model specification Š From business developer to software developer

WeST

Steffen Staab [email protected]

Reasoning Web 5 of 84

Model-driven Engineering

Refinements in several dimensions ƒ Refinements along model specification Š From business developer to software developer ƒ Refinements along metamodeling levels ƒ Refinements along platform specification Š For Ontology Translations

UML

UML

JAVA

PIM

PSM

Code Classical MDA

WeST

Steffen Staab [email protected]

Reasoning Web 6 of 84

Model-driven Engineering

Refinements in several dimensions ƒ Refinements along metamodeling levels ƒ Refinements along model specification Š From business developer to software developer ƒ Refinements along platform specification Š For Ontology Translations ƒ Refinements along time Š Metamodel evolution • Suggesting changes to transformations by DL reasoning

Š Ontology API Co-evolution

WeST

Steffen Staab [email protected]

Reasoning Web 7 of 84

Agenda ƒ Description Logics Reasoning by Example ƒ Model-driven engineering with OWL ƒ Refinements in several dimensions Š Refinements along metamodeling levels [Models 2009, ECMFA 2010] Š Refinements along model specification [DL 2009, EKAW 2010] • From business developer to software developer Š Refinements along platform specification [ER 2008] • For Ontology Translations Š Refinements along time • Metamodel evolution [ISWC2010] – Suggesting changes to transformations by DL reasoning

• Ontology API Generation/Co-evolution [ICSC 2009] WeST

Steffen Staab [email protected]

Reasoning Web 8 of 84

Description Logics

ƒ Description Logics (DLs) are logics designed to represent and reason on structured knowledge ƒ The domain of interest is structured into (TBox): Š concepts, which correspond to classes, and denote sets of individuals Š roles, which correspond to associations, and denote binary relations on individuals ƒ The knowledge is asserted through so-called assertions (ABox) ƒ They provide formal semantics ƒ DLs provide the foundations for standard ontology languages, like OWL2 ƒ BUT: Why should a software engineer care? WeST

Steffen Staab [email protected]

Reasoning Web 9 of 84

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 View Š Reasoning Tasks are not well automated

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

Steffen Staab [email protected]

Reasoning Web 10 of 84

Example: Satisfiability Checking in the MDE Process

ƒ Reasoning on UML class diagrams [Calvanese et al, AIJ 2005]

OWL Translation

UML

UML

JAVA

PIM

PSM

Code Classical MDA

WeST

Steffen Staab [email protected]

Reasoning Web 11 of 84

Example: Satisfiability Checking UserAccount

0..n

1

Owns Unsatisfiable Uses WebPortalAccount 0..1

{complete, disjoint}

Researcher 1..n W

WeST

User

Steffen Staab [email protected]

if Researcher is empty, User and Student will be redundant

eb

Po Eve m os is u rta ry t o se lA ne d cc R e b y ou se at nt ar ch er Reasoning Web 12 of 84

Researcher is disjoint from Student

Student

Example: Satisfiability Checking UserAccount

0..n

Owns Unsatisfiable Uses WebPortalAccount 0..1

1

User

{complete, disjoint}

Researcher 1..n

Student

Advantage for software engineering: Models with provably higher quality WeST

Steffen Staab [email protected]

Reasoning Web 13 of 84

Ontology Driven Software Development (ODSD)

¾ ¾ ¾

¾ ¾

WeST

Using ontologies to formalize models Modeling relationships between artifacts Inferring relationships between artifacts, e.g. traceability relationships Ensuring semantic correctness by constraint validation Guiding the development by reasoning (reasoning in process/model development)

Steffen Staab [email protected]

Reasoning Web 14 of 84

Agenda ƒ Description Logics Reasoning by Example ƒ Model-driven engineering (with OWL) ƒ Refinements in several dimensions Š Refinements along metamodeling levels [Models 2009, ECMFA 2010] Š Refinements along model specification [DL 2009, EKAW 2010] • From business developer to software developer Š Refinements along platform specification [ER 2008] • For Ontology Translations Š Refinements along time • Metamodel evolution [ISWC2010] – Suggesting changes to transformations by DL reasoning

• Ontology API Generation/Co-evolution [ICSC 2009] WeST

Steffen Staab [email protected]

Reasoning Web 15 of 84

A note on Software Languages as a field of research

Grammarware

Modelware OCL

Java

UML

Ruby Scala

C Lisp

C#

MOF

Haskell

Fortran

Software Language Engineering

Ecore ER diagrams

Petrinets

RIF

F-Logic

OWL-DL

OntoWare WeST

Steffen Staab [email protected]

Reasoning Web 16 of 84

BPMN

BPEL

Objectives

ƒ Context Š Software Languages Š Ontology Languages ƒ Language Bridges Š Transforming Software Languages to OWL Š Integrating Software Languages with OWL ƒ Services Š Reasoning Services Š Querying Services

WeST

Steffen Staab [email protected]

Reasoning Web 17 of 84

MDE/MDA is based on Metamodeling

ƒ Model hierarchy Ecore Metametamodel instanceOf

Ecore‐based Metamodel Language Designer

instanceOf

instanceOf

Model

Model

Language User representationOf

representationOf

Real World Systems WeST

Steffen Staab [email protected]

Reasoning Web 18 of 84

Ecore vs. UML

ƒ MOF simplifies UML Class Diagrams Š No n-ary associations Š No association classes Š Used for metamodeling ƒ Ecore: two aspects Š implements MOF as part of Eclipse Š Specification language like MOF (minus some bugs)

WeST

Steffen Staab [email protected]

Reasoning Web 19 of 84

Example for 4-layered architecture

Example: Process modeling Ecore Metametamodel

conformsTo Ecore‐based Metamodel

Language Designer

conformsTo

Model

Language User

WeST

Steffen Staab [email protected]

Reasoning Web 20 of 84

Example: Process Model

ƒ Model (Activity Diagram) Š designed by language user

Language User

[order rejected] Ship Order Receive Order

[order accepted]

Fill Order

Send Invoice

Close Order

Make Payment

Accept Payment

Invoice

WeST

Steffen Staab [email protected]

Reasoning Web 21 of 84

Example: Metamodel for Process Models

ƒ M2 metamodel (Activity Diagram) Language Š conforms to Ecore M3 metametamodel Designer Š visualized using concrete syntax of UML class diagrams

WeST

Steffen Staab [email protected]

Reasoning Web 22 of 84

Example: Metamodel for Process Models (2)

ƒ Ecore-based metamodel (Activity Diagram) Š conforms to Ecore M3 metametamodel Š visualized 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 { } WeST Steffen Staab Reasoning Web class ControlFlow [email protected] extends ActivityEdge23{of 84 }

}

Language Designer

Example: Metametamodel for Process Models

ƒ Ecore M3 metametamodel

WeST

Steffen Staab [email protected]

Reasoning Web 24 of 84

Exercise

ƒ Take 10 minutes ƒ Write down a metamodel for Java method declarations (or for your other favorite language) ƒ Suggestion: write down 3 example method declarations first

WeST

Steffen Staab [email protected]

Reasoning Web 25 of 84

Exercise 2

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

WeST

Steffen Staab [email protected]

Reasoning Web 26 of 84

General Scheme for Metametamodel based Transformations

WeST

Steffen Staab [email protected]

Reasoning Web 27 of 84

So far

ƒ Metamodels as abstract grammar for our models ƒ Abstract grammar defines what is related to what Š Undefined: word order Š Undefined: semantics Š Undefined: visual syntax (e.g. textual or diagrammatic syntax) ƒ Now: ontologies are models, too!

WeST

Steffen Staab [email protected]

Reasoning Web 28 of 84

Ontologies as Target Software Models

ƒ OWL2 Metamodel (excerpt)

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

Steffen Staab [email protected]

Reasoning Web 29 of 84

Ontologies as Target Software Models

Linguistic 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/

WeST

Steffen Staab [email protected]

Reasoning Web 30 of 84

Ontologies as Target Software Models

OWL2 Manchester Style Syntax (frame-based) requires a different metamodel Class: ActivityEdge SubClassOf: owl:Thing Class: ActivityNode SubClassOf: owl:Thing ObjectProperty: to Domain: ActivityEdge Range: ActivityNode ObjectProperty: outgoing Domain: ActivityNode Range: ActivityEdge ObjectProperty: from Domain: ActivityEdge Range: ActivityNode

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

ObjectProperty: incoming Domain: ActivityNode Range: ActivityEdge Individual: action1 Steffen Staab WeST Types: Action [email protected]

Reasoning Web 31 of 84

Translating ontology syntaxes OWL2 Functional Syntax metamodel

define mapping

SubClassOf(ActivityEdge owl:Thing)

OWL2 Manchester Syntax metamodel

Class: ActivityEdge SubClassOf: owl:Thing

SubClassOf(ActivityNode owl:Thing) Class: ActivityNode SubClassOf: owl:Thing

ObjectPropertyDomain(to ActivityEdge) ObjectPropertyRange(to ActivityNode) ObjectPropertyDomain(outgoing ActivityNode) ObjectPropertyRange(outgoing ActivityEdge)

derive translation

ObjectPropertyDomain(from ActivityEdge) ObjectPropertyRange(from ActivityNode) ObjectPropertyDomain(incoming ActivityNode) ObjectPropertyRange(incoming ActivityEdge)

ObjectProperty: to Domain: ActivityEdge Range: ActivityNode ObjectProperty: outgoing Domain: ActivityNode Range: ActivityEdge ObjectProperty: from Domain: ActivityEdge Range: ActivityNode ObjectProperty: incoming Domain: ActivityNode Range: ActivityEdge

ClassAssertion(action1 Action) WeST

Steffen Staab [email protected]

Individual: action1

Reasoning Web Types: Action 32 of 84

Comparing Ecore with OWL ƒ Many similar constructs Ecore

OWL

package

ontology

class

class

instance and literals

individual and literals

reference, attribute

object, data property

data types

data types

enumeration

enumeration

multiplicity

cardinality

Opposite reference

Inverse object properties

ƒ Reasoners use logic-based language ƒ Representation of software models in a logic-based language ƒ We need bridges! WeST

Steffen Staab [email protected]

Reasoning Web 33 of 84

Software Language Bridges

ƒ 2 kinds of Language Bridges Š M3 Transformation bridge Š M3 Integration bridge WeST

Steffen Staab [email protected]

Reasoning Web 34 of 84

ny) a m (of e res n u o t t c i s Ju sible p pos

M3 Transformation Bridge

ƒ Transformation of Ecore Technical Space with Ontology Language OWL2 Š Transformation of Ecore-based Metamodels Š Transformation of conforming Models Transformation Definition

Transformation Use WeST

Steffen Staab [email protected]

Reasoning Web 35 of 84

M3 Transformation Bridge

ƒ OWLizer Š Transforming Software Metamodels to Ontology TBox Š Transforming Software Models to Ontology ABox

OWLizing

Language Designer

Language User WeST

Steffen Staab [email protected]

Reasoning Web 36 of 84

ny) a m (of e res n u o t t c i s Ju le p b i s pos

Example: Ecore to OWL - OWLizer

Language Designer

Language User

• Definition of Transformation Bridge • Model transformation rules according to mappings of constructs similar in Ecore and OWL2 WeST

Steffen Staab [email protected]

Reasoning Web 37 of 84

Example: Ecore to OWL - OWLizer

SubClassOf(ActivityEdge owl:Thing) SubClassOf(ActivityNode owl:Thing) use of transformation bridge

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

...

Language Designer

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

Language User use of transformation bridge

ClassAssertion(e1 ObjectFlow) ClassAssertion(e2 ObjectFlow) ObjectPropertyAssertion(to e1 B) ObjectPropertyAssertion(from e1 A)

...

WeST

Steffen Staab [email protected]

Reasoning Web 38 of 84

Video

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

WeST

Steffen Staab [email protected]

Reasoning Web 39 of 84

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 expected ƒ Reasoning on the output/input structures may be helpful ƒ The 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

WeST

Steffen Staab [email protected]

Reasoning Web 40 of 84

How it works: Extending Software Metamodels

ƒ Integration of Ecore Technical Space with Ontology Language OWL2 Integration of abstract Syntax • OWL2 metamodel + Ecore Metametamodel Create Ecore-based metamodels with integrated Integration of concrete Syntax • OWL2 axioms • OWL2 concrete syntaxexpressions + Ecore concrete Syntax • OWL2

WeST

Steffen Staab [email protected]

Reasoning Web 41 of 84

How it works: Integration of abstract Syntax ƒ Metamodel Integration by using Integration Operations Š Merge of concepts

Š Relation of concepts by • Specialization Relationship

• Association

WeST

Steffen Staab [email protected]

Reasoning Web 42 of 84

How it works: Ecore Metametamodel + OWL2 Metamodel

ƒ Integration of abstract Syntax Š Result: Integrated Metametamodel

WeST

Steffen Staab [email protected]

Reasoning Web 43 of 84

How it works: Ecore concrete syntax

ƒ Textual Concrete Syntax for Coding Metamodels • Simple Syntax, similar to Java ƒ Grammar (concrete Syntax): class ::= ["abstract"] "class" name [supertypes] "{" features "}"; ... feature ::= attribute | reference; ... attribute ::= "attribute" name multiplicity ":" typeref ";"; ... reference ::= "reference" name multiplicity [iscontainer] ":“ typeref ["oppositeOf" name] ";"; ...

WeST

Steffen Staab [email protected]

Reasoning Web 44 of 84

How it works: Example of Ecore Textual Concrete Syntax

ƒ (textual) Activity Diagram Metamodel 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 { } WeST

Steffen Staab [email protected]

Reasoning Web 45 of 84

}

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}; WeST

Steffen Staab [email protected]

Reasoning Web 46 of 84

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)) { }

WeST

Steffen Staab [email protected]

Reasoning Web 47 of 84

Transforming software model to OWL

Why? Its the reasoning, stupid!

WeST

Steffen Staab [email protected]

Reasoning Web 48 of 84

Video

ƒ extending ecore models with owl annotations.mp4

WeST

Steffen Staab [email protected]

Reasoning Web 49 of 84

Reasoning Services

WeST

Steffen Staab [email protected]

Reasoning Web 50 of 84

Consistency Checking Name

Consistency Checking

Signature

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, then return true. Otherwise return false.

Pattern

b = consistency (O)

Input

An Ontology O

Output

b = true iff O is consistent, b = false otherwise

WeST

Steffen Staab [email protected]

Reasoning Web 51 of 84

Consistency Checking in Software Modeling

ƒ Accomplished Service Š Ensures 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

WeST

Steffen Staab [email protected]

Reasoning Web 52 of 84

Consistency Checking (be aware of OWA!) M2 Metamodel 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); }

M1 Model

Inconsistency: Disallowed Edge to Initial Action Receive Order

WeST

Steffen Staab [email protected]

Reasoning Web 53 of 84

Satisfiability Checking Name

Satisfiability checking

Signature

Set 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 there is not any unsatisfiable concept. Pattern

b = GetUnsatisfiable (O)

Input

An Ontology O

Output

b = NULL iff there is no unsatisfiable concept b = a set of unsatisfiable concepts otherwise

WeST

Steffen Staab [email protected]

Reasoning Web 54 of 84

Satisfiability Checking in Software Modeling

ƒ Accomplished Service Š Finds unsatisfiable classes in a metamodel ƒ Benefits for Language Designers Š Higher quality metamodels, where all classes can be instantiated ƒ Benefits for Language Users Š Less inconsistencies in models (because instances of unsatisfiable classes lead to inconsistencies)

WeST

Steffen Staab [email protected]

Reasoning Web 55 of 84

Satisfiability Checking (Example) M2 Metamodel 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) { }

Unsatisfiable Class: two contradictory restrictions

WeST

Steffen Staab [email protected]

Reasoning Web 56 of 84

Classification Name

Classification

Signature

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 i

Output

b = true iff i is an instance of A, b = false otherwise

WeST

Steffen Staab [email protected]

Reasoning Web 57 of 84

Classification in Software Modeling

ƒ Accomplished Service Š Determines the most specific type an Model Element belongs to Š With respect to all Attributes and Properties in the Context of the Model Element ƒ Requirements for Language Designers Š Define Axioms Š Possibility to define Constraints and Restrictions ƒ Benefits for Language Users Š Automatically Refinement of Model Elements Š Suggestions of suitable domain concepts to be used WeST

Steffen Staab [email protected]

Reasoning Web 58 of 84

Classification (Example) M2 Metamodel class ObjectNode extends ActivityNode equivalentWith ((restrictionOn incoming with some ObjectFlow) and (restrictionOn outgoing with some ObjectFlow)) {

}

M1 Model Send Invoice

Invoice

Make Payment

Classify Invoice Node Result: It is of type ObjectNode WeST

Steffen Staab [email protected]

Reasoning Web 59 of 84

Subsumption Checking Name

Subsumption Checking

Signature

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 of the interpretation of B, then return true. Otherwise returns false.

Pattern

b = subsumes (O,A,B)

Input

An Ontology O and concepts A, B

Output

b = true iff the interpretation of A is a subset of the interpretation of B in the ontology O, b = false otherwise

WeST

Steffen Staab [email protected]

Reasoning Web 60 of 84

Subsumption Checking in Software Modeling

ƒ Accomplished Service Š Computes a Subsumption Hierarchy of all Classes Š based on all Class Expressions and Axioms in the Ontology ƒ Requirements for Language Designers Š Define Axioms Š Possibility to define Expressions and Restrictions

WeST

Steffen Staab [email protected]

Reasoning Web 61 of 84

Explanation

Name

Explanation

Signature

Set 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 Ax

Output

b = set of axioms that entail the given axiom Ax. b = NULL otherwise

WeST

Steffen Staab [email protected]

Reasoning Web 62 of 84

Explanation for Software Modeling

ƒ Accomplished Service Š Explanations for subsumptions and unsatisfiable classes in metamodels Š Explanations for inconsistencies in models ƒ Benefits for Language Designers Š Debugging of metamodels ƒ Benefits for Language Users Š Debugging of models

WeST

Steffen Staab [email protected]

Reasoning Web 63 of 84

Explanation (Example Unsatisfiability) M2 Metamodel 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) { }

Explanation from TwoUse Toolkit --------------------------------------Unsatisfiability of Final: Explanation: Final equivalentTo not edge some ActivityNode and edge some ActivityNode

WeST

Steffen Staab [email protected]

Reasoning Web 64 of 84

Querying Name

Query answering

Signature

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 q

Output

res = a set of answers of the query to the ontology iff there is a answer set res = NULL if there is not any answer

WeST

Steffen Staab [email protected]

Reasoning Web 65 of 84

Querying Service for Software Modeling

ƒ Accomplished Service Š Query for model elements and metamodel element Š Use of OWL2 entailment regime ƒ Benefits for Language Designers Š Retrieving information on concepts ƒ Benefits for Language Users Š Retrieving existing and complex parts of models Š E.g. [Tappolet-2010].

WeST

Steffen Staab [email protected]

Reasoning Web 66 of 84

Querying (Example)

ƒ Find all actions, that are executed before „Ship Order“: Query ( ClassAssertion(?i Action), ObjectPropertyAssertion(InverseInverseObjectProperties(edge) ?i shiporder)) Results: ----------------| c | ================= | fillorder | | receiveorder | ----------------M1 Model

[order rejected] Ship Order

Receive Order

[order accepted]

Fill Order

Send Invoice

Close Order

Make Payment

Accept Payment

Invoice

WeST

Steffen Staab [email protected]

Reasoning Web 67 of 84

Querying (Example)

ƒ Find all unsatisfiable classes: Query ( SubClassOf(?c owl:Nothing) ) Results: -----------| c | ============ | Nothing | | Final | ------------

ƒ Find all concepts that do not go via edge to Final: Query ( EquivalentClasses(?c Not(ObjectSomeValuesFrom(edge Final))))

WeST

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

Steffen Staab [email protected]

Reasoning Web 68 of 84

Special notes: Open vs. Closed World

Mapping to: ƒ Abox: Incomplete vs. Complete models ƒ Tbox: no problem

Tools support: ƒ Open World yes ƒ Closed Domain yes ƒ Closed World not really

WeST

Steffen Staab [email protected]

Reasoning Web 69 of 84

Conclusion for this part

ƒ Ontologies are software models ƒ Metamodeling facilitates life: Š Use of established modeling tools Š definition of translations ƒ Reasoning not restricted to UML Class Diagrams

OWL Translation

Classical MDA

Model

Model

Software

PIM

PSM

Code

WeST

Steffen Staab [email protected]

Reasoning Web 70 of 84

Discussion…

… Questions?

WeST

Steffen Staab [email protected]

Reasoning Web 71 of 84

Semantic Model-driven Engineering Improving Design Patterns by Description Logics: An integration bridge Steffen Staab with Gerd Gröner, Fernando Silva Parreiras, Tobias Walter

WeST

Steffen Staab [email protected]

Reasoning Web 72 of 84

Agenda ƒ Description Logics Reasoning by Example ƒ Model-driven engineering with OWL ƒ Refinements in several dimensions Š Refinements along metamodeling levels [Models 2009, ECMFA 2010] Š Refinements along model specification [DL 2009, EKAW 2010] • From business developer to software developer Š Refinements along platform specification [ER 2008, DKE2010] • For Ontology Translations Š Refinements along time • Metamodel evolution [ISWC2010] – Suggesting changes to transformations by DL reasoning

• Ontology API Generation/Co-evolution WeST

Steffen Staab [email protected]

Reasoning Web 73 of 84

[ICSC 2009]

This part of the tutorial is about

the variant management subset of

Variant Management

software design patterns.

Algorithm Encapsulation Factorization of common functionality Choice of implementations

Software Design Patterns WeST

Inference

Description Logics (OWL) Classification

Weaving features of Description Logics into the Strategy Pattern under

Steffen Staab [email protected]

Reasoning Web 74 of 84

Sel ec tor Pa tter n

Running Example

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

WeST

Steffen Staab [email protected]

Reasoning Web 75 of 84

Strategy Pattern

Drawbacks: context TaskController::getRulesForCountry():Tax body: if so.customer.country.name = 'USA' then USTax.new() else if so.customer.country.name = 'GERMANY' then GermanTax.new() endif endif

Tangling TaskController so : SalesOrder

2. getRulesForCountry() : Tax 1. process()

SalesOrder 3. process(tax : Tax)

Customer

Client

WeST

Tax taxAmount()

4.

Coupling

How to improve it?

Context

Country name : String

Steffen Staab [email protected]

USTax

GermanTax

Reasoning Web 76 of 84

Strategies

Building Blocks - The TwoUse solution Uses an Ontology to describe Context and Strategies Classifies dynamically the Context - Hybrid Diagram - Metamodel - Transformation Process TaskController SalesOrder process(tax : Tax)

so : SalesOrder getRulesForCountry(): Tax process()

Customer

Context

Tax taxAmount()

Client USTax Country name:String

WeST

Steffen Staab [email protected]

Reasoning Web 77 of 84

GermanTax

Strategies

Hybrid Diagram: Strategy Pattern + OWL No Coupling No Tangling

UML

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

TaskController process()

OWL TwoUse

«owlClass» SalesOrder process() getRulesForCountry()

Tax taxAmount()

«owlClass» Customer «rdfSubClassOf» «rdfSubClassOf» «owlClass» «owlClass» «owlClass» (USSalesOrder) (GermanSalesOrder) Country USTax GermanTax «equivalentClass»

«equivalentClass»

«owlRestriction»

«owlRestriction»

Dynamic Classification

«owlValue» {someValuesFrom=USCustomer} hasCustomer «owlRestriction» USCustomer «owlValue» {hasValue = USA} country : Country

Reuse

Flexibility

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

Steffen Staab [email protected]

Reasoning Web 78 of 84

TwoUse Metamodels Organization MOF

M3

InstanceOf

OWL

UML M2

TwoUse SPARQL

WeST

Steffen Staab [email protected]

Reasoning Web 79 of 84

Transformation Process

Abstract Syntax

UML Metamodel

M2

TwoUse Metamodel

Metamodel

Grammar

Ontology

Java Metamodel

OWL Metamodel InstanceOf

UML

M1

TwoUse

2. OWL

OWL 2.

Java

3.

Java

Concrete Syntax

1.

WeST

UML Profiled 4TwoUse PIM

UML Profiled 4 OWL

UML Profiled 4Java

PSM

PSM

Steffen Staab [email protected]

Reasoning Web 80 of 84

Reasoner API

Java Source Code

OWL RDF XML Syntax

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.

WeST

Steffen Staab [email protected]

Reasoning Web 81 of 84

References Software Language Engineering, 3rd Int. Conf, October 2010, Eindhoven Applying model-driven engineering for the Semantic Web ƒ ƒ ƒ

ƒ

ƒ

S. Brockmans, R. Volz, A. Eberhart, and P. Löffler. Visual modeling of OWL DL ontologies using UML. In Proc. of ISWC 2004, pages 198–213, 2004. Gasevic, D., Djuric, D., Devedzic, V.: Model Driven Engineering and Ontology Development, 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 engineering ƒ Jonas Tappolet, Christoph Kiefer, Abraham Bernstein, Semantic web enabled software analysis, Journal of Web Semantics: Science, Services and Agents on the World Wide Web 8, July 2010 ƒ G. Gröner, S. Staab. Modeling and Query Patterns for Process Retrieval in OWL. In: Proc. of ISWC-2009 – International Semantic Web Conference, Westfield, 2009. WeSTUSA, Oct 25-29, Steffen Staab Reasoning Web [email protected]

82 of 84

References Applying 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-129

Y. 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.

WeST

Steffen Staab [email protected]

Reasoning Web 83 of 84

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 - 448 F. S. Parreiras, S. Staab. Using Ontologies with UML Class-based Modeling: The TwoUse Approach. In: Data & Knowledge Engineering, Elsevier, to appear.

Integrating software and ontology engineering practices: Creating Domain-specific languages with OWL ƒ ƒ

T. 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 Modelling Foundations 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 books ƒ ƒ

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

WeST

Steffen Staab [email protected]

Reasoning Web 84 of 84