摘要
目前软件开发的复杂性、多样性和易变性已经成为软件开发者挥之不去的难题。针对这些问题,国际对象管理组织OMG提出了模型驱动框架MDA。通过对实际问题进行抽象建立相应的模型能够尽可能缓解复杂性的问题,由于模型采用与实现细节无关的中立语言表达,通过模型转换工具实现到具体语言平台的转换可以解决实现技术等多样性的问题。对于系统需求和实现技术等的变化可以通过修改模型和配置相应的模型转换工具重新生成或转换模型,可以解决或缓解易变性的问题。不同的应用和不同的领域需要不同的模型,我们不可能构造同时最适合不同需求的模型。可执行元模型可以用于描述不同的模型,统一不同需求的模型定义。由于目前的模型语言(如UML、MOF)语义的定义还不够精确,所以其相关应用(如模型转换)无法得以精确的描述。本文研究的可执行元模型给了元模型精确的可执行语义,所以由它扩展描述的其它模型也是具有精确语义的可执行模型。可执行的模型能够在应用具体实现前虚拟执行,对应用进行验证、测试、仿真,是进一步转换到具体语言平台的应用的基础。
可执行元模型关键技术研究以OMG的MOF模型为基础,采用语言工程的研究方法进行可执行元模型的关键技术,以及基于可执行元模型提供描述其它可执行模型的基础设施的相关技术的研究。主要研究内容包括:1)模型语言设计模式的研究。2)可执行元模型的抽象语法模型的研究。3)可执行元模型表面语法相关技术研究。4)可执行元模型的语义描述方法和基于操作语义的虚拟执行方法的研究。5)基于可执行元模型的元核语言进行元建模设施的相关技术研究。
本文的研究成果丰富了可执行元模型的理论基础,推动了可执行元模型的应用研究,具有一定的理论意义和实用价值,为元模型可执行的研究和可执行元模型集成开发环境的研制提供了有意义的方法和手段。
Nowadays software engineers must be faced with complexity, diversity and changeduring software development. MDA proposed by OMG aims at these difficult problems.Complexity can be contend with abstracting the real world problem and then constructingcorresponding problem domain models, since these models were expressed in a modelinglanguage which is independent of implementation details, diversity can be handled bytransforming these platform independent models into platform specific model using modeltransformation tools. Change, such as the change of system requirement and implementationtechnology, will be manged or reduced by modifying model and (or) configuring relevantmodel transform tools. Different model language are needed according to different domains,and constructing a one-size-fits-all model is impossible. The executable metamodel can beused to specify models of different requirements and define them in a unified way. All of themodel languages in existence are poor in semantics, and thus all relevant applications, such asmodel transformation, cannot be specified precisely with them. The executable metamodel is asemantically rich model language, so other models extended from it also obtain the precise andperformable semantics. The executable application model can be validated, tested, emulatedbefore it is realized. The executable ability of model is elementary for model transformationapplication and other relevant application.
The research on the key technology of executable metamodel, based on OMG's MOF,introduce the language engineering method to study the key technology for execution,furthermore, based on the result, study the relative technology to specify metamodel'smodeling facility which specifies other executable model. Executable metamodel adoptmodeling language design pattern to design. This pattern includes two relationships to twomutual exclusive parts. One is modeling abstract syntax and surface syntax respectively, Theother is modeling abstract syntax model and semantic domain model repecitively from relativeconcepte of model and instance. Then, with the mapping of concepts between abstract syntaxand semantic domain, the semantics of model language are devised. The method, adopting
model language to devise model and specifying model language semantics, which is based thefact, that the explaining and being explained relationship in model level and instance levelrepectively, can be used to specify any abstract level model semantics.Compared with the concrete expression of notion (surface syntax), abstract syntaxemphasizes the abstract expression of notion, does not concern what is presented to the usersor the meaning of the components. Abstract syntax of executable metamodel mainly specifiesthe concepts of executable metamodel and well-formed relationship between the concepts.EMOF (Essential MOF model) only provides the abstract syntax model element of specifyingstatic concept of language. In this article, EMOF is extended by adding new types of concept,expression, primitive behavior, compound behavior, link behavior, message and exceptionextension, and thus constructs the most refined executable core (meta-kernel model language)is constructed. From the extension of this meta-kernel model language, many other usefullanguages can be constructed, such as the meta-constraint language which is used to restrictthe favorable relationship of abstract syntax model, meta-grammar language that can specifyany model language grammars, and the meta-diagram language, used to specify other modellanguage diagrammatic syntax.Surface syntax specifies the symbol of modeling language. The common-used surfacesyntax of a modeling language includes textual surface syntax and diagrammatic surfacesyntax. Executable metamodel provides both the textual surface syntax and the diagrammaticsurface syntax, and with the text description of diagrammatic syntax, unifies the textualsurface syntax and diagrammatic surface syntax. The extended BNF grammar is used inexecutable metamodel to specify its text syntax rules. This extended BNF is named asmeta-grammar language. With the synthesis of concept instances of abstract syntax model, itcan build the mapping relationship between surface syntax and abstract syntax, which enablesthe concept of abstract syntax modeling to be conveniently used in surface syntax and increasethe efficiency of adopting model language surface syntax for different domain experts. For thepurpose of improve the efficiency of build the language grammar, in the article, a quasi-quotemechanism is studied which is used to retrieve their abstract syntax corresponding the existingtextual syntax. With the quasi-quote mechanism, the abstract syntax of text syntax elementwhich has been built by the system can be reused to construct new syntax element. No matterconstructing the abstract syntax straightly or with the help of quasi-quote mechanism, theoriginal text syntax is not retained that lead to the result that the text syntax is lost, and thedetails of the original syntax is often used when the reverse transformation from abstractsyntax to text syntax is done, especially when debugging a model. Syntax sugar supports this.New syntax element can be constructed by transform to existing element with the syntax sugar.
The desugar operation performs to create an instance of a new syntax category when thematamodel is computing or compiling on the instance. By leaving the desugaring step to thelast possible moment, the structure of the original syntax construct is retained as long aspossible. The diagrammatic syntax of executable modeling language is achieved fromextending the diagram exchang metamodel for UML (DIU), which shows the abstractexpression of UML diagrammatic syntax. The diagrammatic syntax' construction is dynamicand incrementally process, so is the interpretion from diagrammatic syntax to abstract syntax.This process is different from textual syntax interpretation process. The diagrammatic syntaxcannot be interpretted in batch. The dynamic and incrementally interpretation of diagrammaticsyntax may be solved using observer pattern in practice, but it lead to high coupling betweendiagrammatic syntax and abstract syntax. In this article the problem is solved the problem inmapping way.The semantics of executable metamodel is specified by establishing the mapping betweenthe concept of abstract syntax model and the abstract semantics domain, which is similar to thedenotational semantics. The root element of abstract syntax in executable metamodel inheritsthe ability of abstract the concept “object” in abstract semantics domain by reflection, whichmakes the executable metamodel obtain the self-described ability. The virtual machine ofexecutable metamodel expresses the concept of abstract semantic domain in meta-kernelmodel language in the form of the instruction of virtual machine, the executable semantics ofexecutable metamodel in the form of abstract state-machine. Executable metamodel can beused to construct other modeling language. In this article, the metamodeling approach of otheroften-used formal semantics such as denotational semantics, translational semantics,operational semantics and extensional semantics is also introduced. With these methods, wecan build other modeling language from extending the executable metamodel. The chosen ofdifferent kinds of semantics metamodeling approachs depends on the type of modelinglanguage defined. Denotational semantics is suitable for a declarative and non-executabledescription. If a language has concepts that need to be evaluated, executed or instantiated thenthey should be modelled using an operational, translational or extensional approach. Atranslational approach can be used if a concept is a form of syntax sugar of more primitiveconcepts apparently;an extensional approach can be used if the concept need reserving andexisting concept may be reused;an operational approach can be used to build an interpreter ifthere is no means to reuse existing concept easily.Through the research on modeling language design pattern, abstract syntax, surfacesyntax, and semantics of the executable metamodel, we develop a metamodel language systemthat is used to validate the executable model language. The system bootstraps itself by the boot
file written by the executable model language and initializes performable environment of itsvirtual machine. This performable environment gives meta-kernel language, meta-constraintlanguage, meta-grammar language and meta-diagram language based on Java swing. It hasbeen proved in practice that the executable metamodel enable modeler to construct modellanguages for different domain in a highly efficient way and these model languages can beexecuted in a virtual way, used for validation and used for simulating an concrete application.Moreover, the model transformation language, which can be used transform platformindependent model into platform specific model, can be constructed based on the executablemetamodel.In conclusion, the achievement of this dissertation enrichs the executable metamodeltheory and makes the applied research on the executable metamodel theory progress. It is ofgreat theory significance and practice value. It provides effective methods and means for theresearch on the executable metamodel and its integration development environment.
引文
[1] David S. Frankel. Model Driven Architecture:Applying MDA to Enterprise Computing [M]. published by John Wiley & Sons, Inc., 2003
[2] OMG. MDA Specifications [EB/OL].http://www.omg.org/mda/specs.htm ,2006.01.05
[3] Paul Clements,Linda Northrop. Software Product Lines: Practices and Patterns [M]. Published by Addison-wesley.2002.
[4] SEI.Software Product Lines [EB/OL]. http://www.sei.cmu.edu/productlines/index.html. Jan.,2005.
[5] Krzysztof Czarnecki, Ulrich W. Eisenecker: Generative Programming, Methods, Tools, and Applications [M]. published by Addison Wesley, 2000.
[6] Microsoft Inc. Intention Programming [EB/OL] . http://research.microsoft.com/pubs/view.aspx?tr_id=4. 2006
[7] IntentSoft Inc. IntentSoft [EB/OL]. http://www.intentsoft.com/ . 2006
[8] Jack Greenfield, Keith Short et al. Software Factories: Assembling Applications with Patterns, Models, Frameworks, and Tools [M]. Published by John Wiley & Sons.2004
[9] OMG. MOF 2.0 Core Final Adopted Specification, OMG formal/04-07-02 [S]. July 2004.
[10] OMG.OCL 2.0 Specification,ptc/2005-06-06 [S]. June,2005
[11] OMG. Unified Modeling Language: Superstructure version 2.0 formal/05-07-04 [S].August 2005.
[12] Nicolas Guelfi, Gilles Perrouin, Cédric Pruski, Beno?t Ries, Paul Sterges. FIDJI Project Annual Activity Report 2003 [Z], Technical Report TR-CST-04-01, 2004.
[13] E. D. Willink. UMLX: A graphical transformation language for MDA. In Ren,pp. 13-24, 2003.
[14] A. Agrawal, G. Karsai, F. Shi, A UML-based Graph Transformation Approach for Implementing Domain-Specific Model Transformations [J]. International Journal on Software and Systems Modeling 2003
[15] Riehle Dirk,Fraleigh Steven,Bucka-Lassen Dirk,Omorogbe, etc,The architecture of a UML virtual machine [J]. Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications, OOPSLA. v 36,p 327-341.2001.
[16]Parson Dale, Murray David J., Chen, Yu. Object-oriented design patterns for debugging heterogeneous languages and virtual machines [J]. v 35, p 255-279, 2005.
[17] C. Raistrick, Paul Francis, John Wright.Model Driven Architecture with Executable UML [M]. Cambridge University Press March 18, 2004.
[18] D Riehle, S Fraleigh, D Bucka-Lassen, N Omorogbe.The architecture of a UML virtual machine[J]. OOPSLA 2001. pp:327-341,2001.
[19] E. M. M. Babu, A. Malinowski and J. Suzuki. Matilda : A Distributed UML Virtual Machine for Model-Driven Software Development [J]. In Proc. of the 9th World Multi-Conference on Systemics, Cybernetics and Informatics, Orlando, FL, USA, July 2005.
[20] S.J. Mellor, M.J. Balcer. Executable UML : A Foundation for Model Driven Architecture [M]. Addison-Wesley Professional. May 15, 2002.
[21] T. Reenskaug. A Rudimentary UML Virtual Machine [EB/OL]. http://heim.ifi.uio.no/ trygver/2002/uml-vm/01-21-UML_VirtualMachine-131.pdf. 2006.
[22] W. Shen, K. Compton and J. Huggins. A Method of Implementing UML Virtual Machines With Some Constraints Based on Abstract State Machines [J]. Proceedings of the Tenth Asia-Pacific Software Engineering Conference Software Engineering Conference.P.224, 2003.
[23]I-Logix Inc. Executable Systems Design with UML 2.0 [EB/OL]. http://www.nohau.se/articles/pdf/ 21275_01-executable_system_design_uml.pdf. 2005
[24] Project Technology, Inc. Executable Translatable UML [EB/OL]. http://www.projtech.com/pdfs/xtum l/xtum l_full.pdf. 2006
[25] xtUML,xtUML Specification [S]. http::/www.omg.org/docs/syseng/02-08-02.doc, 2005.
[26] Xdoclet team. Xdoclet [EB/OL]. http://xdoclet.codehaus.org/. 2006
[27] Gen2j team. Gen2j [EB/OL]. http://gen2j.sourceforge.net/. 2006
[28] Jamda team . Jamda [EB/OL]. http://jamda.sourceforge.net/. 2006
[29] IBM SanFrancisco. Application Business components for Java developers. Disponível na Internet. http://www.redbooks.ibm.com/redpapers/pdfs/redp0011.pdf.
[30] Eclipse group. FUUT project [EB/OL] . http://www.eclipse.org/gmt/. 2006
[31] Goralla Logic inc. Goralla [EB/OL]. www.gorillalogic.com. 2006
[32] IBM . Rose XDE [EB/OL]. http://www.rational.com/products/xde/index.jsp. 2006
[33]Executable UML Team. Unimod Project[EB/OL]. http://unimod.sourceforge.net/. 2005.
[34]UML Action Semantics Consortium. Action Semantics [EB/OL]. http://www.kabira.com/as/. 2006.
[35] OMG. UML2 Road map [EB/OL]. syseng.omg.org/INCOSE%20IW%202003/ UML2-Preview%20K obryn.ppt. 2003
[36] University of Massachusetts. Matilda UMLVM project [EB/OL]. http://umlvm.cs.umb.edu/. 2005
[37] Bremen University. USE project [EB/OL]. http://www.db.informatik.uni-bremen.de/projects/USE/#overview. 2005
[38] Mark Richters and Martin Gogolla. Validating UML models and OCL constraints [J]. UML 2000 -The Unified Modeling Language. Advancing the Standard. Third International Conference, York, UK, October 2000, LNCS Vol. 1939. Springer, 2000.
[39] Martin Gogolla, Jo¨rn Bohling, and Mark Richters. Validation of UML and OCL Models by Automatic Snapshot Generation [J]. In Grady Booch, Perdita Stevens, and Jonathan Whittle, editors, Proc. 6th Int. Conf. Unified Modeling Language (UML'2003). Springer, Berlin, LNCS 2863, 2003.
[40] Ambrosio. Formally Modeling UML and its Evolution: A Holistic Approach [J]. FMOODS. 183-192, 2000
[41] 尹剑飞. MDA 环境下元建模的 OMCR 方法研究(博士论文). 华南理工大学 2005
[42] presice UML Group. pUML [EB/OL]. http://www.puml.org/. Jan.,2004.
[43] Vanderbilt University. GME Web Site [EB/OL]. http://www.isis.vanderbilt.edu/research/gme. Vanderbilt University. 2006
[44] Eclipse group. EMF project [EB/OL]. http://www.eclipse.org/emf/ , 2006
[45] INRIA . Kermeta project [EB/OL]. http://www.kermeta.org/ , 2006
[46] Xactium Inc. XMF [EB/OL] . http://www.xactium.com , 2006
[47] Makoto Oya. sMML -A Smart MetaModeling Language for Flexible Modeling [J] .Journal of Robotics and Mechatronics, Vol.17, No.1 pp. 3-10, 2005.
[48] Andy Evens. Language Driven Development and MDA [EB/OL] . http://www.bptrends.com/search.cfm?keyword=MDA+journal&gogo=1&go.x=68&go.y=4.2004.
[49] Peter Van Roy , Seif Haridi. Concepts, Techniques, and Models of Computer Programming [M]. The MIT Press Cambridge, Massachusetts London, England. 2004
[50] Harold Abelson, Gerald Jay Sussman,etc. Structure and Interpretation of Computer Programs second edition [M]. The MIT Press. 1996
[51] Jetbrains Compnay. MPS [EB/OL] . http://www.jetbrains.com/mps. 2006
[52] 胡文蕙, 赵 文, 张世琨, 王立福 . 基于构件技术的应用框架元模型的研究.软件学报, Vol.15, No.1.2004
[53] 张 伟, 梅 宏.一种面向特征的领域模型及其建模过程. 软 件 学 报 2003, Vo l.14, No.8.
[54] 秦祖立. 基于实时对象建模的嵌入式软件开发研究(硕士论文). 浙江大学.2005
[55] 刘红萍. 基于领域通用框架的扩展模型驱动开发模式(硕士论文). 大连理工. 2005
[56] 刘武东. MDA 模型转换框架与转换语言及其应用 (硕士论文). 武汉大学. 2005
[57] 高鹏. 基于动作语义的 UML 模型模拟研究与实现 (硕士论文). 北航. 2004
[58] 杨贤哲.模型驱动架构在 J2EE 平台上的应用研究. (硕士论文). 武汉大学. 2004
[59] 陈文智. Pcanel——基于模型驱动的嵌入式系统设计平台. (博士论文). 浙江大学.2005
[60] Wirth, N. Algorithms + data structures = programs [M]. Prentice-Hall, Englewood Cliffs, 1976.
[61] Muller PA, Fleurey F, Jezequel JM. Weaving executability into object-oriented meta-languages [J]. LECTURE NOTES IN COMPUTER SCIENCE 3713: 264-278 2005.
[62] Mellor, S., Tockey, S., Arthaud, R. and Leblanc, P. Action Language for UML: Proposal for a Precise Execution Semantics [J]. Proceedings of UML 98 (LNCS1618). 307-318.
[63] OMG. OCL 2 FTF OCL for EMOF [EB/OL]. http://www.omg.org/cgi-bin/doc?ptc/2005-06-13. Jan.,2006.
[64] D'Souza D., Wills A. C.: Object Components and Frameworks with UML — The Catalysis Approach [M]. Addison-Wesley. 1998.
[65] OMG. OCL 2.0 Specification Version 2.0 [S]. p112-151. June, 2005.
[66] Tony Clark, Andy Evans, Paul Sammut, James Willans, Applied Metamodelling A Foundation for Language Driven Development Version 0.1 [EB/OL]. http://albini.xactium.com/content/index.php?option=com_remository&Itemid=28
[67] C. Larman. Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process [M]. Prentice Hall, 2002.
[68] Qingguo Lan,Shufen Liu, Bing Li and Lu Han. Study on Unified Metamodeling Framework Based on Down-up Mechanism [J],Springer Lecture Notes in Computer Science Vol3865:596 – 605, 2006.
[69] 冯博琴,冯岚等译. 编译原理及实践 (M). 机械出版社. Mar. , 2000
[70] 陈英. 编译原理 (M). 北京理工大学出版社. Sep., 2001.
[71] Sun Inc. JavaCC. https://javacc.dev.java.net/ [EB /OL]. Nov., 2005
[72] Laurence Tratt. Compile-time meta-programming in a dynamically typed OO language Laurence Tratt Proc. DLS 05, pages 49-64, October 2005
[73] OMG. Unified Modeling Language: Diagram Interchange version 2.0 [S]. June, 2005.
[74] 阎宏. Java 与模式.电子工业出版社.October,2002.
[75] Anneke Kleppe,Jos Warmer. Unification of Static and Dynamic Semantics of UML(Z).2001
[76] Ken Slonneger, Barry L. Kurtz. Formal Syntax and Semantics of Programming Languages [M]. Published by Addison-Wesley. 1995.
[77] 金成植. 程序理论和技术 [M]. 吉林大学出版社. May, 1997.
[78] 屈延文. 形式语义学基础与形式说明 [M] . 科学出版社. 1989.
[79] joeq. Java Virtual Machine Open Source Project [EB/OL]. http://joeq.sourceforge.net. 2006
[80] 刘武东. MDA 模型转换框架与转换语言及其应用 (硕士论文). 武汉大学.2004.
[81] 奚德. 基于 MDA 的模型变换语言及工具的研究 (硕士论文). 复旦大学. 2004.
[82] J.M. Alvarez, T. Clark, A. Evans, and P. Sammut. An Action Semantics for MML [J]. In Proc. UML 2001
[83] Tony Clark, Andy Evans and Stuart Kent. The Meta-Modeling Language Calculus Foundation Semantics for UML [J]. In Proc. FASE 2001.
[84] Yeung WL. Checking consistency between UML class and state models based on CSP and B. JOURNAL OF UNIVERSAL COMPUTER SCIENCE [J] 10 (11): 1540-1558. 2004.
[85] Biju K. Appukuttan and Tony Clark and Andy Evans and Girish Maskeri and Paul Sammut and Laurence Tratt and James S. Willans. A pattern based approach to defining the dynamic infrastructure of UML 2.0 [Z]. Fourth workshop on Rigorous Object Oriented Methods (ROOM). March, 2002.
[86] Belkhouche Boumediene, Nix Anastasia. Formal analysis of UML-based designs [J]. Proceedings of the International Conference on Software Engineering Research and Practice, SERP'04. p220-226. 2004
[87] Than Xuede, Miao Huaikou, Liu Ling. Formalizing the semantics of UML statecharts with Z [J]. The Fourth International Conference on Computer and Information Technology (CIT 2004). p 1116-1121.2004.
[88] 蒋慧,林东,谢希仁. UML状态机的形式语义[J]. 软件学报, v 13, n 12, December, p 2244-2250. 2002.
[89] Ramalho Franklin, Robin Jacques, Schiel Ulrich. Concurrent transaction frame logic formal semantics for UML activity and class diagrams [J]. Electronic Notes in Theoretical Computer Science, v 95, p 83-109. May, 2004.
[90] Daniel, Pataricza, Andras. UML action semantics for model transformation systems Varro. Periodica Polytechnica [J], Electrical Engineering, v 47, n 3-4, p167-186. 2003.
[91] OMG, Semantics of a Foundational Subset for Executable UML Models Request For Proposal [EB/OL]. http://www.omg.org/cgi-bin/doc?ad/2005-4-2. April, 2005.
[92] OMG, Abstract Syntax Tree Metamodel [EB/OL]. http://doc.omg.org/admtf/2005-2-2. January,2005.
[93] OMG, MOF QVT final adopted specification [EB/OL]. http://www.omg.org/cgi-bin/doc?ptc/2005-11-01. January, 2006.
[94] UIUC Computer Science Laboratory. Maude [EB/OL]. http://maude.cs.uiuc.edu/. Dec.,2005.
[95] MOZ Group, The Mozart Programming System [EB/OL]. http://www.mozart-oz.org/. July,2004.