Towards xMOF: Executable DSMLs based on fUML www.modelexecution.org Tanja Mayerhofer, Philip Langer, Manuel Wimmer Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology y gy Favoritenstraße 9 ‐ 11/188 ‐ 3, 1040 Vienna, Austria phone: +43 (1) 58801 ‐ 18804 (secretary), fax: +43 (1) 58801 ‐ 18896 office@big.tuwien.ac.at, www.big.tuwien.ac.at
Domain ‐ Specific Modeling Languages p g g g Success of MDE depends on availability of means for defining DSMLs Eclipse Modeling Tools DSML Syntax Syntax Semantics Semantics Abstract MOF Static OCL Syntax Ecore Semantics Concrete Xtext Behavioral ? Syntax GMF Semantics No standard means for specifying behavioral semantics of DSML exist Efficient development of model execution facilities impossible p p 2
Semantics of Domain ‐ Specific Modeling Languages p g g g Denotational / translational semantics E Examples: l Abstract State Machines K. Chen, J. Sztipanovits, S. Abdelwalhed, E. Jackson. Semantic anchoring with model transformations. In Proc. of ECMDA ‐ FA'05, pages 115 ‐ 129, 2005. Maude J E Rivera F Duran and A Vallecillo On the behavioral semantics of real ‐ time J. E. Rivera, F. Duran, and A. Vallecillo. On the behavioral semantics of real time domain specific visual languages. In Workshop Proc. of WRLA'10 @ ETAPS'10, pages 174 ‐ 190, 2010. Pros: Execution and analysis tools can be reused Cons: Mapping model into target language is complex Results have to be mapped back esu ts a e to be apped bac 3
Semantics of Domain ‐ Specific Modeling Languages p g g g Operational semantics A Approaches: h Graph transformations G. Engels, J. H. Hausmann, R. Heckel, and S. Sauer. Dynamic meta modeling: A graphical approach to the operational semantics of behavioral diagrams in UML. In Proc. of UML'00, pages 323 ‐ 337, 2000. Action language Action language Kermeta, MXF, Smalltalk, Eiffel, xCore, Epsilon Object Language U Use fUML as action language fUML ti l 4
Foundational UML (fUML) OMG standard V1.0 released 02/2011 Specification of behavioral semantics of foundational UML subset Structural kernel : class association data type etc Structural kernel : class, association, data type, etc. Behavioral kernel : behavior, event, signal, etc. Activities : activities, parameters, nodes , flows A ti iti ti iti t d fl Actions : communication, object, structural feature, link actions Operational semantics approach specifying a fUML virtual machine UML activity diagrams can be executed 5
Specifying Semantics with fUML p y g Level mismatch for specifying semantics of DSML using fUML activities Current Situation M3 MOF «instanceOf» «instanceOf» «operatesOn» M2 fUML aDSML MM aDSML OS «instanceOf» afUML M1 Model MM … Meta ‐ Model OS … Operational Semantics 6
Specifying Semantics with fUML p y g Current Situation (1) Push down DSML to M1 / Pull up DSML to M2 M3 MOF MOF «instanceOf» instanceOf «instanceOf» instanceOf «instanceOf» instanceOf «instanceOf» instanceOf fUML aDSML MM fUML aDSML MM M2 «transformedTo» «instanceOf» «instanceOf» «instanceOf» «instanceOf» «instanceOf» afUML aDSML OS aDSML MM aDSML Model aDSML Model aDSML Model M1 M1 Model (in fUML AD) (in fUML CD) (in fUML OD) «ontological «transformedTo» instanceOf» «operatesOn» «executes» MM … Meta ‐ Model OS … Operational Semantics Pros Approach can be implemented using existing tools AD … Activity Diagram CD … Class Diagram OD OD … Object Diagram Object Diagram C Cons High effort for transformation needed UML environment has to be used instead of metamodeling environments 7
Specifying Semantics with fUML p y g Current Situation (2) Pull up fUML to M3 xMOF MOF M3 MOF MOF fUML «instanceOf» instanceOf «instanceOf» instanceOf «instanceOf» instanceOf «instanceOf» instanceOf «pulledUp» p lledUp «instanceOf» instanceOf fUML aDSML MM aDSML MM fUML aDSML OS M2 «operatesOn» «instanceOf» «instanceOf» afUML aDSML «executes» M1 M1 Model Model MM … Meta ‐ Model Integrated metamodeling language eXecutable MOF (xMOF) OS … Operational Semantics Abstract syntax: MOF Behavioral semantics: fUML 8
Example: Petri Net p syntax metamodel syntax metamodel Net conf 1 1 1 places places transitions transitions * * * input Place Transition * * output - initialTokens:int * * conf conf 1 1 conf conf 1 1 * * Provides runtime representation PlaceConf TransitionConf input Separation of syntax and semantics p y - tokens :int + fire() :void + fire() :void * * * * + isEnabled() :boolean output + addToken() :void + removeToken() :void * * place configs transition configs * * 1 1 NetConf runtime configuration metamodel * + run() :void 9
Example: Petri Net p syntax metamodel syntax metamodel Net conf 1 1 1 places places transitions transitions * * * input Place Transition * * output - initialTokens:int * * conf conf 1 1 conf conf 1 1 * * PlaceConf TransitionConf t1: TransitionConf input input output - tokens :int + fire() :void + fire() :void * * * * + isEnabled() :boolean output p1: PlaceConf p2: PlaceConf + addToken() :void + removeToken() :void tokens = 1 transition tokens = 0 * * configs place configs place configs place configs transition configs * * 1 1 n: NetConf NetConf runtime configuration metamodel * + run() :void 10
Example: Petri Net p t1: TransitionConf input output NetConf::run() p1: PlaceConf p2: PlaceConf tokens = 1 transition tokens = 0 configs p place configs g p place configs g {n} n: NetConf ReadSelf ReadStructuralFeature Read Read transition configs result : object : NetConf NetConf result : TransitionConf[*] {t1} Select enabled transition configs transition configs : «parallel» TransitionConf[*] [ ] target : {t1} result : TransitionConf true true boolean C ll i E Call isEnabled() bl d() (TransitionConf::isEnabled) decisionInputFlow [true] transition configs : TransitionConf[*] {t1} list :TransitionConf[*] target :TransitionConf index {t1} {t1} V l ValueSpecification S ifi ti :int i t Get :ListGet Call fire() Specify 1 (TransitionConf::fire) result : 1 result : 11 int TransitionConf
Example: Petri Net p t1: TransitionConf input output p1: PlaceConf p2: PlaceConf 0 1 tokens = 1 transition tokens = 0 configs place configs p g place configs p g n: NetConf TransitionConf::fire() {p2} object : {p2} «iterative» TransitionConf ReadStructuralFeature Call addToken() result : Read ouput (PlaceConf::addToken) TransitionConf result : target :PlaceConf ta get aceCo ReadSelf PlaceConf[*] output place configs : PlaceConf[*] Read {p1} {t1} «iterative» {p1} ReadStructuralFeature Call removeToken() Read input Read input object : bj t (PlaceConf::removeToken) target :PlaceConf TransitionConf result : input place configs : PlaceConf[*] PlaceConf[*] 12
Extensibility of Semantics y Model everything down to the very last detail may not be feasible May require utilization of libraries which are not available for the fUML virtual machine Examples: Examples: Complex mathematical calculations Control of external resources Integration of external libraries with fUML virtual machine No extension of fUML metamodel and virtual machine Transparent usage of external libraries 13
t1 Example: Petri Net p t2 t2 t3 NetConf::run() ReadSelf ReadStructuralFeature Read Read transition configs result : object : NetConf NetConf result : TransitionConf[*] java.util Select enabled transition configs transition configs : «parallel» TransitionConf[*] [ ] Random target : + next(int) result : TransitionConf + nextInt() boolean C ll i E Call isEnabled() bl d() + nextInt(int) (TransitionConf::isEnabled) … decisionInputFlow [true] transition configs : TransitionConf[*] {t1, t2, t3} list :TransitionConf[*] target :TransitionConf index {t1} {t1} V l ValueSpecification S ifi ti :int i t Get :ListGet Call fire() Specify 1 (TransitionConf::fire) result : 1 result : 14 int TransitionConf
Extensibility of Semantics y 1. Import of external libraries 1 1. R Reverse engineering of library for extracting API classes i i f lib f t ti API l 2. Import of classes into fUML model specifying the semantics of a DSML 3. 3 Create empty activities for each operation acting as place holder Create empty activities for each operation acting as place holder 2. Integration of external libraries at runtime Call of library operation 1. Suspend execution at entry of place holder activity 2. Forward invocation to actual operation of external library 3. Integrate result into runtime model of execution Instantiation / Modification of library instances 1. Maintain mapping between fUML instances and library instances 15
Conclusion Integrated metamodeling language eXecutable MOF (xMOF) Specification of behavioral semantics using fUML Usage of external libraries eXecutable MOF (xMOF) xMOF xMOF MOF fUML M3 «instanceOf» «instanceOf» «pulledUp» «instanceOf» aDSML MM fUML aDSML OS M2 «operatesOn» «instanceOf» M1 aDSML «executes» Model Model 16
Recommend
More recommend