MDE: unification of model transformations

Download Report

Transcript MDE: unification of model transformations

Systemic approach towards
model definition
Model transformation
semantics
Irina Rychkova. 9/2006
1
Motivation

2 ways of model representation:



Our observation:






Action centric (UML activity diagrams, BPMN ..)
Data centric (UML class diagrams)
Data structure and behavior are loosely-coupled
Model of data structure is not related to the model of behavior
Model of behavior implicitly related with the model of data structure via
constraints
Semantic of model transformation is not clear
Example: Within one model of the workflow information about objects is
hidden inside the actions…
Systemic approach




System thinking puts emphasis to the integration of 2 aspects within one
model
Definition of behavior as a state change
Re-definition of property explicitly affects behavior
Re-definition of behavior explicitly affects property
Irina Rychkova. 9/2006
2
Solution

Part I

Relation semantics



Semantics of Model transformation



Refinement
Composition
Part II

Types vs. instances:


Instance information embedded to relations
AsmL operational semantics



Behavior-Property relations
Property-Property relations
Automated model translation to AsmL
Simulation
On-going:

Automated model verification using asmlt
Irina Rychkova. 9/2006
3
Cinema WebSite Example
Cinema X develops a web site to provide clients with new
services:
A Booking tickets service enables tickets reservation via
internet.
To book tickets a client has to log in on the web site. If logged
in, the client can add reservations for a movie of his/her
choice to a virtual cart.
The movie can be chosen from an agenda - the movie list.
The web site has to control a number of places (seats)
available for every movie.
Booking tickets finishes when the client commits and logs out.
Irina Rychkova. 9/2006
4
“Rectangular” vs. “Circular”
community
Agenda
nMovies: Integer
ClientAccountList
nClients: Integer
H
BookingTickets
agenda: Agenda
cList:ClientAccountList
nMovies = 10
nClients = 54
H
WebSite
BookingTickets
Irina Rychkova. 9/2006
Customer
5
Systemic approach 1/3
Integration of structural and behavioral aspects within a model
Agenda
Environment
nMovies: Integer
ClientAccountList
nClients: Integer
WebSite
LifeCycle
H
NMovies
{int}
BookingTickets
H
NClients
{int}
nMovies
nClients
WebSite
ClientAccountList
Agenda
PreS:
1|agenda
H
BookingTickets
BookingTickets
PreS:
1|cList
Customer
H
agenda: Agenda
Irina Rychkova. 9/2006nMovies = 10
cList:ClientAccountList
nClients = 54
6
Systemic approach 2/3
1.
2.
3.
4.
Environment and
Boundary
Context
Behavior-Property*
relations
Stateless and Statefull
properties
Environment
WebSite
LifeCycle
2
NMovies
{int}
NClients
{int}
nMovies
1
4
ClientAccountList
Agenda
PreS:
1|agenda
3
H
nClients
BookingTickets
PreS:
1|cList
H
*Here we use the term “property” to reason about information objects presented in the
system rather then a commonly used term “structure”. The latter can be used to define both
“data structure” and “structure of behavior” and need to be specified.
Irina Rychkova. 9/2006
7
Systemic approach 3/3

Boundary: A border between the system (a
“Hollon”) and its environment.

Environment (of an object): The part of the model
which is not the part of that object. [RM-ODP]

Context (modeling context): A scope of interests for
a given model. Model elements (properties,
behaviors, relations) can be specified as relevant or
irrelevant to a given context. LifeCycle context is a
global context for any system. Context can be
defined by the hollon and its behavior of interest.
Irina Rychkova. 9/2006
8
Property
Statefull property: a property who’s
instance state can be directly obtained
and interpreted as a value of one of
the standard operational types*.
Stateless property: a property who’s
instance state is not defined and can
be expressed only indirectly, via states
of related properties (attributes).
agenda: Agenda
nMovies = 10
PreS:
1|agenda
Agenda
State
nMovies
NMovies
{int}
State
value
10
* Standard operational type: here, Integer, String, Char, Long, Double,
Boolean.
Irina Rychkova. 9/2006
9
Part I:

Semantic definition for relations
Irina Rychkova. 9/2006
10
Relating Behavior to Data
Structure


UML: OCL constraints
SEAM:



Property-Property relations;
Behavior-Property relations;
Action-Action relations
Irina Rychkova. 9/2006
11
Property-Property relations

Exhibit relation: relation between a
stateless property (the owner) seen as
atomic and its attribute (in general also
can be a stateless property) that
characterizes the property at a given
abstraction level.
Agenda
nMovies
NMovies
{int}
Agenda


Composition relation
Association relation:
M_ID
{String}
1|id
1..10|mList[1]..mList[10]
Seat
{0..250}
Movie
Movie
1|seats
ReservationList
0..n|rList[1]..rList[n]
0..1| rList[1]
<cardinality>|<instance_name>
Movie
0..1| rList[2]
Irina Rychkova. 9/2006 0..1| rList[n]
ReservationList
12
Behavior- Property relations

Behavior-property relation: 1. A
model element that expresses a
semantic relation between action and
property; specifies behavior effect in
terms of state change 2. The way to
define a) a precondition, b) an
emergent property or c) a
postcondition for an action.
Irina Rychkova. 9/2006
13
Behavior- Property relations:
Precondition


System preconditions (PreS)
define predicates in terms of
system variables obtained
as a result of a previous
system activity.
Environment preconditions
(PreEnv) define predicates
in terms of parameters,
provided by the environment
via events.
Agenda
PreS:
1|agenda
H
BookingTickets
H
ClientID
{String}
PreEnv:
1|userID
H
H
BookingTickets
E1[userID:ClientID,
idList:ReservationBag]
Irina Rychkova. 9/2006
14
Behavior- Property relations:
Emergent property

A predicate that specifies
the action termination. (truefalse, ok-error, etc). Based
on the Emergent property,
action effect can be chosen.
In general case an
emergent property might
have more then 2 values.
ClientID
{String}
PreEnv:
0..1|userID
ValidID
{Boolean}
Emergent
1|validUser
exists cL in cList.cL
where cL.id.valueRef eq
userID.valueRef
LogIn
H
M0: LoggingIn
[userID: ClientID]
<cardinality>|<instance_name>
<expression>
Irina Rychkova. 9/2006
15
Behavior- Property relations:
Postcondition


System postcondition
(PostS) specifies the action
effect hidden from the
environment.
NReservations
{int}
ClientAccountList
1|nRes
0..*|cL[1]..cL[*]
ReservationList
ClientAccount
reservationList
1|this
PostEnv [true]
This = the cL | cL in cList.cL
where cL.id == userID;
This.reservationList.nRes:=
This.reservationList.nRes + idList.nID
id
Environment postcondition
(PostEnv) specifies the
action effect and the way to <cardinality>|<instance_name>
make it visible and/or
[<condition>]
accessible for the
This =
environment (events
<subject_identification
_expression>
declaration etc).
ID
{String}
BookingTickets
<subject_modification_
expression>
Irina Rychkova. 9/2006
16
Action-Action relations


UML
BPMN
Irina Rychkova. 9/2006
17
Model transformation

Semantics for model transformations:


Refinement
Composition
Irina Rychkova. 9/2006
18
Refinement 1/3
Agenda
nMovies: Integer
ClientAccountList
nClients: Integer
Agenda
ClientAccountList
nMovies: Integer
*
H
BookingTickets
ClientAccount
H
ID: String
1
ReservationList
Class redefinition:
nReservations: Integer
ClientAccountList
How it affects the definition of
BookingTicket action?
?
H
BookingTickets
H
OCL expressions:
...
Irina Rychkova. 9/2006
19
Refinement 2/3
ClientAccountList
NClients
{int}
0..*|cL[1]..cL[*]
nClients
ReservationList
1|this
PostEnv [true]
This = the cL | cL in cList.cL
where cL.id == userID;
This.reservationList.nRes:=
This.reservationList.nRes + idList.nID
PreS:
1|cList
H
BookingTickets
H
ClientID
{String}
ClientAccountList redefined
→ BookingTickets must :
1.
ClientAccount
reservationList
ClientAccountList
PreEnv:
1|userID
choose the ONE client out of the
H
list
modify the reservation list of this
client
Accept corresponding
parameters from environment Irina Rychkova. 9/2006
id
ID
{String}
Reservation
Bag
PreEnv:
1|idList
BookingTickets
H
E1[userID:ClientID,
idList:ReservationBag]
2.
3.
20
Refinement 3/3
BookingTickets redefined →
1.
2.
3.
Relations to properties must be
redistributed between
component actions
Emergent property required
Communication with
environment needs revision
ClientID
{String}
PreEnv:
1|userID
ClientID
{String}
PreEnv:
1|userID
Reservation
Bag
NMovieID
{int}
nID
PreEnv:
1|idList
H
H
BookingTickets
E1[userID:ClientID,
idList:ReservationBag]
ValidID
{Boolean}
Reservation
Bag
PreS:
Emergent
1|validUser
PreEnv:
1|validUser
validUser==true1|idList
exists cL in cList.cL
where cL.id.valueRef eq
userID.valueRef
nID
NMovieID
{int}
BookingTickets
ManageReservation
LogIn
H
M0: LoggingIn
[userID: ClientID]
M1: [idList:
Reservation]
Irina Rychkova. 9/2006
LogOut
H
M2: Exit
21
Semantically safe
transformations

Binding expressions:
cList.nClients = cList’.size()
ClientAccountList
0..*|cL[1]..cL[*]
NClients
{int}
ReservationList
nClients
1|this
PostEnv [true]
This = the cL | cL in cList.cL
where cL.id == userID;
This.reservationList.nRes:=
This.reservationList.nRes + idList.nID
ClientAccountList
PreS:
1|cList
H
BookingTickets
ClientAccount
reservationList
H
ClientID
{String}
PreEnv:
1|userID
H
Irina Rychkova. 9/2006
E1[userID:ClientID,
idList:ReservationBag]
id
ID
{String}
Reservation
Bag
PreEnv:
1|idList
BookingTickets
H
22
Benefits



Semantically rich models
Explicit Behavior-changes-state
notation
Simulation possible
Irina Rychkova. 9/2006
23
Part II

Application
Irina Rychkova. 9/2006
24
Types vs. Instances

Instance information is embedded into the
model:




Property-Property relation links instances
(ordered sets of instances in case of *
cardinality)
Behavior-Property relation defines an operation
via instances
Binding using instance names
Values:

For every statefull property its initial state
predefined
Irina Rychkova. 9/2006
25
SEAM – AsmL translator

AsmL – abstract
model specification
language with
environment for
simulation and
testing
Irina Rychkova. 9/2006
26
Tool for automated code
generation
SEAM meta-model
SEAM model
SEAM_Model
hollon
systemOfInterest
HComposition
*
1
0..*
component
holds
Hollon
1
*
1
Role
Next org level
HGroupComposition
name:String
EntityType: String
0..*
asWhole
asComposite
operand
sends
1
asComposite
asHollon
0..*
Expression
1
Name: String
Description: String
OrgL: Int
FuncL: int
ID: String
parentHollon:Hollon
parentHollon:Hollon
OrgL: Int
FuncL: int
ID: String
Type: String
1
asHollon
SEAM_Element
Constraint
*
Message
Expression:String
SubjectExpression: String
Condition 0..1
Condition
1
WorkingObject
<as a whole>
Expr:String
WorkingObject
<as a composite>
asWhole
1
ClientAccountList
context
*
ifInstruction
IFExpression
context
component
ElseInstruction
Context
1
1
component
*
LocalizedContext
JointContext
Action
0..*|cL[1]..cL[*]
0..1
partOf
LocalizedtAction
JointAction
Activity
ReservationList
ClientAccount
reservationList
LocalizedtActivity
1|this
PostEnv [true]
This = the cL | cL in cList.cL
where cL.id == userID;
This.reservationList.nRes:=
This.reservationList.nRes + idList.nID
JointActivity
0..1
partOf
context
behavior
*
CBRelation
1
relationToBehavior
1
asActivity
*
1
PPGroupConstraint
holdsPPConstraint
Context
CBGroupRelation
1
component
0..*
asContext
holdsBehavior
Behavior
asActivity
id
holdsProperty
holdsProperty
1
BPGroupRelation
Spec: String
*
asAction
1
1
ID
{String}
1
*
AAConstraint
*
relationToProperty
*
relationToProperty
1
*
*
CPGroupRelation
CPRelation
PAssociation
BPRelation
component
*
property
*
PropertyRole: Role
PropertyCardinality: String
Stereotype: String
Condition: Condition
expression:Expression
Spec: String
ActivityNode
1
AAGroup
Constraint
behavior
1
1
*
PPConstraint
property
1
context
1
destination
1
Property
source
destination
source
destination
BPContextAssociation
BPContextComposition
Transition
Merge
Transition
Fork
source
1
InstanceType: String
stateSpaceType: String
source destination
Transition
DestinationRole: Role
DestinationCardinality: String
SourceRole: Role
SourceCardinality: String
Directed: boolean
CollectionType: String
expression: Expression
Spec: String
PDependency
Stereotype: String
Inclusive: boolean
1
0..*
asBehavior
1
holds
Action
ControlAction
default
ClientID
{String}
Reservation
Bag
ANDSplit
XORSplitEB
Transition
Boundary
ANDJoin
Transition
EventBased
1
PreEnv:
1|userID
1
BookingTickets
property DestinationRole: Role
Expression: Expression
*
component
*
PGroupReference
owner
*
ValueType: String
Value: java.Object
PExhibit
parameter
0..*
*
ActivityActionGroup
Relation
*
relationTo
Action
ActivityAction
Relation
action
activity
One Property can
be statefull or
stateless at 2
different level
Event
Boundary
Type: String
0..1
Activity.asWhole =
Activity.asBehavior.asAction
H
0..1
State
invokes
Event
Type: String
*
Start
holdsAction
asWhole 1
PreEnv:
1|idList
PComposition
0..1
0..*
0..1
DestinationCardinality: String
CollectionType:String
PReference
State
stateSpace[]
1
event
holdsAAConstraint
End
Activity
atCreation
generates
1
1
asComposite
boundary
ORJoin
asBehavior
1
0..1
isMultiple: Boolean
exitCondition: Condition
Type: String
*
event
asContext
Activity.holdsAction.
relationToAction.
action =
Activity.asContext.holdsBehavior.
relationToBehavior.
behavior.asAction
Action.asComposite =
Action.asBehavior.asActivity
H
E1[userID:ClientID,
idList:ReservationBag]
Transformation
Translator
Java
AsmL model
(Code asml)
ASML meta-model
AnyAsmlMethod
AnyAsmlElement
Name:String
Id: String
Print(): String
parentActivity
AnyAsmLTransition
AsmLMethod
Spec: String
*
SeamMethod
1
1
Constructor
SystemOut
1
Main
targetMethod
inputPar: Parameter[]
printCallLine():String
printCallLine():String
inputPar: Parameter[]
*
*
printCallLine():String
1
1
destination
source
source
destination
destination
source
expression
AsmLBoundary
Transition
Mergesource
Transition
Fork
transition
1
Transition
1
isEnabled: Boolean
boundary
Event
default
*
Action
Activity
Transition
EventBased
ANDJoin
XORSplitEB
ANDSplit
Expression
Transition
Boundary
1
event
*
event
ORJoin
AsmLEvent
1
ControlAction
controlledActivity
typeOfControl: String
PlainAction
emergentPropName: String[]
postEnv
Name: String
Type: String
Text: String
Trigger: String
*
preSystem
AnyAsmlType
postSystem
*
Constructor
emergent
1
Name: String
constructor
isNullAllowed: Boolean
1
Parameter
SeamMethod
Name: String
Type: String
*
AnyAsmlVAL
AnyAsmlREF
method
systemOut
*
SystemOut
globalBoundary
*
globalEvent
AsmLBoundary
Asml_Model
mainMethod
0..1
globalType
Name: String
FuncLevel: Int
OrgLevel: Int
Behavior: String
Main
attribute
globalVar
Role
*
1
*
Irina Rychkova. 9/2006
AsmLEvent
Name: String
Type: String
Text: String
Trigger: String
NameSpace
name: String
ofType
*
name:String
AnyAsmLType
namespace
0..1
Type: String
*
AnyAsmlVAR
Name:String
asCollection: String
*
Expression
*
*
*
minValue: java.Object
maxValue: java.Object
stdValueType: String
stdValueType =
STRING,
BOOLEAN, INT,
FLOAT,
DOUBLE, CHAR
1
1
Expression:String
SubjectExpression: String
Condition 0..1
Condition
Expr:String
IFExpression
AnyAsmlVAR
Name:String
asCollection: String
operand
ifInstruction
ElseInstruction
27
Translation/Transformation

Transformation 1:


Specification of the Model_Of_Interest




Hollon
Behavior of Interest
Level of Details
Transformation 2:


From Graphical SEAM (XML) to SEAM abstract syntax
tree (AST).
From SEAM AST to AsmL AST
Printing out AsmL AST to the file, executable by
AsmL tool.
Irina Rychkova. 9/2006
28
Benefits


Verification of refinement “on the fly”
Correct by construction models
Irina Rychkova. 9/2006
29
Future work



Refinement verification using Asmlt.
Expressions in SEAM likely to be written in some
platform-neutral language (currently written in
AsmL) with the possibility to parse and translate to
many platforms (asml, ocl, java, scala..) for further
verification and/or simulation
Semantic bindings for model refinement are
detected by the translation tool however cannot be
defined automatically


Automated analysis of Expression refinement together
with Property ans Behavior refinement is required
QVT?
Irina Rychkova. 9/2006
30
Presentation structure

Theoretical problem:


There are 2 ways to look at the world – rectangular and circular.
In modeling 2 semantics exist:




Structure and Behavior are loosely-coupled.
Practical problem:


Within one model of the workflow information about objects is hidden inside the
actions…
Theoretical Solution:


System thinking puts emphasis to the integration of these 2 aspects within one
model.
If both aspects are visible on the same model ->




Definition of behavior as a state change
Re-definition of property explicitly affects behavior
Re-definition of behavior explicitly affects property
Practical solution:


Actions within activity and processes
Objects within data structure
Semantic relations between behavior and structure.
Impact:


Semantic of model transformation
Verification
Irina Rychkova. 9/2006
31