Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Loop Node and Conditional Node
Loop Node and Conditional Node [message #476278] Sun, 07 October 2007 10:32 Go to next message
kevin is currently offline kevinFriend
Messages: 22
Registered: July 2009
Junior Member
Hi,
I would like to ask questions about loop and conditional nodes in activity.

1. It seems that there is no special test/body sections in conditional
node. If I try to create a test section, I can only add edges and
actions in the conditional node and set them as the test section in
clause. The same thing happens to loop node.

2. In loop node there is a loop variable, but if I try to save the
model, an exception about this loop variable occurs: it has no owner.
But everything I have added to the loop node should have gotten its
parent as owner automatically. How to solve this problem?

Does anybody know these?

Gruß
Zengyu
Re: Loop Node and Conditional Node [message #476360 is a reply to message #476278] Thu, 11 October 2007 03:02 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
"Zengyu Lu" <sizeluuu@gmail.com> wrote in message
news:feacks$41o$1@build.eclipse.org...
> Hi,
> I would like to ask questions about loop and conditional nodes in
> activity.
>
> 1. It seems that there is no special test/body sections in conditional
> node. If I try to create a test section, I can only add edges and
> actions in the conditional node and set them as the test section in
> clause. The same thing happens to loop node.

The conditional node consists of clauses which in turn consist of tests
(ExecutableNode) and bodies (ExecutableNode).
Loop node has tests and bodyParts.
You should be able to add any subtype of executable node to the tests. It
seems to work in the editor.
Are you first creating clauses' with tests?

Can you provide a JUnit test or exact scenario that fails? I'm not sure I
see the issue.


>
> 2. In loop node there is a loop variable, but if I try to save the
> model, an exception about this loop variable occurs: it has no owner.
> But everything I have added to the loop node should have gotten its
> parent as owner automatically. How to solve this problem?

Can you provide a stack trace for the error?

>
> Does anybody know these?
>
> Gru
Re: Loop Node and Conditional Node [message #476388 is a reply to message #476360] Thu, 11 October 2007 23:21 Go to previous messageGo to next message
kevin is currently offline kevinFriend
Messages: 22
Registered: July 2009
Junior Member
Hi,
Thanks for your answer.


James Bruck wrote:

>> The conditional node consists of clauses which in turn consist of tests
>> (ExecutableNode) and bodies (ExecutableNode).
>> Loop node has tests and bodyParts.
>> You should be able to add any subtype of executable node to the tests. It
>> seems to work in the editor.
>> Are you first creating clauses' with tests?

>> Can you provide a JUnit test or exact scenario that fails? I'm not sure I
>> see the issue.


I just want to find out the test/body sections in .uml file, like:

<clause>
...
<body xmi:type="UML:ReadVariableAction"
xmi:id="condbody_ReadVariableAction2">
<result xmi:idref="loopbody_output"/>
<variable xmi:idref="loop_element"/>
</body>
<test xmi:type="UML:ReadVariableAction"
xmi:id="condtest_ReadVariableAction_count">
<variable xmi:idref="loop_count"/>
<result xmi:idref="condtest_OutputPin_count"/>
<outgoing xmi:idref="condtest_cf2"/>
</test>
...
</clause>

It seems that there is another format in it, like:

<clause xmi:id="_Dxwa4HhMEdy5av3IsZJsmg" test="_U279sHhNEdy5av3IsZJsmg"
body="_CS3lkHhNEdy5av3IsZJsmg _SGqOcHhNEdy5av3IsZJsmg"/>

There is no difference between two formats. But I still need to know
whether it is possible or not, the first format to create.

By the way, how to create xmi:id with the name of Node, like
xmi:id="ReadSelfAction" ?

>>
>> 2. In loop node there is a loop variable, but if I try to save the
>> model, an exception about this loop variable occurs: it has no owner.
>> But everything I have added to the loop node should have gotten its
>> parent as owner automatically. How to solve this problem?

> Can you provide a stack trace for the error?

The stack trace:

org.eclipse.emf.ecore.xmi.DanglingHREFException: The object
'org.eclipse.uml2.uml.internal.impl.OutputPinImpl@178e131 (name: <unset>,
visibility: <unset>) (isLeaf: false) (ordering: FIFO, isControlType:
false) (isOrdered: false, isUnique: true, isControl: false)' is not
contained in a resource.
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.handleDanglingH REF(XMLHelperImpl.java:759)
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getURIFragment( XMLHelperImpl.java:730)
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getIDREF(XMLHel perImpl.java:752)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveIDRefMany(XML SaveImpl.java:1934)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1286)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1083)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:956)
at
org.eclipse.uml2.uml.editor.presentation.UMLEditor$14.execut e(UMLEditor.java:1380)
at
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:101)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1797)
at
org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:113)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:113)


Gruss

Zengyu
Re: Loop Node and Conditional Node [message #476390 is a reply to message #476388] Mon, 15 October 2007 15:13 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Zengyu,

Those features that are not directly owned but defined somewhere in the
model and referenced will be serialized like this ...
<node xmi:type="uml:LoopNode" xmi:id="_RtcBQHsuEdyZsKXxkoCTuw"
name="LoopNode" bodyPart="_6IAyoHsuEdyZsKXxkoCTuw"
test="_6IAyoHsuEdyZsKXxkoCTuw"/>


The actual item being referred to would be serialized like this ..

<node xmi:type="uml:ReadVariableAction" xmi:id="_6IAyoHsuEdyZsKXxkoCTuw"
name="ReadVariableAction"/>

I don't believe the first xml sample that you have listed below is properly
formatted (although possibly meaning the same thing as above)



To get and set the id's in a more friendly format you can try
UML2Util.getXMIIdentifier();

Have a look at ConvertModelAction to see how this is used.

- James.


"Zengyu Lu" <sizeluuu@gmail.com> wrote in message
news:182a74b9a29fd9e3b43935b4fce24528$1@www.eclipse.org...
> Hi,
> Thanks for your answer.
>
> James Bruck wrote:
>
>>> The conditional node consists of clauses which in turn consist of tests
>>> (ExecutableNode) and bodies (ExecutableNode).
>>> Loop node has tests and bodyParts.
>>> You should be able to add any subtype of executable node to the tests.
>>> It seems to work in the editor.
>>> Are you first creating clauses' with tests?
>
>>> Can you provide a JUnit test or exact scenario that fails? I'm not sure
>>> I see the issue.
>
>
> I just want to find out the test/body sections in .uml file, like:
>
> <clause>
> ..
> <body xmi:type="UML:ReadVariableAction"
> xmi:id="condbody_ReadVariableAction2">
> <result xmi:idref="loopbody_output"/>
> <variable xmi:idref="loop_element"/>
> </body>
> <test xmi:type="UML:ReadVariableAction"
> xmi:id="condtest_ReadVariableAction_count">
> <variable xmi:idref="loop_count"/>
> <result xmi:idref="condtest_OutputPin_count"/>
> <outgoing xmi:idref="condtest_cf2"/>
> </test>
> ..
> </clause>
>
> It seems that there is another format in it, like:
> <clause xmi:id="_Dxwa4HhMEdy5av3IsZJsmg" test="_U279sHhNEdy5av3IsZJsmg"
> body="_CS3lkHhNEdy5av3IsZJsmg _SGqOcHhNEdy5av3IsZJsmg"/>
>
> There is no difference between two formats. But I still need to know
> whether it is possible or not, the first format to create.
>
> By the way, how to create xmi:id with the name of Node, like
> xmi:id="ReadSelfAction" ?
>
>>>
>>> 2. In loop node there is a loop variable, but if I try to save the
>>> model, an exception about this loop variable occurs: it has no owner.
>>> But everything I have added to the loop node should have gotten its
>>> parent as owner automatically. How to solve this problem?
>
>> Can you provide a stack trace for the error?
>
> The stack trace:
>
> org.eclipse.emf.ecore.xmi.DanglingHREFException: The object
> 'org.eclipse.uml2.uml.internal.impl.OutputPinImpl@178e131 (name: <unset>,
> visibility: <unset>) (isLeaf: false) (ordering: FIFO, isControlType:
> false) (isOrdered: false, isUnique: true, isControl: false)' is not
> contained in a resource.
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.handleDanglingH REF(XMLHelperImpl.java:759)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getURIFragment( XMLHelperImpl.java:730)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getIDREF(XMLHel perImpl.java:752)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveIDRefMany(XML SaveImpl.java:1934)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1286)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
> at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1083)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:956)
> at
> org.eclipse.uml2.uml.editor.presentation.UMLEditor$14.execut e(UMLEditor.java:1380)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:101)
> at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1797)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:113)
> at
> org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:113)
>
>
> Gruss
>
> Zengyu
>
>
Re: Loop Node and Conditional Node [message #625172 is a reply to message #476278] Thu, 11 October 2007 03:02 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
"Zengyu Lu" <sizeluuu@gmail.com> wrote in message
news:feacks$41o$1@build.eclipse.org...
> Hi,
> I would like to ask questions about loop and conditional nodes in
> activity.
>
> 1. It seems that there is no special test/body sections in conditional
> node. If I try to create a test section, I can only add edges and
> actions in the conditional node and set them as the test section in
> clause. The same thing happens to loop node.

The conditional node consists of clauses which in turn consist of tests
(ExecutableNode) and bodies (ExecutableNode).
Loop node has tests and bodyParts.
You should be able to add any subtype of executable node to the tests. It
seems to work in the editor.
Are you first creating clauses' with tests?

Can you provide a JUnit test or exact scenario that fails? I'm not sure I
see the issue.


>
> 2. In loop node there is a loop variable, but if I try to save the
> model, an exception about this loop variable occurs: it has no owner.
> But everything I have added to the loop node should have gotten its
> parent as owner automatically. How to solve this problem?

Can you provide a stack trace for the error?

>
> Does anybody know these?
>
> Gru
Re: Loop Node and Conditional Node [message #625180 is a reply to message #476360] Thu, 11 October 2007 23:21 Go to previous message
kevin is currently offline kevinFriend
Messages: 22
Registered: July 2009
Junior Member
Hi,
Thanks for your answer.


James Bruck wrote:

>> The conditional node consists of clauses which in turn consist of tests
>> (ExecutableNode) and bodies (ExecutableNode).
>> Loop node has tests and bodyParts.
>> You should be able to add any subtype of executable node to the tests. It
>> seems to work in the editor.
>> Are you first creating clauses' with tests?

>> Can you provide a JUnit test or exact scenario that fails? I'm not sure I
>> see the issue.


I just want to find out the test/body sections in .uml file, like:

<clause>
...
<body xmi:type="UML:ReadVariableAction"
xmi:id="condbody_ReadVariableAction2">
<result xmi:idref="loopbody_output"/>
<variable xmi:idref="loop_element"/>
</body>
<test xmi:type="UML:ReadVariableAction"
xmi:id="condtest_ReadVariableAction_count">
<variable xmi:idref="loop_count"/>
<result xmi:idref="condtest_OutputPin_count"/>
<outgoing xmi:idref="condtest_cf2"/>
</test>
...
</clause>

It seems that there is another format in it, like:

<clause xmi:id="_Dxwa4HhMEdy5av3IsZJsmg" test="_U279sHhNEdy5av3IsZJsmg"
body="_CS3lkHhNEdy5av3IsZJsmg _SGqOcHhNEdy5av3IsZJsmg"/>

There is no difference between two formats. But I still need to know
whether it is possible or not, the first format to create.

By the way, how to create xmi:id with the name of Node, like
xmi:id="ReadSelfAction" ?

>>
>> 2. In loop node there is a loop variable, but if I try to save the
>> model, an exception about this loop variable occurs: it has no owner.
>> But everything I have added to the loop node should have gotten its
>> parent as owner automatically. How to solve this problem?

> Can you provide a stack trace for the error?

The stack trace:

org.eclipse.emf.ecore.xmi.DanglingHREFException: The object
'org.eclipse.uml2.uml.internal.impl.OutputPinImpl@178e131 (name: <unset>,
visibility: <unset>) (isLeaf: false) (ordering: FIFO, isControlType:
false) (isOrdered: false, isUnique: true, isControl: false)' is not
contained in a resource.
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.handleDanglingH REF(XMLHelperImpl.java:759)
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getURIFragment( XMLHelperImpl.java:730)
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getIDREF(XMLHel perImpl.java:752)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveIDRefMany(XML SaveImpl.java:1934)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1286)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1083)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:956)
at
org.eclipse.uml2.uml.editor.presentation.UMLEditor$14.execut e(UMLEditor.java:1380)
at
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:101)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1797)
at
org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:113)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:113)


Gruss

Zengyu
Re: Loop Node and Conditional Node [message #625223 is a reply to message #476388] Mon, 15 October 2007 15:13 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Zengyu,

Those features that are not directly owned but defined somewhere in the
model and referenced will be serialized like this ...
<node xmi:type="uml:LoopNode" xmi:id="_RtcBQHsuEdyZsKXxkoCTuw"
name="LoopNode" bodyPart="_6IAyoHsuEdyZsKXxkoCTuw"
test="_6IAyoHsuEdyZsKXxkoCTuw"/>


The actual item being referred to would be serialized like this ..

<node xmi:type="uml:ReadVariableAction" xmi:id="_6IAyoHsuEdyZsKXxkoCTuw"
name="ReadVariableAction"/>

I don't believe the first xml sample that you have listed below is properly
formatted (although possibly meaning the same thing as above)



To get and set the id's in a more friendly format you can try
UML2Util.getXMIIdentifier();

Have a look at ConvertModelAction to see how this is used.

- James.


"Zengyu Lu" <sizeluuu@gmail.com> wrote in message
news:182a74b9a29fd9e3b43935b4fce24528$1@www.eclipse.org...
> Hi,
> Thanks for your answer.
>
> James Bruck wrote:
>
>>> The conditional node consists of clauses which in turn consist of tests
>>> (ExecutableNode) and bodies (ExecutableNode).
>>> Loop node has tests and bodyParts.
>>> You should be able to add any subtype of executable node to the tests.
>>> It seems to work in the editor.
>>> Are you first creating clauses' with tests?
>
>>> Can you provide a JUnit test or exact scenario that fails? I'm not sure
>>> I see the issue.
>
>
> I just want to find out the test/body sections in .uml file, like:
>
> <clause>
> ..
> <body xmi:type="UML:ReadVariableAction"
> xmi:id="condbody_ReadVariableAction2">
> <result xmi:idref="loopbody_output"/>
> <variable xmi:idref="loop_element"/>
> </body>
> <test xmi:type="UML:ReadVariableAction"
> xmi:id="condtest_ReadVariableAction_count">
> <variable xmi:idref="loop_count"/>
> <result xmi:idref="condtest_OutputPin_count"/>
> <outgoing xmi:idref="condtest_cf2"/>
> </test>
> ..
> </clause>
>
> It seems that there is another format in it, like:
> <clause xmi:id="_Dxwa4HhMEdy5av3IsZJsmg" test="_U279sHhNEdy5av3IsZJsmg"
> body="_CS3lkHhNEdy5av3IsZJsmg _SGqOcHhNEdy5av3IsZJsmg"/>
>
> There is no difference between two formats. But I still need to know
> whether it is possible or not, the first format to create.
>
> By the way, how to create xmi:id with the name of Node, like
> xmi:id="ReadSelfAction" ?
>
>>>
>>> 2. In loop node there is a loop variable, but if I try to save the
>>> model, an exception about this loop variable occurs: it has no owner.
>>> But everything I have added to the loop node should have gotten its
>>> parent as owner automatically. How to solve this problem?
>
>> Can you provide a stack trace for the error?
>
> The stack trace:
>
> org.eclipse.emf.ecore.xmi.DanglingHREFException: The object
> 'org.eclipse.uml2.uml.internal.impl.OutputPinImpl@178e131 (name: <unset>,
> visibility: <unset>) (isLeaf: false) (ordering: FIFO, isControlType:
> false) (isOrdered: false, isUnique: true, isControl: false)' is not
> contained in a resource.
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.handleDanglingH REF(XMLHelperImpl.java:759)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getURIFragment( XMLHelperImpl.java:730)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getIDREF(XMLHel perImpl.java:752)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveIDRefMany(XML SaveImpl.java:1934)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1286)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
> at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1083)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:956)
> at
> org.eclipse.uml2.uml.editor.presentation.UMLEditor$14.execut e(UMLEditor.java:1380)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:101)
> at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1797)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:113)
> at
> org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:113)
>
>
> Gruss
>
> Zengyu
>
>
Previous Topic:dynamic EMF profiles
Next Topic:Programmatically modifiying an association end
Goto Forum:
  


Current Time: Tue Dec 12 10:43:26 GMT 2017

Powered by FUDForum. Page generated in 0.01611 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software