0

My application is using a model base on an xsd that have been converted to an ecore before generation of the java classes. One of my team member modified the .ecore metamodel in a previous version ,one attribute that used to be generated. He modified the attribute name but not the Extended MetaData specifying the element name used for xml persistance.

<eStructuralFeatures xsi:type="ecore:EReference" name="javaDocsAndUserApi" upperBound="-1"
    eType="#//JavaDocsAndUserApi" containment="true" resolveProxies="false">
  <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
    <details key="kind" value="element"/>
    <details key="name" value="docsAndUserApi"/>
  </eAnnotations>
</eStructuralFeatures>

so we have an attribute name which is javaDocsAndUserApi and the persisted element named docsAndUserApi, and of course if I create change the attribute in the xsd to be named javaDocsAndUserApi, the ecore transformation will generate a metadata name javaDocsAndUserApi as well, which will break compatibility with previously persisted models.

I have looked at xsd authoring guide to find an ecore:som_attribute that would allow me to specify which key to use in the xsd to force the metadata to be named docsAndUserApi during the xsd to ecore transformation but did not find anything. Does anybody have an idea to help me?

Thank you.

4

1 回答 1

1

毕竟,处理不断发展的(元)模型并不容易。它基本上归结为将数据从一种格式(符合一个 Ecore 模型)迁移到另一种格式(符合另一个 Ecore 模型)。

您可以应用ATLAMW等模型转换技术。这允许您连接(编织)两个 Ecore(元)模型(m1 和 m2)并自动生成将数据从格式 m1 转换为格式 m2 的代码,反之亦然。(有关此主题的一些非常有趣的研究论文,请参见此处。)

一种实用的方法可能是使用 EMF 手动实现模型转换。由于模型之间的更改很简单,因此实施起来应该不会太难。

于 2009-10-02T11:58:47.677 回答