我目前正在进行一个项目,该项目需要使用QVTO将一个模型转换为另一个模型。源模型是以表格形式表示的状态机。目标模型也是具有节点和边的statemachine。源模型只有领域元模型,但目标模型同时具有领域和符号元模型。符号元模型是http://www.eclipse.org/gmf/runtime/1.0.2/notation。我从源域模型转换到目标域模型,但是我的目标模型没有表示法模型。我想做的是从目标模型生成表示模型,并将其序列化到相同的xmi文件。我阅读了EMF和GMF的文档,并试图做到这一点,但我做不到。我也谷歌了,那也没用。目标模型的头部同时提到了域和符号元模型。为了清楚起见,请查看下面的xmi文件。
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n1="http://www.target.com/EMF/1/SimpleStatechart" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation">
<n1:statemachine xmi:id="_QvItUPMjEeS6mNxtIz5_4Q" s_name="Sensor">
<transitions xmi:type="n1:Transition" xmi:id="_RzqFYPMjEeS6mNxtIz5_4Q" body="" from="_RNakwPMjEeS6mNxtIz5_4Q" to="_RzcqAPMjEeS6mNxtIz5_4Q"/>
<transitions xmi:type="n1:Transition" xmi:id="_BJd-wAeuEeaf_-AtraPkfA" body="in_ISensor:Activate/out_ISensor.send(sensorReply());" from="_RzcqAPMjEeS6mNxtIz5_4Q" to="_7UnrQAetEeaf_-AtraPkfA"/>
<transitions xmi:type="n1:Transition" xmi:id="_DaWcQAeuEeaf_-AtraPkfA" body="in_InternalOptional:DetectedMovement/out_ISensor_NI.send(detectedMovement());" from="_7UnrQAetEeaf_-AtraPkfA" to="_7Q_IcAetEeaf_-AtraPkfA"/>
<transitions xmi:type="n1:Transition" xmi:id="_EWLLUAeuEeaf_-AtraPkfA" body="in_ISensor:Deactivate/out_ISensor.send(sensorReply());" from="_7UnrQAetEeaf_-AtraPkfA" to="_7OB7EAetEeaf_-AtraPkfA"/>
<transitions xmi:type="n1:Transition" xmi:id="_F9AmQAeuEeaf_-AtraPkfA" body="in_ISensor:Deactivate/out_ISensor.send(sensorReply());" from="_7Q_IcAetEeaf_-AtraPkfA" to="_7OB7EAetEeaf_-AtraPkfA"/>
<transitions xmi:type="n1:Transition" xmi:id="_GXe7wAeuEeaf_-AtraPkfA" body="in_InternalInevitable:Deactivated/
out_ISensor_NI.send(deactivated());" from="_7OB7EAetEeaf_-AtraPkfA" to="_RzcqAPMjEeS6mNxtIz5_4Q"/>
<states xmi:type="n1:InitialState" xmi:id="_RNakwPMjEeS6mNxtIz5_4Q" name="InitialState"/>
<states xmi:type="n1:BasicState" xmi:id="_RzcqAPMjEeS6mNxtIz5_4Q" name="Deactivated"/>
<states xmi:type="n1:BasicState" xmi:id="_7OB7EAetEeaf_-AtraPkfA" name="Deactivating" internal=""/>
<states xmi:type="n1:BasicState" xmi:id="_7Q_IcAetEeaf_-AtraPkfA" name="Triggered"/>
<states xmi:type="n1:BasicState" xmi:id="_7UnrQAetEeaf_-AtraPkfA" name="Activated"/>
</n1:statemachine>
<notation:Diagram xmi:id="_QvItUfMjEeS6mNxtIz5_4Q" type="ConformiqStateChart" element="_QvItUPMjEeS6mNxtIz5_4Q" measurementUnit="Pixel">
<children xmi:type="notation:Node" xmi:id="_RNwjAPMjEeS6mNxtIz5_4Q" type="2007" element="_RNakwPMjEeS6mNxtIz5_4Q">
<children xmi:type="notation:DecorationNode" xmi:id="_RNxKEPMjEeS6mNxtIz5_4Q" type="5022"/>
<styles xmi:type="notation:DescriptionStyle" xmi:id="_RNwjAfMjEeS6mNxtIz5_4Q"/>
<styles xmi:type="notation:FontStyle" xmi:id="_YRV_NegaEeSg-pTEoxDT6g" fontName="Segoe UI"/>
<styles xmi:type="notation:LineStyle" xmi:id="_RNwjA_MjEeS6mNxtIz5_4Q" lineColor="0"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_YRWmQegaEeSg-pTEoxDT6g" x="496" y="57"/>
</children>
<children xmi:type="notation:Node" xmi:id="_RzhigPMjEeS6mNxtIz5_4Q" type="2012" element="_RzcqAPMjEeS6mNxtIz5_4Q">
<children xmi:type="notation:DecorationNode" xmi:id="_RziJkvMjEeS6mNxtIz5_4Q" type="5017"/>
<children xmi:type="notation:DecorationNode" xmi:id="_RziJk_MjEeS6mNxtIz5_4Q" type="5018"/>
<children xmi:type="notation:DecorationNode" xmi:id="_RziJlPMjEeS6mNxtIz5_4Q" type="5019"/>
<children xmi:type="notation:DecorationNode" xmi:id="_RziwoPMjEeS6mNxtIz5_4Q" type="7001">
<styles xmi:type="notation:SortingStyle" xmi:id="_RziwofMjEeS6mNxtIz5_4Q"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_RziwovMjEeS6mNxtIz5_4Q"/>
</children>
<styles xmi:type="notation:DescriptionStyle" xmi:id="_RzhigfMjEeS6mNxtIz5_4Q"/>
<styles xmi:type="notation:FontStyle" xmi:id="_YRXNUOgaEeSg-pTEoxDT6g" fontName="Segoe UI"/>
<styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_RziJkPMjEeS6mNxtIz5_4Q"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_YRXNUugaEeSg-pTEoxDT6g" x="420" y="192" width="225" height="109"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_TAN_IPMjEeS6mNxtIz5_4Q" type="Note" fontName="Ubuntu" fontHeight="11" description="Describe the behavior of the
Sensor in this state machine." fillColor="0" transparency="0" lineColor="0" lineWidth="1">
<children xmi:type="notation:BasicDecorationNode" xmi:id="_TARCcPMjEeS6mNxtIz5_4Q" type="DiagramName">
<element xsi:nil="true"/>
</children>
<children xmi:type="notation:BasicDecorationNode" xmi:id="_TARpgPMjEeS6mNxtIz5_4Q" type="Description">
<element xsi:nil="true"/>
</children>
<styles xmi:type="notation:TextStyle" xmi:id="_TAN_IfMjEeS6mNxtIz5_4Q"/>
<styles xmi:type="notation:LineTypeStyle" xmi:id="_TAOmMPMjEeS6mNxtIz5_4Q"/>
<element xsi:nil="true"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_YRYbcOgaEeSg-pTEoxDT6g" x="708" y="36" width="293" height="98"/>
</children>
<children xmi:type="notation:Node" xmi:id="_7OMTIAetEeaf_-AtraPkfA" type="2012" element="_7OB7EAetEeaf_-AtraPkfA">
<children xmi:type="notation:DecorationNode" xmi:id="_7OOIUAetEeaf_-AtraPkfA" type="5017"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7OOIUQetEeaf_-AtraPkfA" type="5018"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7OOIUgetEeaf_-AtraPkfA" type="5019"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7OOIUwetEeaf_-AtraPkfA" type="7001">
<styles xmi:type="notation:SortingStyle" xmi:id="_7OOIVAetEeaf_-AtraPkfA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_7OOIVQetEeaf_-AtraPkfA"/>
</children>
<styles xmi:type="notation:DescriptionStyle" xmi:id="_7OMTIQetEeaf_-AtraPkfA"/>
<styles xmi:type="notation:FontStyle" xmi:id="_7OMTIgetEeaf_-AtraPkfA" fontName="Segoe UI"/>
<styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_7OMTIwetEeaf_-AtraPkfA"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_7OMTJAetEeaf_-AtraPkfA" x="552" y="756" width="225" height="109"/>
</children>
<children xmi:type="notation:Node" xmi:id="_7RAWkAetEeaf_-AtraPkfA" type="2012" element="_7Q_IcAetEeaf_-AtraPkfA">
<children xmi:type="notation:DecorationNode" xmi:id="_7RA9oAetEeaf_-AtraPkfA" type="5017"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7RA9oQetEeaf_-AtraPkfA" type="5018"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7RA9ogetEeaf_-AtraPkfA" type="5019"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7RA9owetEeaf_-AtraPkfA" type="7001">
<styles xmi:type="notation:SortingStyle" xmi:id="_7RA9pAetEeaf_-AtraPkfA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_7RA9pQetEeaf_-AtraPkfA"/>
</children>
<styles xmi:type="notation:DescriptionStyle" xmi:id="_7RAWkQetEeaf_-AtraPkfA"/>
<styles xmi:type="notation:FontStyle" xmi:id="_7RAWkgetEeaf_-AtraPkfA" fontName="Segoe UI"/>
<styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_7RAWkwetEeaf_-AtraPkfA"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_7RAWlAetEeaf_-AtraPkfA" x="324" y="588" width="225" height="109"/>
</children>
<children xmi:type="notation:Node" xmi:id="_7Uo5YAetEeaf_-AtraPkfA" type="2012" element="_7UnrQAetEeaf_-AtraPkfA">
<children xmi:type="notation:DecorationNode" xmi:id="_7Uo5ZQetEeaf_-AtraPkfA" type="5017"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7UpgcAetEeaf_-AtraPkfA" type="5018"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7UpgcQetEeaf_-AtraPkfA" type="5019"/>
<children xmi:type="notation:DecorationNode" xmi:id="_7UpgcgetEeaf_-AtraPkfA" type="7001">
<styles xmi:type="notation:SortingStyle" xmi:id="_7UpgcwetEeaf_-AtraPkfA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_7UpgdAetEeaf_-AtraPkfA"/>
</children>
<styles xmi:type="notation:DescriptionStyle" xmi:id="_7Uo5YQetEeaf_-AtraPkfA"/>
<styles xmi:type="notation:FontStyle" xmi:id="_7Uo5YgetEeaf_-AtraPkfA" fontName="Segoe UI"/>
<styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_7Uo5YwetEeaf_-AtraPkfA"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_7Uo5ZAetEeaf_-AtraPkfA" x="264" y="384" width="225" height="109"/>
</children>
<styles xmi:type="notation:DiagramStyle" xmi:id="_QvItUvMjEeS6mNxtIz5_4Q"/>
<edges xmi:type="notation:Edge" xmi:id="_Rzr6kPMjEeS6mNxtIz5_4Q" type="4002" element="_RzqFYPMjEeS6mNxtIz5_4Q" source="_RNwjAPMjEeS6mNxtIz5_4Q" target="_RzhigPMjEeS6mNxtIz5_4Q">
<children xmi:type="notation:DecorationNode" xmi:id="_RzshoPMjEeS6mNxtIz5_4Q" type="6002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_RzshofMjEeS6mNxtIz5_4Q" x="19" y="-12"/>
</children>
<styles xmi:type="notation:RoutingStyle" xmi:id="_X39ZA9krEeSNSYp_vqikKg" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_YRX0YugaEeSg-pTEoxDT6g" fontName="Segoe UI"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_YRX0Y-gaEeSg-pTEoxDT6g" points="[0, 0, 0, -94]$[0, 94, 0, 0]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_53a-Yfi3EeSDRc6--mGWrg" id="(0.48,1.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_YRX0ZOgaEeSg-pTEoxDT6g" id="(0.5,0.0)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_BJkFYAeuEeaf_-AtraPkfA" type="4002" element="_BJd-wAeuEeaf_-AtraPkfA" source="_RzhigPMjEeS6mNxtIz5_4Q" target="_7Uo5YAetEeaf_-AtraPkfA">
<children xmi:type="notation:DecorationNode" xmi:id="_BJkscAeuEeaf_-AtraPkfA" type="6002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_BJkscQeuEeaf_-AtraPkfA" x="-3" y="24"/>
</children>
<styles xmi:type="notation:RoutingStyle" xmi:id="_BJkFYQeuEeaf_-AtraPkfA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_BJkFYgeuEeaf_-AtraPkfA" fontName="Segoe UI"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_BJkFYweuEeaf_-AtraPkfA" points="[-39, 35, 117, -137]$[-159, 118, -3, -54]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_BJnIsAeuEeaf_-AtraPkfA" id="(0.17777777777777778,0.6788990825688074)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_DaXDUAeuEeaf_-AtraPkfA" type="4002" element="_DaWcQAeuEeaf_-AtraPkfA" source="_7Uo5YAetEeaf_-AtraPkfA" target="_7RAWkAetEeaf_-AtraPkfA">
<children xmi:type="notation:DecorationNode" xmi:id="_DaXqYAeuEeaf_-AtraPkfA" type="6002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_DaXqYQeuEeaf_-AtraPkfA" x="29" y="6"/>
</children>
<styles xmi:type="notation:RoutingStyle" xmi:id="_DaXDUQeuEeaf_-AtraPkfA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_DaXDUgeuEeaf_-AtraPkfA" fontName="Segoe UI"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_DaXDUweuEeaf_-AtraPkfA" points="[4, 22, 17, -161]$[65, 129, 78, -54]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_DaY4gAeuEeaf_-AtraPkfA" id="(0.5555555555555556,0.7981651376146789)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_EWLyYAeuEeaf_-AtraPkfA" type="4002" element="_EWLLUAeuEeaf_-AtraPkfA" source="_7Uo5YAetEeaf_-AtraPkfA" target="_7OMTIAetEeaf_-AtraPkfA">
<children xmi:type="notation:DecorationNode" xmi:id="_EWLyZAeuEeaf_-AtraPkfA" type="6002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_EWLyZQeuEeaf_-AtraPkfA" y="40"/>
</children>
<styles xmi:type="notation:RoutingStyle" xmi:id="_EWLyYQeuEeaf_-AtraPkfA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_EWLyYgeuEeaf_-AtraPkfA" fontName="Segoe UI"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_EWLyYweuEeaf_-AtraPkfA" points="[27, 27, -323, -315]$[335, 351, -15, 9]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_EWNnkAeuEeaf_-AtraPkfA" id="(0.10666666666666667,0.7522935779816514)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_EWOOoAeuEeaf_-AtraPkfA" id="(0.1688888888888889,0.9174311926605505)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_F9BNUAeuEeaf_-AtraPkfA" type="4002" element="_F9AmQAeuEeaf_-AtraPkfA" source="_7RAWkAetEeaf_-AtraPkfA" target="_7OMTIAetEeaf_-AtraPkfA">
<children xmi:type="notation:DecorationNode" xmi:id="_F9B0YAeuEeaf_-AtraPkfA" type="6002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_F9B0YQeuEeaf_-AtraPkfA" y="40"/>
</children>
<styles xmi:type="notation:RoutingStyle" xmi:id="_F9BNUQeuEeaf_-AtraPkfA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_F9BNUgeuEeaf_-AtraPkfA" fontName="Segoe UI"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_F9BNUweuEeaf_-AtraPkfA" points="[54, 21, -125, -49]$[165, 67, -14, -3]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_F9DpkAeuEeaf_-AtraPkfA" id="(0.76,0.6605504587155964)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_F9DpkQeuEeaf_-AtraPkfA" id="(0.06222222222222222,0.3119266055045872)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_GXfi0AeuEeaf_-AtraPkfA" type="4002" element="_GXe7wAeuEeaf_-AtraPkfA" source="_7OMTIAetEeaf_-AtraPkfA" target="_RzhigPMjEeS6mNxtIz5_4Q">
<children xmi:type="notation:DecorationNode" xmi:id="_GXfi1AeuEeaf_-AtraPkfA" type="6002">
<layoutConstraint xmi:type="notation:Location" xmi:id="_GXfi1QeuEeaf_-AtraPkfA" y="40"/>
</children>
<styles xmi:type="notation:RoutingStyle" xmi:id="_GXfi0QeuEeaf_-AtraPkfA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_GXfi0geuEeaf_-AtraPkfA" fontName="Segoe UI"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_GXfi0weuEeaf_-AtraPkfA" points="[-10, -54, 76, 427]$[-74, -461, 12, 20]"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_GXhYAAeuEeaf_-AtraPkfA" id="(0.5955555555555555,0.8165137614678899)"/>
</edges>
</notation:Diagram>
</xmi:XMI>
从转换开始,我有了目标模型的顶部部分,直到n1:StateMachine,这是域模型。从N1:StateMachine,在wards上,上面部分的图形表示继续,这是我想要生成的。如何为从模型转换中获得的域模型生成表示模型?
我不熟悉QVT的EMF资源处理,但我尝试尽我所能描述在EMF-和GMF级别上需要做什么。
从技术上讲,表示模型与您已经成功生成的域模型是同一种EMF模型,只是它符合另一个名为http://www.eclipse.org/GMF/runtime/1.0.2/notation
的元模型,并可从相应的GMF插件org.eclipse.GMF.runtime.notation
中获得。
您必须使您的转换知道这个元模型,然后您可以生成与原始模型类似的它的实例。转换需要基于表示模型的定义,将表示模型与目标域模型元素连接起来;但这与您的域模型已经支持的交叉引用处理是相同的。
最后,为了将目标和符号模型序列化到同一个xmi文件中,您必须将两者添加到同一个EMF资源中,如下所示:
EObject targetDomain = ...; //root element of the target domain model
EObject targetNotation = ...; //root element of the target notation model
EList<EObject> contents = targetResource.getContents();
contents.add(targetDomain);
contents.add(targetNotation);
这些步骤一起应该允许您相应地生成表示法模型。
我正在尝试使用eclipse gmf创建一个基于uml模型的图形编辑器, 为此,我基于我的uml模型创建了一个.gnemodel文件,但在生成的.ecore文件中没有关联
生成数据库中所有表的模型文件,如果设置了include或exclude,则按照相应规则过滤表。 必选参数: -namespace 生成的Model所在命名空间 可选参数: -database 数据库名,不传则取连接池默认配置的库名 -baseClass 生成时所继承的基类(自行实现务必继承框架的模型类),默认Imi\Model\Model,可选 -poolName 连接池名称,不传则取默认连接池
我一直在努力寻找一些可以从java中的yang模型生成示例xml/json数据的工具,例如对于xsd,有一些工具可以生成示例xml。 我试过平:1。它是用Python编写的。2.转换后,它给了我yin格式,这是相当于yang规范的xml。例如,对于以下阳代码,如果我使用pyang将其转换为阴: 这就是我得到的- 相反,我想要的是 这样我就可以得到xml,输入详细信息并根据相同的数据进行验证。
监督学习的任务就是从数据中学习一个模型(也叫分类器),应用这一模型,对给定的输入X预测相应的输出Y。这个模型的一般形式为决策函数Y=f(X)或者条件概率分布P(Y|X)。 ** 决策函数Y=f(X):**你输入一个X,它就输出一个Y,这个Y与一个阈值比较,根据比较结果判定X属于哪个类别。例如两类(w1和w2)分类问题,如果Y大于阈值,X就属于类w1,如果小于阈值就属于类w2。这样就得到了该X对应的
本文向大家介绍生成式模型、判别式模型相关面试题,主要包含被问及生成式模型、判别式模型时的应答技巧和注意事项,需要的朋友参考一下 https://github.com/imhuay/Algorithm_Interview_Notes-Chinese/blob/master/A-机器学习/A-机器学习基础.md#生成模型与判别模型 生成式模型(generative model)会对x和y的联合分布p(
本文向大家介绍生成模型和判别模型的区别相关面试题,主要包含被问及生成模型和判别模型的区别时的应答技巧和注意事项,需要的朋友参考一下 参考回答: 生成模型是先从数据中学习联合概率分布,然后利用贝叶斯公式求得特征和标签对应的条件概率分布。判别模型直接学习条件概率分布,直观的输入什么特征就预测可能的类别。