无法从模型中获取需求。我试过 getAppliedStereotypes() 但它仍然不起作用。代码如下:
[comment encoding = UTF-8 /]
[module maintest('http://www.eclipse.org/papyrus/sysml/1.4/SysML',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Activities',
'http://www.eclipse.org/papyrus/sysml/1.4/SysML/Requirements',
'http://www.eclipse.org/uml2/5.0.0/UML')/]
[template public maintestClass(aPackage : Package)]
[comment @main /]
[file ((aPackage.name+'.m'), false, 'UTF-8')]
0000
[for (r : Requirements::Requirement| aPackage.packagedElement->filter(Requirements::Requirement))]
11111
[/for]
[/file]
[/template]
另外,从这个页面http://techqa.info/programming/question/35093700/cannot-access-sysml-stereotypes-and-their-properties-in-acceleo,我可以通过 generate(re : Requirements:: Requirement)但它不能满足需要,因为我必须将模型中的一些节点值放到文档中,但是这个模板无法获取模型信息。或者也许有任何关于在模型中获取节点信息的解决方案,这些信息只得到需求?