我可以使用 Eclipse-EMF 的内部数据结构吗?
在EMF中,用户可以绘制UML图,并且该UML模型可以转换为Java代码。据我所知,EMF 有自己的内部数据结构来捕获用户绘制的 UML 模型。我想做的是通过编码而不是通过绘图来制作UML模型,即通过使用EMF的内部数据结构来表示UML元模型(类、包、属性等)。就像,
UmlClass myClass = new UmlClass();
UmlAttribute myAttr = new UmlAttribute();
myClass.addAttribute(myAttr);
这可能吗(甚至通过 EMF 也无法实现)?不管怎样,我想使用一个健壮的数据结构来准确地反映 OMG 的标准 UML 规范。
提前致谢。
In EMF, a user can draw UML diagram and that UML model can be transformed into Java code. As far as I know EMF has its own internal data structure to capture the UML model user draws. And what I want to do is to make UML model by coding, not by drawing, i.e., by using EMF's internal data structure representing UML metamodel(Class, Package, Attribute, etc). Like,
UmlClass myClass = new UmlClass();
UmlAttribute myAttr = new UmlAttribute();
myClass.addAttribute(myAttr);
Is this possible(not even by EMF)? Anyway, I want to use a robust data structure that exactly reflects OMG's standard UML specification.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
EMF 是一个建模框架,旨在支持一般建模,而不仅仅是 UML。
如果您特别需要 UML,那么确实有这样一个构建在 EMF 之上的实现。查看 UML2。
EMF is a modelling framework designed to support modelling in general, not just UML.
If it is UML in particular you're after, there is indeed such an implementation built on top of EMF. Check out UML2.
没有完全反映 OMG 规范的类,但 EMF ECore 是模型的元模型。因此,您可以使用 EMF ECore 做您想做的事情。 http://www.eclipse.org/modeling/emf/ 有很多文档docs/#overviews 是一本很棒的书。该链接包含图片和该书的链接。
一个例子:
There are no classes exactly reflecting the OMG specification, but EMF ECore is a meta model for models. Therefore you can do what you want using EMF ECore. There is lots of doc at http://www.eclipse.org/modeling/emf/docs/#overviews and an excellent book. The link has a picture and link to the book.
An example: