首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >'org.modelio.metamodel.impl.uml.behavior.activityMo‘对象没有属性“getOwnedNode”

'org.modelio.metamodel.impl.uml.behavior.activityMo‘对象没有属性“getOwnedNode”
EN

Stack Overflow用户
提问于 2020-02-12 14:45:31
回答 1查看 53关注 0票数 0

我使用脚本来查找Activity Diagram中的所有路径。要做到这一点,我使用Modelio 4.0

我把下面的脚本放在宏中。

脚本

代码语言:javascript
复制
## return first initial node in the selected activity
def getInitialPoint(act):
    for node in act.getOwnedNode():
        if isinstance(node, InitialNode):
            return node

## parcours activity nodes
def getPaths(currentPath, currentNode): 
    for outgoing in currentNode.getOutgoing():
        node = outgoing.getTarget()
        if isinstance(node, ActivityFinalNode):
            paths.append(currentPath)
            return;
        elif  isinstance(node, DecisionMergeNode):
            getPaths(currentPath, node)  
        else:           
            getPaths(currentPath + " - "  + node.getName(), node) 

 ##Init
init = getInitialPoint(elt)
currentPath = init.getName()
global paths
paths = []
getPaths(currentPath, init)

 ##Print founded paths
for p in paths:
    print p

误差

但是,当我启动宏时,我将面临以下错误:

代码语言:javascript
复制
AttributeError: 'org.modelio.metamodel.impl.diagrams.ActivityDiagra' object has no attribute 'getOwnedNode' in <script> at line number 20
Traceback (most recent call last):
File "<script>", line 20, in <module>
File "<script>", line 3, in getInitialPoint
AttributeError: 'org.modelio.metamodel.impl.diagrams.ActivityDiagra' object has no attribute 'getOwnedNode'

你能帮我修一下吗?谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-12 15:38:04

实际上,elt是选定的元素。如果从活动元素(而不是Activity )启动该脚本,则该脚本可以工作。

最好的

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60190905

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档