Integrating Graphical and Textual Modelling Languages Luc Engelen and Mark van den Brand
Feb 10, 2016
Integrating Graphical and Textual Modelling Languages
Luc Engelen and Mark van den Brand
Integrating Metamodel-based and Grammar-based Modelling Languages
Luc Engelen and Mark van den Brand
/ Software Engineering and Technology PAGE 329-3-2009
Overview
1. Problem description2. Two approaches3. Two implementations4. Case study5. Advanced applications6. Conclusions
/ Software Engineering and Technology PAGE 429-3-2009
Problem description
/ Software Engineering and Technology PAGE 529-3-2009
Extract (M2T) Convert and transform (T2M) Merge (M2M)
Two approaches
= XMI-representation of model
= Metamodel-based model fragment = Metamodel-based model
= Grammar-based model fragment
Interpret as XMI Rewrite (T2T) Interpret as ‘model’
/ Software Engineering and Technology PAGE 629-3-2009
• Embedding in a custom language
SendSignalStatement: String
Embedding a textual language
Statement
Assignment MethodCall Textual
• Embedding the UML
/ Software Engineering and Technology PAGE 729-3-2009
Modelware approach
• Extracting textual fragments
• Merging models andfragments of models
/ Software Engineering and Technology PAGE 829-3-2009
Modelware approach
• Convert and transform
LS ::= S { “;” S } S ::= “stat”
LS
S CFsourcetarget
/ Software Engineering and Technology PAGE 929-3-2009
Modelware approach
• Convert and transform
LS ::= S { “;” S } S ::= “stat”
LS
S CFsourcetarget
stat; stat; stat s: S s: S s: S
list: LS
f:CF f:CF
/ Software Engineering and Technology PAGE 1029-3-2009
Modelware approach
• Convert and transform
LS ::= S { “;” S } S ::= “stat”
LS
S CFsourcetarget
stat; stat; stats: S s: S s: S
list: LS
/ Software Engineering and Technology PAGE 1129-3-2009
Modelware approach
• Convert and transform
LS ::= S { “;” S } S ::= “stat”
stat; stat; stats: S s: S s: S
list: LS
s: S
LS
S
s: S s: S
list: LST2M M2M
LS
S CFsourcetarget
/ Software Engineering and Technology PAGE 1229-3-2009
Grammarware approach
• Rewriting
<packagedElement xmi:type="uml:Class" xmi:id="_id1" name="A"> <ownedAttribute xmi:id="_id2" name="a" type="_id3"/> <ownedOperation xmi:id="_id4" name="n" method="_id5"> </ownedOperation> <ownedBehavior xmi:type=“uml::OpaqueBehavior" xmi:id=“_id6"> <body>behavior{ a := n(a) }</body> </ownedBehavior></packagedElement>
Class2Id[(A, _id1), …]Attribute2Id[(A, a, _id2, _id3), …]Operation2Id[A, n, _id4), …]
• Textual fragments use names, XMI uses Identifiers
/ Software Engineering and Technology PAGE 1329-3-2009
Grammarware approach
T( A “:=” B ) → <effect xsi:type = “slco:AssignmentStatement”/> T(B) T(A) </effect>T( “false” ) → <expression xsi:type=“slco:BooleanConstantExpression” value=“false”/>
/ Software Engineering and Technology PAGE 1429-3-2009
Two implementations
• Modelware• Xpand for T2M• Xtext for M2T• Xtend for M2MAll from the openArchitectureWare platform for eclipse
• Grammarware• SDF for the grammars
− XMI grammar off the shelf− Custom grammars for the fragments
• ASF for the T2T transformation
/ Software Engineering and Technology PAGE 1529-3-2009
Case study
/ Software Engineering and Technology PAGE 1629-3-2009
Case study
/ Software Engineering and Technology PAGE 1729-3-2009
Observations
• Modelling in eclipse• Diagrams• Simple textual models• Structure editing
• Our approaches add• Embedding of textual fragments in metamodel based models
• Modelware• Restricted to LL(*) grammar• Straightforward mapping from grammar to metamodel
• Grammarware• Forces switching between environments• Deals with plain XMI
− Tool-specific− Low level of abstraction
/ Software Engineering and Technology PAGE 1829-3-2009
Advanced applications
<packagedElement xmi:type="uml:Class" xmi:id="_id1" name="A"> <ownedAttribute xmi:id="_id2" name="a" type="_id3"/> <ownedOperation xmi:id="_id4" name="n" method="_id5"> </ownedOperation> <ownedBehavior xmi:type=“uml::OpaqueBehavior" xmi:id=“_id6"> <body>behavior{ a := m(a) }</body> </ownedBehavior></packagedElement>
Method “m” not found in class “A”
/ Software Engineering and Technology PAGE 1929-3-2009
Conclusions
• Embedding grammar-based languages in metamodel-based languages• Two approaches
− Modelware− Grammarware
• Two implementations• Case study: textual alternative for UML activity
diagrams
/ Software Engineering and Technology PAGE 2029-3-2009
Conclusions
• Grammarware approach and implementation• Flexible grammar definitions• Dealing with XMI
• Modelware approach and implementation• Only one modelling environment• Conversion and transformation in two steps