MDA为软件的自动化构造提供了一种良好的途径,但是MDA更多地关注PIM到PSM的转换,却忽视了需求阶段对PIM精确性的影响。本文针对这种问题,首先对MDA的基本过程进行改进,提出对需求进行必要的形式化描述的思路,使得需求模型到PIM的转换变得更为容易,从而达到增强PIM精确性的目的;其次,通过对三种形式化语言的对比研究,发现B语言在需求模型的表示及转换方面具有优势,并结合例子展示了如何使用B语言对软件需求进行形式化描述;最后,本文结合模型转换框图,给出了B方法和类图的ecore元模型的图形化描述,进一步给出了用B语言描述的需求模型到PIM的基本转换规则,并借助JavaCC、JJTree和ATL插件等工具实现了需求模型到PIM的转换。
MDA provides a nice approach for the automatic construction of software, but pays more attention to the transformation from PIM to PSMs, and neglects that the stage of requirement which affects the accuracy of PIM. In view of such problems, firstly, the paper improves the basic process of MDA, puts forward to the idea that requirements are necessary to be formally described, then the transformation from the requirement model to PIM becomes easier, thus the intention to enhance the accuracy of PIM is achieved. Secondly, by means of the contrast research to three formal languages, the advantages that the B language has in the expression and transformation aspects of the requirement model are found, and the example for how to use the B language to formally describe software requirements is shown. Finally, by combining the framework of model transformation, the graphic descriptions for the B method and the Class Diagram ecore metamodel are given, and further the basic transformation rule from the requirement model described by the B Language to PIM is offered. With the help of tools such as JavaCC, JJTree and ATL plugin, the transformation from the requirement model to PIM is implemented.