根据 EObject 的内容将其保存在不同的资源中
我正在使用 EMF 模型,它由多个命令
组成。
每个命令都有一个名为 subscribed
的布尔属性,由我的应用程序处理。根据此属性的值,我想将命令保存在文件“已提交”或文件“toSubmit”中。我怎样才能做到这一点?
由于要提交的元素可以引用已提交的元素,因此我打算将它们放在同一资源集中的两个资源中......这足以交叉引用吗?
此外,我还想要一个“完整”文件,其中包含要提交的元素和已提交的元素......
I'm working with an EMF model, which is composed of several Commands
.
Each command has a boolean attribute named submitted
which is handled by my application. According to the value of this attribute, I want to save the Command in file "submitted" or in file "toSubmit". How can I do that?
Since elements to be submitted can refer to submitted elements, I was planning to put them in two resources of the same resourceSet... is this enough for cross-references?
Additionally, I would also like to have a "complete" file, which comprehend both element to submit and those already submitted...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还有一件事:为了交叉引用,除了保存到同一资源集中之外,引用的元素还必须保存在资源中。
换句话说,您必须根据依赖关系对资源的保存进行排序:首先必须保存资源(不引用其他资源),然后保存引用者。
There is one more thing: in order to cross-reference, in addition to being saved into the same resourceset the referenced elements have to be saved in a resource already.
In other words, you have to order the saving of the resources wrt the dependencies: first the resource has to be saved, that is not refering to the other, and then the referrer.