我有一个从一个模型到两个模型的ATL转换
-- @nsURI WFG=http://workflowgraph/1.0.3
-- @nsURI SYS=http://systembehavior/1.0
-- @nsURI PEER=http://peerbehavior/1.0
module WFG2System;
create OUT:SYS, OUT2:PEER from IN:WFG;模型SYS的一些对象具有对模型对等体的对象的引用。在ATL run-configuration中,我检查了InterModelReferences,并填写了将要生成的文件的路径。因此,自动测试语言应该知道所生成模型的fileName和路径。转换起作用了,InterModelReferences起作用了。但并不是很好。在'href‘字段中,不是引用模型的路径,而是字符串"new- model ",如下所示:
<systembehavior:SYS xmlns:PEER="http://peerbehavior/1.0" xmlns:SYS="http://systembehavior/1.0">
<transitions xsi:type="systembehavior:Send">
<source href="new-model#Participant_1"/>
<target href="new-model#Participant_5"/>
</transitions>而不是be:
<systembehavior:SYS xmlns:PEER="http://peerbehavior/1.0" xmlns:SYS="http://systembehavior/1.0">
<transitions xsi:type="systembehavior:Send">
<source href="./mymodel.peer#Participant_1"/>
<target href="./mymodel.peer#Participant_5"/>
</transitions>为什么没有自动写入第二个生产模型的路径?我的实际解决方案是使用文本编辑器手动更改href属性,这样我就可以在eclipse上使用XMI编辑器打开模型文件,然后引用就可以正常工作。谢谢
====== EDIT发现另一个问题(解决方案如下)======
如果我从模型中检索java对象SYS,使用:
ResourceSet resSet = new ResourceSetImpl();
Resource resource = resSet.getResource(URI.createURI(PartesConf.getString("outputPath")+"sys.systembehavior"), true);
SystemBehavior sys = ((SystemBehavior) resource.getContents().get(0));同级模型中引用的同级是空的同级(所有属性都为null的同级)

发布于 2014-04-04 07:27:58
检索被引用对象的解决方案是使用绝对路径来检索资源。有关更多详细信息,请查看this discussion。被引用的对象并不总是被创建为java对象,但EMF将在运行时解析该引用。
我仍然有错误的href属性的问题
https://stackoverflow.com/questions/22774164
复制相似问题