模型驱动工程中,模型合成技术能降低软件复杂度,提高开发效率和质量.提出基于语义和结构进行模型匹配并按规则进行合成的方法,首先建立形式化的中间数据模型,用于统一模型合成过程中的模型表示方式;然后结合元素名称设计语义相似度函数,并基于元素属性和元素之间的关系计算结构相似度,提高模型匹配精度;根据相似度值确定匹配元素,对于完全匹配和完全不匹配的元素,自动确定合成规则,对于相似元素对,经过少量的人工分析可判定合成规则;根据合成规则能自动产生合成模型;设计校验规则和验证框架检验合成模型的正确性和一致性.最后用实例说明了方法的有效性和可行性.
Model composition technology can reduce software complexity and improve development efficiency and quality in Model Driven Engineering. This paper puts up a semantic and structure-based model matching and rule-based model composition method. Firstly a formal middle data model is set up to unify the representation of various models in model composition process. Then seman- tic similarity function is designed according to element names, and structure similarity is calculated based on element attributes and re- lationships to raise the accuracy of model matching. Matching elements are determined from the similarity value. The composition rules are automatically determined for the totally matched and totally unmatched elements. For similar elements, the composition rules can be determined after a small amount of manual analysis. According to the composition rules the composition model can be auto- matically generated. Validation rules and validation framework are designed for testing the correctness and consistency of composition model. Finally an example is presented to illustrate the effectiveness and feasibility.