Date post: | 10-Apr-2017 |
Category: |
Engineering |
Upload: | gianni-rosa |
View: | 106 times |
Download: | 1 times |
Dipartimento di Ingegneria e Scienze
Università degli Studi dell’Aquiladell’Informazione e Matematica
Generating model with uncertainty by means of JTL
Gianni Rosa
In Model-Driven Engineering (MDE) bidirectionality in
transformations has been always regarded as a key
mechanism, but has rarely produced anticipated benefits.
Why?
…probably the main reason is the ambivalence concerning non-
bijectivity.
Propagating changes from one side to the other is typically non univocal as more than one correct solution is admitted.
We discuss how dealing with multiple solutions is important and requires
specialized tools and support
Gianni Rosa – University of L’Aquila - ITALY
5Non-bijectivityMost examples of bidirectional transformations are non-bijective, therefore there may be multiple ways to transform two models into a consistent state, introducing uncertainty and non-determinism.
T-1
Δ Manual Changes
TMs Mt
Mt’
Ms1’
…?Msn’
Ms1’
Source model Target model
Hierarchical State Machine
Non-hierarchical state machine obtained by flattening the source model
T
Source model Target model
Δ Manual ChangesThe designer performs
some manual changes on the generated model
T
Source model Target model
Δ Manual ChangesThe designer performs
some manual changes on the generated model
TProblem
How to back propagate the manual changes on the target model towards the source
models according to the knowledge encoded in T?
What about non-bijectivity?
Gianni Rosa – University of L’Aquila - ITALY
9Specifying transformation with JTLFragment of the HSM2NHSM transformation specified in JTL
9
transformation hsm2nhsm(source : HSM, target : NHSM) { top relation StateMachine2StateMachine { enforce domain source sSM : HSM::StateMachine; enforce domain target tSM : NHSM::StateMachine; }
top relation State2State { enforce domain source sourceState : HSM::State; enforce domain target targetState : NHSM::State; when { sourceState.owningCompositeState.oclIsUndefined(); } }
top relation CompositeState2State { enforce domain source sourceState : HSM::CompositeState; enforce domain target targetState : NHSM::State; }}
Gianni Rosa – University of L’Aquila - ITALY
10
transformation hsm2nhsm(source : HSM, target : NHSM) { top relation StateMachine2StateMachine { enforce domain source sSM : HSM::StateMachine; enforce domain target tSM : NHSM::StateMachine; }
top relation State2State { enforce domain source sourceState : HSM::State; enforce domain target targetState : NHSM::State; when { sourceState.owningCompositeState.oclIsUndefined(); } }
top relation CompositeState2State { enforce domain source sourceState : HSM::CompositeState; enforce domain target targetState : NHSM::State; }}
Specifying transformation with JTLFragment of the HSM2NHSM transformation specified in JTL
10
c
It transforms hierarchical state machines into flat state machines
and the other way round.
Gianni Rosa – University of L’Aquila - ITALY
11
transformation hsm2nhsm(source : HSM, target : NHSM) { top relation StateMachine2StateMachine { enforce domain source sSM : HSM::StateMachine; enforce domain target tSM : NHSM::StateMachine; }
top relation State2State { enforce domain source sourceState : HSM::State; enforce domain target targetState : NHSM::State; when { sourceState.owningCompositeState.oclIsUndefined(); } }
top relation CompositeState2State { enforce domain source sourceState : HSM::CompositeState; enforce domain target targetState : NHSM::State; }}
Specifying transformation with JTLFragment of the HSM2NHSM transformation specified in JTL
11
c
The forward transformation is clearly non-injective:
both «State» and «CompositeState» are mapped
to the same target «State»
Gianni Rosa – University of L’Aquila - ITALY
12
transformation hsm2nhsm(source : HSM, target : NHSM) { top relation StateMachine2StateMachine { enforce domain source sSM : HSM::StateMachine; enforce domain target tSM : NHSM::StateMachine; }
top relation State2State { enforce domain source sourceState : HSM::State; enforce domain target targetState : NHSM::State; when { sourceState.owningCompositeState.oclIsUndefined(); } }
top relation CompositeState2State { enforce domain source sourceState : HSM::CompositeState; enforce domain target targetState : NHSM::State; }}
Specifying transformation with JTLFragment of the HSM2NHSM transformation specified in JTL
12
c
The forward transformation is clearly non-injective:
both «State» and «CompositeState» are mapped
to the same target «State»
Source model Target model
Δ Manual Changes
T
T
Modifications on the target are back propagated to the source which is consistently updated making use of tracing information
Gianni Rosa – University of L’Aquila - ITALY
14Combinatorial explosionNot surprisingly, there is not a unique way of updating the source model.Despite the changes on the target model are relatively simple, their impact on the source model istypically exponential.
Gianni Rosa – University of L’Aquila - ITALY
15Combinatorial explosion|print| × |completed| × |critical error| = 4 * 4 * 3 = 48where |name| is the number of alternative model elements called name.
Gianni Rosa – University of L’Aquila - ITALY
16Combinatorial explosion|print| × |completed| × |critical error| = 4 * 4 * 3 = 48where |name| is the number of alternative model elements called name.Solution? Representing multiple solutions with Model Uncertainty
Gianni Rosa – University of L’Aquila - ITALY
17UncertaintyUncertainty is a consequence of non-determinism.
Dealing with a multitude of models obtained by a non-deterministic transformation requires us to consider uncertainty as a first-class concern.
For any metamodel M an uncertainty metamodel U(M) can obtained by means of an automated transformation:
U: Ecore Ecore
Gianni Rosa – University of L’Aquila - ITALY
18Uncertainty metamodel
.HSM
M
etam
odel
U(H
SM)
Met
amod
el
Gianni Rosa – University of L’Aquila - ITALY
19Uncertainty metamodel
.HSM
M
etam
odel
U(H
SM)
Met
amod
el
the abstract metaclass TracedClass with attributes trace and ref is added
Gianni Rosa – University of L’Aquila - ITALY
20Uncertainty metamodel
.HSM
M
etam
odel
U(H
SM)
Met
amod
el
the abstract metaclass TracedClass with attributes trace and ref is added
StateMachine is generalized by TracedClass
Gianni Rosa – University of L’Aquila - ITALY
21Uncertainty metamodel
.HSM
M
etam
odel
U(H
SM)
Met
amod
el
the abstract metaclass TracedClass with attributes trace and ref is added
a direct sub-metaclass of StateMachine is added
StateMachine is generalized by TracedClass
Gianni Rosa – University of L’Aquila - ITALY
22Uncertainty metamodel
.HSM
M
etam
odel
U(H
SM)
Met
amod
el
the abstract metaclass TracedClass with attributes trace and ref is added
a direct sub-metaclass of StateMachine is added
StateMachine is generalized by TracedClass
The composition enable the representation of a point of uncertainty and its alternatives
the cardinality of attributes and references are relaxed
Gianni Rosa – University of L’Aquila - ITALY
23Extension of JTL SemanticThe JTL semantics has been extended in order to factorize the solution space and generate a model with uncertainty instead of a set of models.
Gianni Rosa – University of L’Aquila - ITALY
24Extension of JTL SemanticThe JTL semantics has been extended in order to factorize the solution space and generate a model with uncertainty instead of a set of models.
Gianni Rosa – University of L’Aquila - ITALY
25Extension of JTL SemanticThe JTL semantics has been extended in order to factorize the solution space and generate a model with uncertainty instead of a set of models.
Example
Gianni Rosa – University of L’Aquila - ITALY
27ConclusionThe JTL semantics has been refined in order to be able to generate directly the model with uncertainty semantically corresponding to the complete solution space.
We distinguish among two different behaviors: - extensional, generate all the models satisfying the relation defined in the bidirectional transformation; - intensional (or with uncertainty), generate a model with uncertainty wich is semantically equivalent to the models of the extensive case
The approach is implemented on Eclipse/EMF.
Thank you!