© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 1
XWeave
Models and Aspects in Concert
Iris GroherSiemens AG, CT SE 2
Markus VoelterIndependent Consultant
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 2
Contents
1. Model-Driven Software Development in a Nutshell
2. Model Weaving
3. XWeave
4. Home Automation Example (Smart Home)
1. Smart Home (Meta) Models
2. Examples
5. Evaluation
6. Conclusion and Future Work
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 3
Model-Driven Software Development (MDSD)
• Systems are mostly described in terms of models
• Models play the role of source code • Models do not only constitute documentation• Models are processed by tools
• Models are instances of meta models• Meta models describe the abstract syntax of models
• Meta models are instances of meta meta models• MOF, Ecore
• Infrastructure• Editors• Model transformations
• Used for processing and refining models
• Generators
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 4
Model Weaving
• Model Evolution• Changes are localized in aspects• Simplifies traceability and change management
• Product Line Engineering• Variable (optional) parts are captured in aspect models• Woven to minimal core common to all products
• Architectural Viewpoints• Combination of different viewpoints to form a consistent whole
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 5
XWeave
• Model weaver based on EMF’s Ecore meta meta model• Weaving of both meta models and models
• Takes a base model and one or more aspect models as input
• Weaves content of aspect model into base model (asymmetric AO)
• Base model defines core abstractions
• Aspect model defines delta to core abstractions and pointcuts• All properties of the aspect element including its
child elements are woven into the base model
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 6
Pointcut Definition
• Name matching• If a model element in the aspect model has a corresponding element in
the base model the element if woven.• Name and type have to be equal
• Expressions• Defined external to both models• Uses oAW expression language, based on OCL• %expressionName• Path expressions• Working with collections• Selection/filtering
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 7
Home Automation Example (Smart Home)
• Electrical and electronic devices (e.g. lights, blinds,...)• Sensors measure physical values• Controllers activate devices
• State can be monitored and changed from common UI
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 8
Smart Home (Meta) Models
Smart Home Meta Model
Smart Home Model
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 9
Examples – Model Weaving
FireSensor%allRooms
allRooms( House this ): floors.rooms;
AHouse
FirstFloor
SecodFloor
BathRoom
BedRoom
Kitchen
FireSensor
FireSensor
FireSensor
Aspect Model
Resulting Model
Base Model
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 10
Examples – Meta Model Weaving
Aspect Model
Resulting ModelBase Model
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 11
Example – State Machine
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 12
Evaluation
• Weaving of both EMF meta models and models
• Pointcut definition based on name matching and expressions
• Limited advice• No changing, removing, or overriding of base model elements• Only additive weaving is supported
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 13
Conclusion and Future Work
• Model weaving is a possible way of integrating AOSD and MDSD
• XWeave simplifies• Model evolution• Variability on model level• Combination of architectural views
• We are currently implementing a demonstrator of a product line that uses XWeave to implement variability on model level.
• Future Work• Combine XWeave with a variant management tool• Removing, changing, and overriding of base model elements• Symmetric weaving
© Siemens AG, CT SE 2, 12.03.2007Iris Groher, Markus Voelter
C O
R P
O R
A T
E
T E
C H
N O
L O
G Y
XWeave – Models and Aspects in Concert 14