Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » inStructuredNode reference not saved
inStructuredNode reference not saved [message #476787] Wed, 19 December 2007 14:44 Go to next message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------070205090204010205000104
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Hi All,

I have to ask this question once again. I create several
SequenceNodes. I set inStructuredNode reference. Then I serialize the
model. When I load it again this reference is lost.

Is this normal behavior? Why it is not recreated when model is loaded?

I attach sample code to test it.
(after first run and model creation comment out saving and creation
and uncomment loading)

Regards,
Krzysztof

--------------070205090204010205000104
Content-Type: text/x-java;
name="SimpleTest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="SimpleTest.java"

import java.io.IOException;
import java.util.Iterator;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.SequenceNode;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.UMLResource;
import org.eclipse.uml2.uml.util.UMLUtil;


public class SimpleTest
{
protected static final ResourceSet RESOURCE_SET = new ResourceSetImpl();

protected static void registerResourceFactories() {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
}

protected static void save(org.eclipse.uml2.uml.Package package_, URI uri) {
Resource resource = RESOURCE_SET.createResource(uri);
EList contents = resource.getContents();

contents.add(package_);

for (Iterator allContents = UMLUtil.getAllContents(package_, true,
false); allContents.hasNext();) {

EObject eObject = (EObject) allContents.next();

if (eObject instanceof Element) {
contents
.addAll(((Element) eObject).getStereotypeApplications());
}
}

try {
resource.save(null);
} catch (IOException ioe) {
err(ioe.getMessage());
}
}

protected static org.eclipse.uml2.uml.Package load(URI uri) {
org.eclipse.uml2.uml.Package package_ = null;

try {
Resource resource = RESOURCE_SET.getResource(uri, true);

package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
.getObjectByType(resource.getContents(),
UMLPackage.Literals.PACKAGE);
} catch (WrappedException we) {
err(we.getMessage());
System.exit(1);
}

return package_;
}

protected static void err(String error) {
System.err.println(error);
}


public static void main(String[] args) {

registerResourceFactories();
Activity a;
SequenceNode s1, s2;

// creating model

Model model = UMLFactory.eINSTANCE.createModel();
model.setName("MyModel");
org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("MyClass", false);
a= (Activity) clazz.createOwnedBehavior( "MyActivity", UMLPackage.Literals.ACTIVITY );
s1 = (SequenceNode) a.createNode( "nodeLevel1", UMLPackage.Literals.SEQUENCE_NODE);
s1.setInActivity( a );
s2 = (SequenceNode) s1.createNode( "nodeLevel2", UMLPackage.Literals.SEQUENCE_NODE);
s2.setInStructuredNode( s1 );

// saving

save(model, URI.createFileURI("sequenceNodeTest.uml") );

// loading model

//model = (Model) load( URI.createFileURI("sequenceNodeTest.uml"));

// checking

org.eclipse.uml2.uml.Class claz = (Class) model.getPackagedElement( "MyClass" );
System.out.println( claz );
a = (Activity) claz.getOwnedBehavior( "MyActivity" );
System.out.println( a );
s1 = (SequenceNode) a.getNode( "nodeLevel1" );
System.out.println( s1 );
System.out.println( "Level 1 -> Activity (inActivity) = " + s1.getInActivity() );
s2 = (SequenceNode) s1.getNode( "nodeLevel2" );
System.out.println( s2 );
System.out.println( "Level 2 -> Level 1 (inStructuredNode) = " + s2.getInStructuredNode() );
}
}

--------------070205090204010205000104--
Re: inStructuredNode reference not saved [message #476790 is a reply to message #476787] Wed, 19 December 2007 22:41 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Krzysztof,

This reference is a container reference, i.e. a reference to the structured
node that contains the activity node. When you create a sequence node as a
child of a(nother) sequence node, for example, this reference is
automatically set for you via the bidirectional handshaking mechanism
provided by EMF; it does not need to be set explicitly (the same applies for
the inActivity reference). Note that container references are not serialized
by default since such information is generally considered redundant (seeing
as the parent element in the serialization is the container)...

Kenn

"Krzysztof Kaczmarski" <krzysztof_kaczmarski@o2.pl> wrote in message
news:fkbaot$g5a$1@build.eclipse.org...
> Hi All,
>
> I have to ask this question once again. I create several
> SequenceNodes. I set inStructuredNode reference. Then I serialize the
> model. When I load it again this reference is lost.
>
> Is this normal behavior? Why it is not recreated when model is loaded?
>
> I attach sample code to test it.
> (after first run and model creation comment out saving and creation
> and uncomment loading)
>
> Regards,
> Krzysztof
>


------------------------------------------------------------ --------------------


> import java.io.IOException;
> import java.util.Iterator;
>
> import org.eclipse.emf.common.util.EList;
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.common.util.WrappedException;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.util.EcoreUtil;
> import org.eclipse.uml2.uml.Activity;
> import org.eclipse.uml2.uml.Class;
> import org.eclipse.uml2.uml.Element;
> import org.eclipse.uml2.uml.Model;
> import org.eclipse.uml2.uml.SequenceNode;
> import org.eclipse.uml2.uml.UMLFactory;
> import org.eclipse.uml2.uml.UMLPackage;
> import org.eclipse.uml2.uml.resource.UMLResource;
> import org.eclipse.uml2.uml.util.UMLUtil;
>
>
> public class SimpleTest
> {
> protected static final ResourceSet RESOURCE_SET = new ResourceSetImpl();
>
> protected static void registerResourceFactories() {
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
> UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
> }
>
> protected static void save(org.eclipse.uml2.uml.Package package_, URI uri)
> {
> Resource resource = RESOURCE_SET.createResource(uri);
> EList contents = resource.getContents();
>
> contents.add(package_);
>
> for (Iterator allContents = UMLUtil.getAllContents(package_, true,
> false); allContents.hasNext();) {
>
> EObject eObject = (EObject) allContents.next();
>
> if (eObject instanceof Element) {
> contents
> .addAll(((Element) eObject).getStereotypeApplications());
> }
> }
>
> try {
> resource.save(null);
> } catch (IOException ioe) {
> err(ioe.getMessage());
> }
> }
>
> protected static org.eclipse.uml2.uml.Package load(URI uri) {
> org.eclipse.uml2.uml.Package package_ = null;
>
> try {
> Resource resource = RESOURCE_SET.getResource(uri, true);
>
> package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
> .getObjectByType(resource.getContents(),
> UMLPackage.Literals.PACKAGE);
> } catch (WrappedException we) {
> err(we.getMessage());
> System.exit(1);
> }
>
> return package_;
> }
>
> protected static void err(String error) {
> System.err.println(error);
> }
>
>
> public static void main(String[] args) {
>
> registerResourceFactories();
> Activity a;
> SequenceNode s1, s2;
>
> // creating model
>
> Model model = UMLFactory.eINSTANCE.createModel();
> model.setName("MyModel");
> org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("MyClass",
> false);
> a= (Activity) clazz.createOwnedBehavior( "MyActivity",
> UMLPackage.Literals.ACTIVITY );
> s1 = (SequenceNode) a.createNode( "nodeLevel1",
> UMLPackage.Literals.SEQUENCE_NODE);
> s1.setInActivity( a );
> s2 = (SequenceNode) s1.createNode( "nodeLevel2",
> UMLPackage.Literals.SEQUENCE_NODE);
> s2.setInStructuredNode( s1 );
>
> // saving
>
> save(model, URI.createFileURI("sequenceNodeTest.uml") );
>
> // loading model
>
> //model = (Model) load( URI.createFileURI("sequenceNodeTest.uml"));
>
> // checking
>
> org.eclipse.uml2.uml.Class claz = (Class) model.getPackagedElement(
> "MyClass" );
> System.out.println( claz );
> a = (Activity) claz.getOwnedBehavior( "MyActivity" );
> System.out.println( a );
> s1 = (SequenceNode) a.getNode( "nodeLevel1" );
> System.out.println( s1 );
> System.out.println( "Level 1 -> Activity (inActivity) = " +
> s1.getInActivity() );
> s2 = (SequenceNode) s1.getNode( "nodeLevel2" );
> System.out.println( s2 );
> System.out.println( "Level 2 -> Level 1 (inStructuredNode) = " +
> s2.getInStructuredNode() );
> }
> }
>
Re: inStructuredNode reference not saved [message #476791 is a reply to message #476790] Thu, 20 December 2007 07:47 Go to previous messageGo to next message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------020109050400040303060600
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Hi Kenn,

the problem is that when I create a sequence node in another sequence
node this reference is *not* set.
Please run the attached code.

You will notice that inActivity reference *is set* while
isStructuredNode is *not set* automatically.

I am not saying that there is a bug in EMF or in this magic
handshaking mechanism, I am saying that there is something wrong with
this inStructuredNode reference.

Regards,
KK

Kenn Hussey wrote:
> Krzysztof,
>
> This reference is a container reference, i.e. a reference to the structured
> node that contains the activity node. When you create a sequence node as a
> child of a(nother) sequence node, for example, this reference is
> automatically set for you via the bidirectional handshaking mechanism
> provided by EMF; it does not need to be set explicitly (the same applies for
> the inActivity reference). Note that container references are not serialized
> by default since such information is generally considered redundant (seeing
> as the parent element in the serialization is the container)...
>
> Kenn
>
> "Krzysztof Kaczmarski" <krzysztof_kaczmarski@o2.pl> wrote in message
> news:fkbaot$g5a$1@build.eclipse.org...
>> Hi All,
>>
>> I have to ask this question once again. I create several
>> SequenceNodes. I set inStructuredNode reference. Then I serialize the
>> model. When I load it again this reference is lost.
>>
>> Is this normal behavior? Why it is not recreated when model is loaded?
>>
>> I attach sample code to test it.
>> (after first run and model creation comment out saving and creation
>> and uncomment loading)
>>
>> Regards,
>> Krzysztof
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> import java.io.IOException;
>> import java.util.Iterator;
>>
>> import org.eclipse.emf.common.util.EList;
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.common.util.WrappedException;
>> import org.eclipse.emf.ecore.EObject;
>> import org.eclipse.emf.ecore.resource.Resource;
>> import org.eclipse.emf.ecore.resource.ResourceSet;
>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>> import org.eclipse.emf.ecore.util.EcoreUtil;
>> import org.eclipse.uml2.uml.Activity;
>> import org.eclipse.uml2.uml.Class;
>> import org.eclipse.uml2.uml.Element;
>> import org.eclipse.uml2.uml.Model;
>> import org.eclipse.uml2.uml.SequenceNode;
>> import org.eclipse.uml2.uml.UMLFactory;
>> import org.eclipse.uml2.uml.UMLPackage;
>> import org.eclipse.uml2.uml.resource.UMLResource;
>> import org.eclipse.uml2.uml.util.UMLUtil;
>>
>>
>> public class SimpleTest
>> {
>> protected static final ResourceSet RESOURCE_SET = new ResourceSetImpl();
>>
>> protected static void registerResourceFactories() {
>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
>> UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>> }
>>
>> protected static void save(org.eclipse.uml2.uml.Package package_, URI uri)
>> {
>> Resource resource = RESOURCE_SET.createResource(uri);
>> EList contents = resource.getContents();
>>
>> contents.add(package_);
>>
>> for (Iterator allContents = UMLUtil.getAllContents(package_, true,
>> false); allContents.hasNext();) {
>>
>> EObject eObject = (EObject) allContents.next();
>>
>> if (eObject instanceof Element) {
>> contents
>> .addAll(((Element) eObject).getStereotypeApplications());
>> }
>> }
>>
>> try {
>> resource.save(null);
>> } catch (IOException ioe) {
>> err(ioe.getMessage());
>> }
>> }
>>
>> protected static org.eclipse.uml2.uml.Package load(URI uri) {
>> org.eclipse.uml2.uml.Package package_ = null;
>>
>> try {
>> Resource resource = RESOURCE_SET.getResource(uri, true);
>>
>> package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
>> .getObjectByType(resource.getContents(),
>> UMLPackage.Literals.PACKAGE);
>> } catch (WrappedException we) {
>> err(we.getMessage());
>> System.exit(1);
>> }
>>
>> return package_;
>> }
>>
>> protected static void err(String error) {
>> System.err.println(error);
>> }
>>
>>
>> public static void main(String[] args) {
>>
>> registerResourceFactories();
>> Activity a;
>> SequenceNode s1, s2;
>>
>> // creating model
>>
>> Model model = UMLFactory.eINSTANCE.createModel();
>> model.setName("MyModel");
>> org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("MyClass",
>> false);
>> a= (Activity) clazz.createOwnedBehavior( "MyActivity",
>> UMLPackage.Literals.ACTIVITY );
>> s1 = (SequenceNode) a.createNode( "nodeLevel1",
>> UMLPackage.Literals.SEQUENCE_NODE);
>> s1.setInActivity( a );
>> s2 = (SequenceNode) s1.createNode( "nodeLevel2",
>> UMLPackage.Literals.SEQUENCE_NODE);
>> s2.setInStructuredNode( s1 );
>>
>> // saving
>>
>> save(model, URI.createFileURI("sequenceNodeTest.uml") );
>>
>> // loading model
>>
>> //model = (Model) load( URI.createFileURI("sequenceNodeTest.uml"));
>>
>> // checking
>>
>> org.eclipse.uml2.uml.Class claz = (Class) model.getPackagedElement(
>> "MyClass" );
>> System.out.println( claz );
>> a = (Activity) claz.getOwnedBehavior( "MyActivity" );
>> System.out.println( a );
>> s1 = (SequenceNode) a.getNode( "nodeLevel1" );
>> System.out.println( s1 );
>> System.out.println( "Level 1 -> Activity (inActivity) = " +
>> s1.getInActivity() );
>> s2 = (SequenceNode) s1.getNode( "nodeLevel2" );
>> System.out.println( s2 );
>> System.out.println( "Level 2 -> Level 1 (inStructuredNode) = " +
>> s2.getInStructuredNode() );
>> }
>> }
>>
>
>


--------------020109050400040303060600
Content-Type: text/x-java;
name="SimpleTest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="SimpleTest.java"

import java.io.IOException;
import java.util.Iterator;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.SequenceNode;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.UMLResource;
import org.eclipse.uml2.uml.util.UMLUtil;


public class SimpleTest
{
protected static final ResourceSet RESOURCE_SET = new ResourceSetImpl();

protected static void registerResourceFactories() {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
}

protected static void save(org.eclipse.uml2.uml.Package package_, URI uri) {
Resource resource = RESOURCE_SET.createResource(uri);
EList contents = resource.getContents();

contents.add(package_);

for (Iterator allContents = UMLUtil.getAllContents(package_, true,
false); allContents.hasNext();) {

EObject eObject = (EObject) allContents.next();

if (eObject instanceof Element) {
contents
.addAll(((Element) eObject).getStereotypeApplications());
}
}

try {
resource.save(null);
} catch (IOException ioe) {
err(ioe.getMessage());
}
}

protected static org.eclipse.uml2.uml.Package load(URI uri) {
org.eclipse.uml2.uml.Package package_ = null;

try {
Resource resource = RESOURCE_SET.getResource(uri, true);

package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
.getObjectByType(resource.getContents(),
UMLPackage.Literals.PACKAGE);
} catch (WrappedException we) {
err(we.getMessage());
System.exit(1);
}

return package_;
}

protected static void err(String error) {
System.err.println(error);
}


public static void main(String[] args) {

registerResourceFactories();
Activity a;
SequenceNode s1, s2;

// creating model

Model model = UMLFactory.eINSTANCE.createModel();
model.setName("MyModel");
org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("MyClass", false);

a = (Activity) clazz.createOwnedBehavior( "MyActivity", UMLPackage.Literals.ACTIVITY );

s1 = (SequenceNode) a.createNode( "nodeLevel1", UMLPackage.Literals.SEQUENCE_NODE);
//s1.setInActivity( a );

s2 = (SequenceNode) s1.createNode( "nodeLevel2", UMLPackage.Literals.SEQUENCE_NODE);
//s2.setInStructuredNode( s1 );

// saving

// save(model, URI.createFileURI("sequenceNodeTest.uml") );

// loading model

//model = (Model) load( URI.createFileURI("sequenceNodeTest.uml"));

// checking

org.eclipse.uml2.uml.Class claz = (Class) model.getPackagedElement( "MyClass" );
System.out.println( claz );
a = (Activity) claz.getOwnedBehavior( "MyActivity" );
System.out.println( a );
s1 = (SequenceNode) a.getNode( "nodeLevel1" );
System.out.println( s1 );
System.out.println( "Level 1 -> Activity (inActivity) = " + s1.getInActivity() );
s2 = (SequenceNode) s1.getNode( "nodeLevel2" );
System.out.println( s2 );
System.out.println( "Level 2 -> Level 1 (inStructuredNode) = " + s2.getInStructuredNode() );
}
}

--------------020109050400040303060600--
Re: inStructuredNode reference not saved [message #476792 is a reply to message #476791] Thu, 20 December 2007 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

An activity node (such as a sequence node) can only be contained by either
an Activity element, or by a StructuredNode. The inActivity reference has
a value only if the direct container is an Activity; it does not indicate
the activity that is an indirect container (i.e., ancestor). likewise, the
inStructuredNode reference only has a value if the direct container is a
StructuredNode.

Basically, these container references are mutually exclusive, but an
activity node will always have one of them set.

HTH,

Christian


Krzysztof Kaczmarski wrote:

> Hi Kenn,
>
> the problem is that when I create a sequence node in another sequence
> node this reference is *not* set.
> Please run the attached code.
>
> You will notice that inActivity reference *is set* while
> isStructuredNode is *not set* automatically.
>
> I am not saying that there is a bug in EMF or in this magic
> handshaking mechanism, I am saying that there is something wrong with
> this inStructuredNode reference.
>
> Regards,
> KK

-----8<-----
Re: inStructuredNode reference not saved [message #476793 is a reply to message #476792] Thu, 20 December 2007 16:56 Go to previous messageGo to next message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
Dear Christian,

I agree 100% This is how it should work but it does not!

In the attached example there are three nodes:

1. Activity
2. SequenceNode
3. SequenceNode

They are nested according to indents above.

The first SequenceNode (2) has inActivity set correctly.
The second SequenceNode (3) has inStructuredNode not set.
I do not check any other references only these two.

Why don't you run the example and see it by your self?

Regards,
Krzysztof





Christian W. Damus wrote:
> Hi, Krzysztof,
>
> An activity node (such as a sequence node) can only be contained by either
> an Activity element, or by a StructuredNode. The inActivity reference has
> a value only if the direct container is an Activity; it does not indicate
> the activity that is an indirect container (i.e., ancestor). likewise, the
> inStructuredNode reference only has a value if the direct container is a
> StructuredNode.
>
> Basically, these container references are mutually exclusive, but an
> activity node will always have one of them set.
>
> HTH,
>
> Christian
>
>
> Krzysztof Kaczmarski wrote:
>
>> Hi Kenn,
>>
>> the problem is that when I create a sequence node in another sequence
>> node this reference is *not* set.
>> Please run the attached code.
>>
>> You will notice that inActivity reference *is set* while
>> isStructuredNode is *not set* automatically.
>>
>> I am not saying that there is a bug in EMF or in this magic
>> handshaking mechanism, I am saying that there is something wrong with
>> this inStructuredNode reference.
>>
>> Regards,
>> KK
>
> -----8<-----
Re: inStructuredNode reference not saved [message #476794 is a reply to message #476793] Thu, 20 December 2007 19:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Sorry, Krzysztof,

I took a closer look. The UML2 API is working as specified by UML 2.1.

The SequenceNode metaclass redefines the "node" association-end of
StructuredActivityNode as "executableNode".

So, when you use the createNode() method to create s2 (the nested
SequenceNode), you are creating it in the executableNode containment
reference. This containment reference has no navigable opposite, let alone
one that subsets inStructuredNode.

Looks like a bug in OMG's specification: because the executableNode
property subsets node, it should have a navigable opposite that subsets
inStructuredNode.

Cheers,

Christian


Krzysztof Kaczmarski wrote:

> Dear Christian,
>
> I agree 100% This is how it should work but it does not!
>
> In the attached example there are three nodes:
>
> 1. Activity
> 2. SequenceNode
> 3. SequenceNode
>
> They are nested according to indents above.
>
> The first SequenceNode (2) has inActivity set correctly.
> The second SequenceNode (3) has inStructuredNode not set.
> I do not check any other references only these two.
>
> Why don't you run the example and see it by your self?
>
> Regards,
> Krzysztof
>
>
>
>
>
> Christian W. Damus wrote:
>> Hi, Krzysztof,
>>
>> An activity node (such as a sequence node) can only be contained by
>> either
>> an Activity element, or by a StructuredNode. The inActivity reference
>> has a value only if the direct container is an Activity; it does not
>> indicate
>> the activity that is an indirect container (i.e., ancestor). likewise,
>> the inStructuredNode reference only has a value if the direct container
>> is a StructuredNode.
>>
>> Basically, these container references are mutually exclusive, but an
>> activity node will always have one of them set.
>>
>> HTH,
>>
>> Christian
>>
>>
>> Krzysztof Kaczmarski wrote:
>>
>>> Hi Kenn,
>>>
>>> the problem is that when I create a sequence node in another sequence
>>> node this reference is *not* set.
>>> Please run the attached code.
>>>
>>> You will notice that inActivity reference *is set* while
>>> isStructuredNode is *not set* automatically.
>>>
>>> I am not saying that there is a bug in EMF or in this magic
>>> handshaking mechanism, I am saying that there is something wrong with
>>> this inStructuredNode reference.
>>>
>>> Regards,
>>> KK
>>
>> -----8<-----
Re: inStructuredNode reference not saved [message #476795 is a reply to message #476794] Thu, 20 December 2007 19:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Oops ... that should be

Looks like a bug in OMG's specification: because the
executableNode property *redefines* node, it should
have a navigable opposite that *redefines*
inStructuredNode.

cW
Re: inStructuredNode reference not saved [message #476797 is a reply to message #476794] Fri, 21 December 2007 07:51 Go to previous messageGo to next message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
Thanks Christian,

This somehow answers my questions. Is it possible that this OMG bug
will be resolved in future? What should I do to help here?

But now, how can I create nested SequenceNode elements, serialize them
and then get this inStructuredNode (or any other reference pointing
up) recreated automatically when loading? No way?

Or is there any other chance to be able to navigate between nested
SequenceNodes? Any other way to do that? I need it critically.

Thanks again,
Krzysztof


Christian W. Damus wrote:
> Sorry, Krzysztof,
>
> I took a closer look. The UML2 API is working as specified by UML 2.1.
>
> The SequenceNode metaclass redefines the "node" association-end of
> StructuredActivityNode as "executableNode".
>
> So, when you use the createNode() method to create s2 (the nested
> SequenceNode), you are creating it in the executableNode containment
> reference. This containment reference has no navigable opposite, let alone
> one that subsets inStructuredNode.
>
> Looks like a bug in OMG's specification: because the executableNode
> property subsets node, it should have a navigable opposite that subsets
> inStructuredNode.
>
> Cheers,
>
> Christian
>
>
> Krzysztof Kaczmarski wrote:
>
>> Dear Christian,
>>
>> I agree 100% This is how it should work but it does not!
>>
>> In the attached example there are three nodes:
>>
>> 1. Activity
>> 2. SequenceNode
>> 3. SequenceNode
>>
>> They are nested according to indents above.
>>
>> The first SequenceNode (2) has inActivity set correctly.
>> The second SequenceNode (3) has inStructuredNode not set.
>> I do not check any other references only these two.
>>
>> Why don't you run the example and see it by your self?
>>
>> Regards,
>> Krzysztof
>>
>>
>>
>>
>>
>> Christian W. Damus wrote:
>>> Hi, Krzysztof,
>>>
>>> An activity node (such as a sequence node) can only be contained by
>>> either
>>> an Activity element, or by a StructuredNode. The inActivity reference
>>> has a value only if the direct container is an Activity; it does not
>>> indicate
>>> the activity that is an indirect container (i.e., ancestor). likewise,
>>> the inStructuredNode reference only has a value if the direct container
>>> is a StructuredNode.
>>>
>>> Basically, these container references are mutually exclusive, but an
>>> activity node will always have one of them set.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>>
>>> Krzysztof Kaczmarski wrote:
>>>
>>>> Hi Kenn,
>>>>
>>>> the problem is that when I create a sequence node in another sequence
>>>> node this reference is *not* set.
>>>> Please run the attached code.
>>>>
>>>> You will notice that inActivity reference *is set* while
>>>> isStructuredNode is *not set* automatically.
>>>>
>>>> I am not saying that there is a bug in EMF or in this magic
>>>> handshaking mechanism, I am saying that there is something wrong with
>>>> this inStructuredNode reference.
>>>>
>>>> Regards,
>>>> KK
>>> -----8<-----
>
Re: inStructuredNode reference not saved [message #476815 is a reply to message #476797] Wed, 02 January 2008 14:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

It looks to me like the definition of the SequenceNode metaclass effectively
redefines the "inStructuredNode" reference out of existence, so I think you
will probably have to use the "owner" reference to navigate to the
containing SequenceNode (and check whether the owner is, in fact, a
SequenceNode).

To check whether the OMG already has an issue on this subject, and to raise
it if they don't, there should be directions at the very beginning of the
UML specification document indicating the appropriate e-mail addresses etc.
Otherwise, you should find what you need in the OMG's specification
catalogue at http://www.omg.org.

Cheers,

Christian


Krzysztof Kaczmarski wrote:

> Thanks Christian,
>
> This somehow answers my questions. Is it possible that this OMG bug
> will be resolved in future? What should I do to help here?
>
> But now, how can I create nested SequenceNode elements, serialize them
> and then get this inStructuredNode (or any other reference pointing
> up) recreated automatically when loading? No way?
>
> Or is there any other chance to be able to navigate between nested
> SequenceNodes? Any other way to do that? I need it critically.
>
> Thanks again,
> Krzysztof

-----8<-----
Re: inStructuredNode reference not saved [message #476818 is a reply to message #476815] Thu, 03 January 2008 12:49 Go to previous message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
Thank you Christian for your reply.

I made a workaround of this problem using EMF's eContainer.

I will try to check OMG bug state in my spare time.

Regards,
KK


Christian W. Damus wrote:
> Hi, Krzysztof,
>
> It looks to me like the definition of the SequenceNode metaclass effectively
> redefines the "inStructuredNode" reference out of existence, so I think you
> will probably have to use the "owner" reference to navigate to the
> containing SequenceNode (and check whether the owner is, in fact, a
> SequenceNode).
>
> To check whether the OMG already has an issue on this subject, and to raise
> it if they don't, there should be directions at the very beginning of the
> UML specification document indicating the appropriate e-mail addresses etc.
> Otherwise, you should find what you need in the OMG's specification
> catalogue at http://www.omg.org.
>
> Cheers,
>
> Christian
>
>
> Krzysztof Kaczmarski wrote:
>
>> Thanks Christian,
>>
>> This somehow answers my questions. Is it possible that this OMG bug
>> will be resolved in future? What should I do to help here?
>>
>> But now, how can I create nested SequenceNode elements, serialize them
>> and then get this inStructuredNode (or any other reference pointing
>> up) recreated automatically when loading? No way?
>>
>> Or is there any other chance to be able to navigate between nested
>> SequenceNodes? Any other way to do that? I need it critically.
>>
>> Thanks again,
>> Krzysztof
>
> -----8<-----
Re: inStructuredNode reference not saved [message #625765 is a reply to message #476787] Wed, 19 December 2007 22:41 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Krzysztof,

This reference is a container reference, i.e. a reference to the structured
node that contains the activity node. When you create a sequence node as a
child of a(nother) sequence node, for example, this reference is
automatically set for you via the bidirectional handshaking mechanism
provided by EMF; it does not need to be set explicitly (the same applies for
the inActivity reference). Note that container references are not serialized
by default since such information is generally considered redundant (seeing
as the parent element in the serialization is the container)...

Kenn

"Krzysztof Kaczmarski" <krzysztof_kaczmarski@o2.pl> wrote in message
news:fkbaot$g5a$1@build.eclipse.org...
> Hi All,
>
> I have to ask this question once again. I create several
> SequenceNodes. I set inStructuredNode reference. Then I serialize the
> model. When I load it again this reference is lost.
>
> Is this normal behavior? Why it is not recreated when model is loaded?
>
> I attach sample code to test it.
> (after first run and model creation comment out saving and creation
> and uncomment loading)
>
> Regards,
> Krzysztof
>


------------------------------------------------------------ --------------------


> import java.io.IOException;
> import java.util.Iterator;
>
> import org.eclipse.emf.common.util.EList;
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.common.util.WrappedException;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.util.EcoreUtil;
> import org.eclipse.uml2.uml.Activity;
> import org.eclipse.uml2.uml.Class;
> import org.eclipse.uml2.uml.Element;
> import org.eclipse.uml2.uml.Model;
> import org.eclipse.uml2.uml.SequenceNode;
> import org.eclipse.uml2.uml.UMLFactory;
> import org.eclipse.uml2.uml.UMLPackage;
> import org.eclipse.uml2.uml.resource.UMLResource;
> import org.eclipse.uml2.uml.util.UMLUtil;
>
>
> public class SimpleTest
> {
> protected static final ResourceSet RESOURCE_SET = new ResourceSetImpl();
>
> protected static void registerResourceFactories() {
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
> UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
> }
>
> protected static void save(org.eclipse.uml2.uml.Package package_, URI uri)
> {
> Resource resource = RESOURCE_SET.createResource(uri);
> EList contents = resource.getContents();
>
> contents.add(package_);
>
> for (Iterator allContents = UMLUtil.getAllContents(package_, true,
> false); allContents.hasNext();) {
>
> EObject eObject = (EObject) allContents.next();
>
> if (eObject instanceof Element) {
> contents
> .addAll(((Element) eObject).getStereotypeApplications());
> }
> }
>
> try {
> resource.save(null);
> } catch (IOException ioe) {
> err(ioe.getMessage());
> }
> }
>
> protected static org.eclipse.uml2.uml.Package load(URI uri) {
> org.eclipse.uml2.uml.Package package_ = null;
>
> try {
> Resource resource = RESOURCE_SET.getResource(uri, true);
>
> package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
> .getObjectByType(resource.getContents(),
> UMLPackage.Literals.PACKAGE);
> } catch (WrappedException we) {
> err(we.getMessage());
> System.exit(1);
> }
>
> return package_;
> }
>
> protected static void err(String error) {
> System.err.println(error);
> }
>
>
> public static void main(String[] args) {
>
> registerResourceFactories();
> Activity a;
> SequenceNode s1, s2;
>
> // creating model
>
> Model model = UMLFactory.eINSTANCE.createModel();
> model.setName("MyModel");
> org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("MyClass",
> false);
> a= (Activity) clazz.createOwnedBehavior( "MyActivity",
> UMLPackage.Literals.ACTIVITY );
> s1 = (SequenceNode) a.createNode( "nodeLevel1",
> UMLPackage.Literals.SEQUENCE_NODE);
> s1.setInActivity( a );
> s2 = (SequenceNode) s1.createNode( "nodeLevel2",
> UMLPackage.Literals.SEQUENCE_NODE);
> s2.setInStructuredNode( s1 );
>
> // saving
>
> save(model, URI.createFileURI("sequenceNodeTest.uml") );
>
> // loading model
>
> //model = (Model) load( URI.createFileURI("sequenceNodeTest.uml"));
>
> // checking
>
> org.eclipse.uml2.uml.Class claz = (Class) model.getPackagedElement(
> "MyClass" );
> System.out.println( claz );
> a = (Activity) claz.getOwnedBehavior( "MyActivity" );
> System.out.println( a );
> s1 = (SequenceNode) a.getNode( "nodeLevel1" );
> System.out.println( s1 );
> System.out.println( "Level 1 -> Activity (inActivity) = " +
> s1.getInActivity() );
> s2 = (SequenceNode) s1.getNode( "nodeLevel2" );
> System.out.println( s2 );
> System.out.println( "Level 2 -> Level 1 (inStructuredNode) = " +
> s2.getInStructuredNode() );
> }
> }
>
Re: inStructuredNode reference not saved [message #625766 is a reply to message #476790] Thu, 20 December 2007 07:47 Go to previous message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------020109050400040303060600
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Hi Kenn,

the problem is that when I create a sequence node in another sequence
node this reference is *not* set.
Please run the attached code.

You will notice that inActivity reference *is set* while
isStructuredNode is *not set* automatically.

I am not saying that there is a bug in EMF or in this magic
handshaking mechanism, I am saying that there is something wrong with
this inStructuredNode reference.

Regards,
KK

Kenn Hussey wrote:
> Krzysztof,
>
> This reference is a container reference, i.e. a reference to the structured
> node that contains the activity node. When you create a sequence node as a
> child of a(nother) sequence node, for example, this reference is
> automatically set for you via the bidirectional handshaking mechanism
> provided by EMF; it does not need to be set explicitly (the same applies for
> the inActivity reference). Note that container references are not serialized
> by default since such information is generally considered redundant (seeing
> as the parent element in the serialization is the container)...
>
> Kenn
>
> "Krzysztof Kaczmarski" <krzysztof_kaczmarski@o2.pl> wrote in message
> news:fkbaot$g5a$1@build.eclipse.org...
>> Hi All,
>>
>> I have to ask this question once again. I create several
>> SequenceNodes. I set inStructuredNode reference. Then I serialize the
>> model. When I load it again this reference is lost.
>>
>> Is this normal behavior? Why it is not recreated when model is loaded?
>>
>> I attach sample code to test it.
>> (after first run and model creation comment out saving and creation
>> and uncomment loading)
>>
>> Regards,
>> Krzysztof
>>
>
>
> ------------------------------------------------------------ --------------------
>
>
>> import java.io.IOException;
>> import java.util.Iterator;
>>
>> import org.eclipse.emf.common.util.EList;
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.common.util.WrappedException;
>> import org.eclipse.emf.ecore.EObject;
>> import org.eclipse.emf.ecore.resource.Resource;
>> import org.eclipse.emf.ecore.resource.ResourceSet;
>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>> import org.eclipse.emf.ecore.util.EcoreUtil;
>> import org.eclipse.uml2.uml.Activity;
>> import org.eclipse.uml2.uml.Class;
>> import org.eclipse.uml2.uml.Element;
>> import org.eclipse.uml2.uml.Model;
>> import org.eclipse.uml2.uml.SequenceNode;
>> import org.eclipse.uml2.uml.UMLFactory;
>> import org.eclipse.uml2.uml.UMLPackage;
>> import org.eclipse.uml2.uml.resource.UMLResource;
>> import org.eclipse.uml2.uml.util.UMLUtil;
>>
>>
>> public class SimpleTest
>> {
>> protected static final ResourceSet RESOURCE_SET = new ResourceSetImpl();
>>
>> protected static void registerResourceFactories() {
>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
>> UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>> }
>>
>> protected static void save(org.eclipse.uml2.uml.Package package_, URI uri)
>> {
>> Resource resource = RESOURCE_SET.createResource(uri);
>> EList contents = resource.getContents();
>>
>> contents.add(package_);
>>
>> for (Iterator allContents = UMLUtil.getAllContents(package_, true,
>> false); allContents.hasNext();) {
>>
>> EObject eObject = (EObject) allContents.next();
>>
>> if (eObject instanceof Element) {
>> contents
>> .addAll(((Element) eObject).getStereotypeApplications());
>> }
>> }
>>
>> try {
>> resource.save(null);
>> } catch (IOException ioe) {
>> err(ioe.getMessage());
>> }
>> }
>>
>> protected static org.eclipse.uml2.uml.Package load(URI uri) {
>> org.eclipse.uml2.uml.Package package_ = null;
>>
>> try {
>> Resource resource = RESOURCE_SET.getResource(uri, true);
>>
>> package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
>> .getObjectByType(resource.getContents(),
>> UMLPackage.Literals.PACKAGE);
>> } catch (WrappedException we) {
>> err(we.getMessage());
>> System.exit(1);
>> }
>>
>> return package_;
>> }
>>
>> protected static void err(String error) {
>> System.err.println(error);
>> }
>>
>>
>> public static void main(String[] args) {
>>
>> registerResourceFactories();
>> Activity a;
>> SequenceNode s1, s2;
>>
>> // creating model
>>
>> Model model = UMLFactory.eINSTANCE.createModel();
>> model.setName("MyModel");
>> org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("MyClass",
>> false);
>> a= (Activity) clazz.createOwnedBehavior( "MyActivity",
>> UMLPackage.Literals.ACTIVITY );
>> s1 = (SequenceNode) a.createNode( "nodeLevel1",
>> UMLPackage.Literals.SEQUENCE_NODE);
>> s1.setInActivity( a );
>> s2 = (SequenceNode) s1.createNode( "nodeLevel2",
>> UMLPackage.Literals.SEQUENCE_NODE);
>> s2.setInStructuredNode( s1 );
>>
>> // saving
>>
>> save(model, URI.createFileURI("sequenceNodeTest.uml") );
>>
>> // loading model
>>
>> //model = (Model) load( URI.createFileURI("sequenceNodeTest.uml"));
>>
>> // checking
>>
>> org.eclipse.uml2.uml.Class claz = (Class) model.getPackagedElement(
>> "MyClass" );
>> System.out.println( claz );
>> a = (Activity) claz.getOwnedBehavior( "MyActivity" );
>> System.out.println( a );
>> s1 = (SequenceNode) a.getNode( "nodeLevel1" );
>> System.out.println( s1 );
>> System.out.println( "Level 1 -> Activity (inActivity) = " +
>> s1.getInActivity() );
>> s2 = (SequenceNode) s1.getNode( "nodeLevel2" );
>> System.out.println( s2 );
>> System.out.println( "Level 2 -> Level 1 (inStructuredNode) = " +
>> s2.getInStructuredNode() );
>> }
>> }
>>
>
>


--------------020109050400040303060600
Content-Type: text/x-java;
name="SimpleTest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="SimpleTest.java"

import java.io.IOException;
import java.util.Iterator;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.SequenceNode;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.UMLResource;
import org.eclipse.uml2.uml.util.UMLUtil;


public class SimpleTest
{
protected static final ResourceSet RESOURCE_SET = new ResourceSetImpl();

protected static void registerResourceFactories() {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
}

protected static void save(org.eclipse.uml2.uml.Package package_, URI uri) {
Resource resource = RESOURCE_SET.createResource(uri);
EList contents = resource.getContents();

contents.add(package_);

for (Iterator allContents = UMLUtil.getAllContents(package_, true,
false); allContents.hasNext();) {

EObject eObject = (EObject) allContents.next();

if (eObject instanceof Element) {
contents
.addAll(((Element) eObject).getStereotypeApplications());
}
}

try {
resource.save(null);
} catch (IOException ioe) {
err(ioe.getMessage());
}
}

protected static org.eclipse.uml2.uml.Package load(URI uri) {
org.eclipse.uml2.uml.Package package_ = null;

try {
Resource resource = RESOURCE_SET.getResource(uri, true);

package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
.getObjectByType(resource.getContents(),
UMLPackage.Literals.PACKAGE);
} catch (WrappedException we) {
err(we.getMessage());
System.exit(1);
}

return package_;
}

protected static void err(String error) {
System.err.println(error);
}


public static void main(String[] args) {

registerResourceFactories();
Activity a;
SequenceNode s1, s2;

// creating model

Model model = UMLFactory.eINSTANCE.createModel();
model.setName("MyModel");
org.eclipse.uml2.uml.Class clazz = model.createOwnedClass("MyClass", false);

a = (Activity) clazz.createOwnedBehavior( "MyActivity", UMLPackage.Literals.ACTIVITY );

s1 = (SequenceNode) a.createNode( "nodeLevel1", UMLPackage.Literals.SEQUENCE_NODE);
//s1.setInActivity( a );

s2 = (SequenceNode) s1.createNode( "nodeLevel2", UMLPackage.Literals.SEQUENCE_NODE);
//s2.setInStructuredNode( s1 );

// saving

// save(model, URI.createFileURI("sequenceNodeTest.uml") );

// loading model

//model = (Model) load( URI.createFileURI("sequenceNodeTest.uml"));

// checking

org.eclipse.uml2.uml.Class claz = (Class) model.getPackagedElement( "MyClass" );
System.out.println( claz );
a = (Activity) claz.getOwnedBehavior( "MyActivity" );
System.out.println( a );
s1 = (SequenceNode) a.getNode( "nodeLevel1" );
System.out.println( s1 );
System.out.println( "Level 1 -> Activity (inActivity) = " + s1.getInActivity() );
s2 = (SequenceNode) s1.getNode( "nodeLevel2" );
System.out.println( s2 );
System.out.println( "Level 2 -> Level 1 (inStructuredNode) = " + s2.getInStructuredNode() );
}
}

--------------020109050400040303060600--
Re: inStructuredNode reference not saved [message #625767 is a reply to message #476791] Thu, 20 December 2007 13:14 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

An activity node (such as a sequence node) can only be contained by either
an Activity element, or by a StructuredNode. The inActivity reference has
a value only if the direct container is an Activity; it does not indicate
the activity that is an indirect container (i.e., ancestor). likewise, the
inStructuredNode reference only has a value if the direct container is a
StructuredNode.

Basically, these container references are mutually exclusive, but an
activity node will always have one of them set.

HTH,

Christian


Krzysztof Kaczmarski wrote:

> Hi Kenn,
>
> the problem is that when I create a sequence node in another sequence
> node this reference is *not* set.
> Please run the attached code.
>
> You will notice that inActivity reference *is set* while
> isStructuredNode is *not set* automatically.
>
> I am not saying that there is a bug in EMF or in this magic
> handshaking mechanism, I am saying that there is something wrong with
> this inStructuredNode reference.
>
> Regards,
> KK

-----8<-----
Re: inStructuredNode reference not saved [message #625768 is a reply to message #476792] Thu, 20 December 2007 16:56 Go to previous message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
Dear Christian,

I agree 100% This is how it should work but it does not!

In the attached example there are three nodes:

1. Activity
2. SequenceNode
3. SequenceNode

They are nested according to indents above.

The first SequenceNode (2) has inActivity set correctly.
The second SequenceNode (3) has inStructuredNode not set.
I do not check any other references only these two.

Why don't you run the example and see it by your self?

Regards,
Krzysztof





Christian W. Damus wrote:
> Hi, Krzysztof,
>
> An activity node (such as a sequence node) can only be contained by either
> an Activity element, or by a StructuredNode. The inActivity reference has
> a value only if the direct container is an Activity; it does not indicate
> the activity that is an indirect container (i.e., ancestor). likewise, the
> inStructuredNode reference only has a value if the direct container is a
> StructuredNode.
>
> Basically, these container references are mutually exclusive, but an
> activity node will always have one of them set.
>
> HTH,
>
> Christian
>
>
> Krzysztof Kaczmarski wrote:
>
>> Hi Kenn,
>>
>> the problem is that when I create a sequence node in another sequence
>> node this reference is *not* set.
>> Please run the attached code.
>>
>> You will notice that inActivity reference *is set* while
>> isStructuredNode is *not set* automatically.
>>
>> I am not saying that there is a bug in EMF or in this magic
>> handshaking mechanism, I am saying that there is something wrong with
>> this inStructuredNode reference.
>>
>> Regards,
>> KK
>
> -----8<-----
Re: inStructuredNode reference not saved [message #625769 is a reply to message #476793] Thu, 20 December 2007 19:48 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Sorry, Krzysztof,

I took a closer look. The UML2 API is working as specified by UML 2.1.

The SequenceNode metaclass redefines the "node" association-end of
StructuredActivityNode as "executableNode".

So, when you use the createNode() method to create s2 (the nested
SequenceNode), you are creating it in the executableNode containment
reference. This containment reference has no navigable opposite, let alone
one that subsets inStructuredNode.

Looks like a bug in OMG's specification: because the executableNode
property subsets node, it should have a navigable opposite that subsets
inStructuredNode.

Cheers,

Christian


Krzysztof Kaczmarski wrote:

> Dear Christian,
>
> I agree 100% This is how it should work but it does not!
>
> In the attached example there are three nodes:
>
> 1. Activity
> 2. SequenceNode
> 3. SequenceNode
>
> They are nested according to indents above.
>
> The first SequenceNode (2) has inActivity set correctly.
> The second SequenceNode (3) has inStructuredNode not set.
> I do not check any other references only these two.
>
> Why don't you run the example and see it by your self?
>
> Regards,
> Krzysztof
>
>
>
>
>
> Christian W. Damus wrote:
>> Hi, Krzysztof,
>>
>> An activity node (such as a sequence node) can only be contained by
>> either
>> an Activity element, or by a StructuredNode. The inActivity reference
>> has a value only if the direct container is an Activity; it does not
>> indicate
>> the activity that is an indirect container (i.e., ancestor). likewise,
>> the inStructuredNode reference only has a value if the direct container
>> is a StructuredNode.
>>
>> Basically, these container references are mutually exclusive, but an
>> activity node will always have one of them set.
>>
>> HTH,
>>
>> Christian
>>
>>
>> Krzysztof Kaczmarski wrote:
>>
>>> Hi Kenn,
>>>
>>> the problem is that when I create a sequence node in another sequence
>>> node this reference is *not* set.
>>> Please run the attached code.
>>>
>>> You will notice that inActivity reference *is set* while
>>> isStructuredNode is *not set* automatically.
>>>
>>> I am not saying that there is a bug in EMF or in this magic
>>> handshaking mechanism, I am saying that there is something wrong with
>>> this inStructuredNode reference.
>>>
>>> Regards,
>>> KK
>>
>> -----8<-----
Re: inStructuredNode reference not saved [message #625770 is a reply to message #476794] Thu, 20 December 2007 19:49 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Oops ... that should be

Looks like a bug in OMG's specification: because the
executableNode property *redefines* node, it should
have a navigable opposite that *redefines*
inStructuredNode.

cW
Re: inStructuredNode reference not saved [message #625772 is a reply to message #476794] Fri, 21 December 2007 07:51 Go to previous message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
Thanks Christian,

This somehow answers my questions. Is it possible that this OMG bug
will be resolved in future? What should I do to help here?

But now, how can I create nested SequenceNode elements, serialize them
and then get this inStructuredNode (or any other reference pointing
up) recreated automatically when loading? No way?

Or is there any other chance to be able to navigate between nested
SequenceNodes? Any other way to do that? I need it critically.

Thanks again,
Krzysztof


Christian W. Damus wrote:
> Sorry, Krzysztof,
>
> I took a closer look. The UML2 API is working as specified by UML 2.1.
>
> The SequenceNode metaclass redefines the "node" association-end of
> StructuredActivityNode as "executableNode".
>
> So, when you use the createNode() method to create s2 (the nested
> SequenceNode), you are creating it in the executableNode containment
> reference. This containment reference has no navigable opposite, let alone
> one that subsets inStructuredNode.
>
> Looks like a bug in OMG's specification: because the executableNode
> property subsets node, it should have a navigable opposite that subsets
> inStructuredNode.
>
> Cheers,
>
> Christian
>
>
> Krzysztof Kaczmarski wrote:
>
>> Dear Christian,
>>
>> I agree 100% This is how it should work but it does not!
>>
>> In the attached example there are three nodes:
>>
>> 1. Activity
>> 2. SequenceNode
>> 3. SequenceNode
>>
>> They are nested according to indents above.
>>
>> The first SequenceNode (2) has inActivity set correctly.
>> The second SequenceNode (3) has inStructuredNode not set.
>> I do not check any other references only these two.
>>
>> Why don't you run the example and see it by your self?
>>
>> Regards,
>> Krzysztof
>>
>>
>>
>>
>>
>> Christian W. Damus wrote:
>>> Hi, Krzysztof,
>>>
>>> An activity node (such as a sequence node) can only be contained by
>>> either
>>> an Activity element, or by a StructuredNode. The inActivity reference
>>> has a value only if the direct container is an Activity; it does not
>>> indicate
>>> the activity that is an indirect container (i.e., ancestor). likewise,
>>> the inStructuredNode reference only has a value if the direct container
>>> is a StructuredNode.
>>>
>>> Basically, these container references are mutually exclusive, but an
>>> activity node will always have one of them set.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>>
>>> Krzysztof Kaczmarski wrote:
>>>
>>>> Hi Kenn,
>>>>
>>>> the problem is that when I create a sequence node in another sequence
>>>> node this reference is *not* set.
>>>> Please run the attached code.
>>>>
>>>> You will notice that inActivity reference *is set* while
>>>> isStructuredNode is *not set* automatically.
>>>>
>>>> I am not saying that there is a bug in EMF or in this magic
>>>> handshaking mechanism, I am saying that there is something wrong with
>>>> this inStructuredNode reference.
>>>>
>>>> Regards,
>>>> KK
>>> -----8<-----
>
Re: inStructuredNode reference not saved [message #625791 is a reply to message #476797] Wed, 02 January 2008 14:33 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

It looks to me like the definition of the SequenceNode metaclass effectively
redefines the "inStructuredNode" reference out of existence, so I think you
will probably have to use the "owner" reference to navigate to the
containing SequenceNode (and check whether the owner is, in fact, a
SequenceNode).

To check whether the OMG already has an issue on this subject, and to raise
it if they don't, there should be directions at the very beginning of the
UML specification document indicating the appropriate e-mail addresses etc.
Otherwise, you should find what you need in the OMG's specification
catalogue at http://www.omg.org

Cheers,

Christian


Krzysztof Kaczmarski wrote:

> Thanks Christian,
>
> This somehow answers my questions. Is it possible that this OMG bug
> will be resolved in future? What should I do to help here?
>
> But now, how can I create nested SequenceNode elements, serialize them
> and then get this inStructuredNode (or any other reference pointing
> up) recreated automatically when loading? No way?
>
> Or is there any other chance to be able to navigate between nested
> SequenceNodes? Any other way to do that? I need it critically.
>
> Thanks again,
> Krzysztof

-----8<-----
Re: inStructuredNode reference not saved [message #625794 is a reply to message #476815] Thu, 03 January 2008 12:49 Go to previous message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
Thank you Christian for your reply.

I made a workaround of this problem using EMF's eContainer.

I will try to check OMG bug state in my spare time.

Regards,
KK


Christian W. Damus wrote:
> Hi, Krzysztof,
>
> It looks to me like the definition of the SequenceNode metaclass effectively
> redefines the "inStructuredNode" reference out of existence, so I think you
> will probably have to use the "owner" reference to navigate to the
> containing SequenceNode (and check whether the owner is, in fact, a
> SequenceNode).
>
> To check whether the OMG already has an issue on this subject, and to raise
> it if they don't, there should be directions at the very beginning of the
> UML specification document indicating the appropriate e-mail addresses etc.
> Otherwise, you should find what you need in the OMG's specification
> catalogue at http://www.omg.org
>
> Cheers,
>
> Christian
>
>
> Krzysztof Kaczmarski wrote:
>
>> Thanks Christian,
>>
>> This somehow answers my questions. Is it possible that this OMG bug
>> will be resolved in future? What should I do to help here?
>>
>> But now, how can I create nested SequenceNode elements, serialize them
>> and then get this inStructuredNode (or any other reference pointing
>> up) recreated automatically when loading? No way?
>>
>> Or is there any other chance to be able to navigate between nested
>> SequenceNodes? Any other way to do that? I need it critically.
>>
>> Thanks again,
>> Krzysztof
>
> -----8<-----
Previous Topic:Generate UML - class diagram
Next Topic:SequenceNode serialization problem?
Goto Forum:
  


Current Time: Thu Mar 28 16:02:26 GMT 2024

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

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

Back to the top