使用 Eclipse EMF 进行双向 M2M 转换
我想做双向 Model2Model 转换。两种型号均基于 EMF/eCore。实际上,我更希望一个模型是另一个模型的可编辑视图。
我有什么选择? 有哪些工具和转换语言可用,它们有哪些限制?
I would like to do bidirectional Model2Model transformations. Both models are EMF / eCore based. Actually I would prefer that one model is an editable view on the other.
What are my options?
Which tools and tranformation languages are avaiable and what are their restrictions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
M2M 是最难的。工业强度工具很少见,学术界的东西很多。如果您对 M2M 语言一心一意,请考虑 ATL,它也应该支持 ecore。否则你可以看看 Xtend,它是为模型到文本而设计的,但你可以滥用它,它应该比普通的 java 更舒服。如果您想进行研究,请查看此处的基于 Scala 的转换
http://metrikforge.informatik.hu-berlin.de/attachments/download/193/george_wider_scheidgen_ICMT_2012.pdf
M2M are the hardest. Industries strength tools are rare, lots of academia stuff. If you're dead set on a M2M language, look into ATL which should also support ecore. Otherwise you can look at Xtend, which was made for model to text but you can abuse it and it should be more comftable than plain java. If your into research look at Scala based transformations here
http://metrikforge.informatik.hu-berlin.de/attachments/download/193/george_wider_scheidgen_ICMT_2012.pdf
EMF 的转换工具比您想象的要多,有点疯狂...
对于模型不太相似的元模型到元模型的转换:
如果元模型非常相似,并且您只需要调整一些东西,那么就有针对该类型的迁移/更新的工具:
您始终可以使用 EMF Java API 直接操作元模型和模型。
我要补充一点,如果您正在做任何真正的 EMF 工作,您将需要获取并阅读 EMF:Eclipse 建模框架。它也可在 Safari 中使用。我强烈推荐 Safari,每月只需 39 美元,您就可以获得几乎所有您可以使用的开发电子书。
There are more transformation tools than you can imagine for EMF, its kind of crazy...
For metamodel to metamodel transformation where the models are not very similar:
If the metamodels are very similar and you only need to tweak some things then there are tools targeted that type of migration/updating:
You can always directly manipulate the metamodel and model using the EMF Java APIs as well.
I'll add, if you are doing any real EMF work you will need to get and read EMF: Eclipse Modeling Framework. It's available in Safari also. I highly recommend Safari, for $39 a month you get almost every development ebook you could ever use.
如果您坚持进行双向 M2M 转换(所谓的 Bxs),那么请知道有一个活跃的研究人员社区正在更新该 wiki:http://bx-community.wikidot.com。
如果你访问它,你会发现他们列出了一堆适合 Bx 转换的工具 http://bx- Community.wikidot.com/latedtools。
我过去使用过 ECHO,它提供了基于 KodKod 约束求解器的 QVT-R 实现。
绝对值得一试。
If you insist on doing bidirectional M2M transformations, (so-called Bxs), then know that there is an active researcher's community updating that wiki : http://bx-community.wikidot.com.
If you visit it, you will find that they list a bunch of tool suitable for Bx transformations http://bx-community.wikidot.com/relatedtools.
I used ECHO in the past which provides an implementation of QVT-R based on the KodKod constraints solver.
It's definitely worth giving it a try.
既然您特别要求双向模型转换,我必须说您别无选择。为了更清楚地说明,除了您从 Ed Willink 获得的答案之外,现有的 M2M 转换语言 (AFAIK) 都不支持双向模型转换。
如果您仍然对此感兴趣,那么 QVTr 和 QVTc 执行引擎的工作开始看起来很有希望:QVTd 项目。
Since you specifically asked for bi-directional model transformations, I must say that you have no options. To make it claer, adding to the answer you got form Ed Willink, none of the existing M2M transformation languages (AFAIK) supports bi-directional model transformations.
Work on a QVTr and QVTc execution engine is starting to look promising if you are still interested in this: QVTd Project.