Upload
izso
View
453
Download
0
Tags:
Embed Size (px)
Citation preview
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ó
Overview Motivation Ontology based language engineering process Ontology to DSL mapping Results and future work
Motivation
DSM Editor
«instance of»
Textual Requirements
• Every Switch is supervisedBy at least two Sensors.
• early prototyping • satisfy requirements • (re)validation
?
Motivation
Prototype DSM Editor
«instance of»
Auto-derive
Automatically build a DSM editor to design
instance models satisfying all requirements
satisfy
Formalized Requirements
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
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?
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
Overview of the approach
Ontology DSL spec. Mapping
OWL2
SWRL
Ecore
IQPL
Mapping OWL2 to Ecore (example)
Ontology DSL spec. Mapping
OWL2
SWRL
Ecore
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
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
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
Mapping OWL2 to IQPL (example)
Ontology DSL spec. Mapping
OWL2
SWRL
Ecore
IQPL
Mapping OWL2 to IQPL (example)
Every Switch is supervisedBy at least two Sensors.
Ontology DSL spec. Mapping
OWL2
SWRL
Ecore
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
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
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
Mapping SWRL to IQPL (example)
OWL2
SWRL
Ecore
IQPL
Ontology DSL spec. Mapping
Mapping SWRL to IQPL (example)
Two track elements with same signal must be connected.
OWL2
SWRL
Ecore
IQPL
Ontology DSL spec. Mapping
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
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
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
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
Language Differences (OWA → CWA)
sw:Switch s2:Sensor supervisedBy
Every Switch is supervisedBy at least two Sensors.
Ontology DSL spec.
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
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
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
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)
Results
Ontology (formal)
DSM Editor (prototype)
Requirements (textual)
Automatic transformation Consistent formalization
Efficiently check consistent requirements of
large, continuously evolving models
«instance of»
Results
Ontology (formal)
DSM Editor (prototype)
Requirements (textual)
Automatic transformation Consistent formalization
Efficiently check consistent requirements of
large, continuously evolving models
«instance of»
Future work
Ontology (OWL2+SWRL)
DSL spec. (Ecore+IQPL)
«instance of»
Requirements (textual)
Future work
Ontology (OWL2+SWRL)
DSL spec. (Ecore+IQPL)
«instance of»
Ontology instance
«instance of»
Instance model mapping
Requirements (textual)
Future work
Ontology (OWL2+SWRL)
DSL spec. (Ecore+IQPL)
«instance of»
Ontology instance
«instance of»
Instance model mapping
Reverse mapping (expressivity!)
Requirements (textual)
Future work
Ontology (OWL2+SWRL)
DSL spec. (Ecore+IQPL)
«instance of»
Ontology instance
«instance of»
Instance model mapping
Reverse mapping (expressivity!)
Requirements (textual) OCL
Summary
Ontology DSM Editor Requirements
Automatic transformation Mapping
Consistent formalization
Efficiently check large models on-the-fly
«instance of»