OWL2+SWRL to EMF+IQPL

35
Budapest University of Technology and Economics Fault Tolerant Systems Research Group MODELS Conference – OCL Workshop 2012 Innsbruck, Austria, 2012. 09. 30. Ontology Driven Design of EMF Metamodels and Well-formedness Constraints Benedek Izsó, Zoltán Szatmári, Gábor Bergmann, Ákos Horváth, István Ráth, and Dániel Varró

Transcript of OWL2+SWRL to EMF+IQPL

Page 1: OWL2+SWRL to EMF+IQPL

Budapest University of Technology and Economics Fault Tolerant Systems Research Group

MODELS Conference – OCL Workshop 2012 Innsbruck, Austria, 2012. 09. 30.

Ontology Driven Design of EMF Metamodels and Well-formedness

Constraints

Benedek Izsó, Zoltán Szatmári, Gábor Bergmann, Ákos Horváth, István Ráth, and

Dániel Varró

Page 2: OWL2+SWRL to EMF+IQPL

Overview Motivation Ontology based language engineering process Ontology to DSL mapping Results and future work

Page 3: OWL2+SWRL to EMF+IQPL

Motivation

DSM Editor

«instance of»

Textual Requirements

• Every Switch is supervisedBy at least two Sensors.

• early prototyping • satisfy requirements • (re)validation

?

Page 4: OWL2+SWRL to EMF+IQPL

Motivation

Prototype DSM Editor

«instance of»

Auto-derive

Automatically build a DSM editor to design

instance models satisfying all requirements

satisfy

Formalized Requirements

Page 5: OWL2+SWRL to EMF+IQPL

Modeling techniques

Requirements

• Textual • Can be ambiguous,

inconsistent • Expectations of

stakeholders

Ontology

• Mathematically precise semantics

• Efficient meta level consistency checking

• Easy schema merg-ing and refactoring

DSL spec.

• Great tool support • Wide industry usage • Efficient instance

model validation

Page 6: OWL2+SWRL to EMF+IQPL

Modeling techniques

Requirements

• Textual • Can be ambiguous,

inconsistent • Expectations of

stakeholders

Ontology

• Mathematically precise semantics

• Efficient meta level consistency checking

• Easy schema merg-ing and refactoring

DSL spec.

• Great tool support • Wide industry usage • Efficient instance

model validation

Consistent translation?

Page 7: OWL2+SWRL to EMF+IQPL

Modeling techniques

Requirements

• Textual • Can be ambiguous,

inconsistent • Expectations of

stakeholders

Ontology

• Mathematically precise semantics

• Efficient meta level consistency checking

• Easy schema merg-ing and refactoring

DSL spec.

• Great tool support • Wide industry usage • Efficient instance

model validation

Protégé Controlled English Tools Automatic transformation

Ontology-based modeling techniques

Page 8: OWL2+SWRL to EMF+IQPL

Overview of the approach

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 9: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to Ecore (example)

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 10: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to Ecore (example)

Every Switch is a TrackElement. Every TrackElement is supervisedBy a Sensor.

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 11: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to Ecore (example)

Switch ⊑ TrackElement

Switch ⊑ ∃ supervisedBy.Sensor

Every Switch is a TrackElement. Every TrackElement is supervisedBy a Sensor.

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

OWL2 (Web Ontology Language): • W3C Standard for describing semantic web • Axiomatic language: decidable description logic • Here used for metamodel constraint description

Page 12: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to Ecore (example)

Switch ⊑ TrackElement

Switch ⊑ ∃ supervisedBy.Sensor

Every Switch is a TrackElement. Every TrackElement is supervisedBy a Sensor.

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 13: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to IQPL (example)

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 14: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to IQPL (example)

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 15: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to IQPL (example)

Switch ⊑ ≥2 supervisedBy.Sensor

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 16: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to IQPL (example)

sw:Switch s2:Sensor

s1:Sensor supervisedBy

supervisedBy

NEG Switch ⊑ ≥2 supervisedBy.Sensor

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

IQPL (IncQuery Pattern Language): • Graph pattern based model query language • EMF-IncQuery evaluates incrementally

Page 17: OWL2+SWRL to EMF+IQPL

Mapping OWL2 to IQPL (example)

sw:Switch s2:Sensor

s1:Sensor supervisedBy

supervisedBy

NEG Switch ⊑ ≥2 supervisedBy.Sensor

Consequent is negated to match violating

elements

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec. Mapping

OWL2

SWRL

Ecore

IQPL

Page 18: OWL2+SWRL to EMF+IQPL

Mapping SWRL to IQPL (example)

OWL2

SWRL

Ecore

IQPL

Ontology DSL spec. Mapping

Page 19: OWL2+SWRL to EMF+IQPL

Mapping SWRL to IQPL (example)

Two track elements with same signal must be connected.

OWL2

SWRL

Ecore

IQPL

Ontology DSL spec. Mapping

Page 20: OWL2+SWRL to EMF+IQPL

Mapping SWRL to IQPL (example)

Two track elements with same signal must be connected.

TrackElement(?te1), TrackElement(?te2), Signal(?sig), hasSignal(?te1, ?sig), hasSignal(?te2, ?sig), DifferentFrom (?te1, ?te2) -> connectedTo(?te1, ?te2)

OWL2

SWRL

Ecore

IQPL

Ontology DSL spec. Mapping

SWRL (Semantic Web Rule Language): • Extension of OWL2 • Variables and property expressions can be used • DL-Safe rules maintain decidability

Page 21: OWL2+SWRL to EMF+IQPL

Mapping SWRL to IQPL (example)

Two track elements with same signal must be connected.

TrackElement(?te1), TrackElement(?te2), Signal(?sig), hasSignal(?te1, ?sig), hasSignal(?te2, ?sig), DifferentFrom (?te1, ?te2) -> connectedTo(?te1, ?te2) ?sig:Signal

?te2:TrackElement

?te1:TrackElement hasSignal

hasSignal

NEG connectedTo

OWL2

SWRL

Ecore

IQPL

Ontology DSL spec. Mapping

Page 22: OWL2+SWRL to EMF+IQPL

Mapping SWRL to IQPL (example)

Two track elements with same signal must be connected.

TrackElement(?te1), TrackElement(?te2), Signal(?sig), hasSignal(?te1, ?sig), hasSignal(?te2, ?sig), DifferentFrom (?te1, ?te2) -> connectedTo(?te1, ?te2)

pattern invalidWiring(te1, te2, sig) { TrackElement(te1); TrackElement(te2); Signal(sig); TrackElement.hasSignal(te1, sig); TrackElement.hasSignal(te2, sig); te1 != te2; neg find connected(te1, te2); } pattern connected(te1, te2) { TrackElement.connectedTo(te1, te2); }

OWL2

SWRL

Ecore

IQPL

Ontology DSL spec. Mapping

Page 23: OWL2+SWRL to EMF+IQPL

Language Differences OWL2+SWRL Ecore + IQPL Solution

Multityped instances Object has exactly one direct type

Multiple inheritance can be used

Relation inheritance allowed

No relation inheritance

Mapped to GP, relation instances must be inserted

Multiple syntax can have one semantics

Transformed to Ecore or GP depending on the syntax

Open world assumption

Closed world assumption

OWA → tolerates incomplete models CWA → complete knowledge assumed

Page 24: OWL2+SWRL to EMF+IQPL

Language Differences (OWA → CWA)

sw:Switch s2:Sensor supervisedBy

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec.

Page 25: OWL2+SWRL to EMF+IQPL

Language Differences (OWA → CWA)

Open World Assumption: Tolerates incomplete knowledge

sw:Switch s2:Sensor supervisedBy

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec.

✓ Valid

Page 26: OWL2+SWRL to EMF+IQPL

Language Differences (OWA → CWA)

Open World Assumption: Tolerates incomplete knowledge

sw:Switch s2:Sensor supervisedBy

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec.

Closed World Assumption: Complete knowledge assumed

✓ Valid ✘Invalid

Page 27: OWL2+SWRL to EMF+IQPL

Language Differences (OWA → CWA)

Open World Assumption: Tolerates incomplete knowledge

sw:Switch s2:Sensor supervisedBy

Every Switch is supervisedBy at least two Sensors.

Ontology DSL spec.

Closed World Assumption: Complete knowledge assumed

✓ Valid ✘Invalid

Mapped graph patterns return invalid elements following the close world assumption

Page 28: OWL2+SWRL to EMF+IQPL

Implementation

Ontology DSL spec. Transform

Large part of the language was mapped (~50 axioms and 45 expressions)

Transformation is implemented in the VIATRA2 framework with the required ontology importer, Ecore and IQPL exporter

Traceability between source and target model An Eclipse plug-in automates the process

o Converts ontology with 50 axiom in 30 sec. (code generation dominates)

Page 29: OWL2+SWRL to EMF+IQPL

Results

Ontology (formal)

DSM Editor (prototype)

Requirements (textual)

Automatic transformation Consistent formalization

Efficiently check consistent requirements of

large, continuously evolving models

«instance of»

Page 30: OWL2+SWRL to EMF+IQPL

Results

Ontology (formal)

DSM Editor (prototype)

Requirements (textual)

Automatic transformation Consistent formalization

Efficiently check consistent requirements of

large, continuously evolving models

«instance of»

Page 31: OWL2+SWRL to EMF+IQPL

Future work

Ontology (OWL2+SWRL)

DSL spec. (Ecore+IQPL)

«instance of»

Requirements (textual)

Page 32: OWL2+SWRL to EMF+IQPL

Future work

Ontology (OWL2+SWRL)

DSL spec. (Ecore+IQPL)

«instance of»

Ontology instance

«instance of»

Instance model mapping

Requirements (textual)

Page 33: OWL2+SWRL to EMF+IQPL

Future work

Ontology (OWL2+SWRL)

DSL spec. (Ecore+IQPL)

«instance of»

Ontology instance

«instance of»

Instance model mapping

Reverse mapping (expressivity!)

Requirements (textual)

Page 34: OWL2+SWRL to EMF+IQPL

Future work

Ontology (OWL2+SWRL)

DSL spec. (Ecore+IQPL)

«instance of»

Ontology instance

«instance of»

Instance model mapping

Reverse mapping (expressivity!)

Requirements (textual) OCL

Page 35: OWL2+SWRL to EMF+IQPL

Summary

Ontology DSM Editor Requirements

Automatic transformation Mapping

Consistent formalization

Efficiently check large models on-the-fly

«instance of»