将使用Papyrus创建的UML类图转换为.ecore文件 [英] Converting a UML class diagram created using Papyrus into an .ecore file

查看:235
本文介绍了将使用Papyrus创建的UML类图转换为.ecore文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我使用eclipse所做的事情:

  1. 创建一个新的Papyrus项目
  2. 在Papyrus中创建一个类图
  3. 创建一个新的EMF空项目
  4. 使用EMF生成器模型将我的.uml文件(由Papyrus创建)转换为.ecore文件

现在我想用Java做到这一点.我找到了在此处发布有人正在使用XSD进行操作.除了UML,我想做同样的事情. User565300 使用的是Xsd2Ecore,但我找不到Uml2Ecore.你们知道什么蚀用于转换UML文件吗?

解决方案

我最近碰巧遇到了这个问题,并找到了一个简单的解决方案,以为我会分享.

除了Papyrus,我还安装了Obeo UML Designer 6.1插件.

1)UML Designer添加了建模项目"的概念.从文件"->新建"子菜单中创建一个.

2)找到要转换为ECore的Papyrus模型.通常,在其根节点下,您将看到两个标记为符号"和"uml"的子级.标记为"uml"的节点对应于名为"model.uml"的文件.单击它,然后将文件路径复制到剪贴板.

3)返回您的建模项目.将剪贴板粘贴到其中,您应该会看到"model .uml"出现.打开它.

4)打开根资源节点"并选择其单个子节点,以下将其称为根模型节点". -这应该是一个UML模型对象,代表要移植的模型的根. -如果看到其他内容,请检查是否覆盖了先前存在的文件或复制了错误的模型源.

5)确保您位于建模"透视图上,并查看"UML编辑器"菜单.在根模型节点仍突出显示的情况下,导航到转换为"->"Ecore模型..."

6)完成向导.更正所有错误,并在必要时重新设置.

Obeo Designer是GitHub上的一个开放源代码项目,因此我想可以将Manifest文件分开以识别"To Ecore ..."的菜单贡献,然后通过GitHub找到实际的源代码./p>

Here is what I do using eclipse :

  1. Create a new Papyrus project
  2. Create a class diagram in Papyrus
  3. Create a new EMF empty project
  4. Use the EMF Generator Model to convert my .uml file (created with Papyrus) into an .ecore file

Now i would like to do that in Java. I found a post here where someone is doing it from XSD. I would like to do the same thing but from UML. User565300 is using something called Xsd2Ecore but I couldn't find a Uml2Ecore. Do you guys know what eclipse is using to convert UML file ?

解决方案

I happened to bump into this problem very recently and found an easy solution so thought I would share.

In addition to Papyrus, I have the Obeo UML Designer 6.1 plugin installed.

1) UML Designer adds a concept of a "Modeling Project". Create one from the File->New submenu.

2) Find the Papyrus model you want to convert to ECore. Under its root node you will generally see two children labeled "notation" and "uml". The node labeled "uml" corresponds to a file called "model.uml". Click it and copy the file path to the clipboard.

3) Return to your Modeling Project. Paste your clipboard into it, and you should see "model .uml" appear. Open it.

4) Open the "root resource node" and select its single child, which will be referred to below as the "root model node". -- This should be a UML model object representing the root of the model you are porting. -- If you see something else, check whether you failed to overwrite a pre-existing file or copied the wrong model source .

5) Make sure you are on the Modeling perspective and see the "UML Editor" menu. With the root model node still highlighted, navigate to "Convert To" -> "Ecore Model..."

6) Complete the wizard. Correct any errors and reepat if necessary.

The Obeo Designer is an open source project available on GitHub, so I imagine its possible to pick apart the Manifest file to identify the menu contribution for "To Ecore..." and then locate the actual source code through GitHub.

这篇关于将使用Papyrus创建的UML类图转换为.ecore文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆