Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » [solved] applied stereotype gone after save/load
[solved] applied stereotype gone after save/load [message #643286] Mon, 06 December 2010 11:50 Go to next message
Thomas Neustupny is currently offline Thomas NeustupnyFriend
Messages: 75
Registered: October 2009
Member
I created a profile and a model and applied a stereotype programatically. Seems to work, the following XMI was saved:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1"
    xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:myProfile="http:///schemas/myProfile/_vONbgPOuEd-ZR_t966HNrQ/0"
    xmlns:uml="http://schema.omg.org/spec/UML/2.2" xsi:schemaLocation="http:///schemas/myProfile/_vONbgPOuEd-ZR_t966HNrQ/0 http://argouml.org/user-profiles/myProfile_defined_once.xmi#_vOqHcPOuEd-ZR_t966HNrQ http://schema.omg.org/spec/UML/2.2 http://www.eclipse.org/uml2/3.0.0/UML">
  <uml:Model xmi:id="ID_myModel" name="myModel">
    <packagedElement xmi:type="uml:Class" xmi:id="ID_myClass" name="myClass"/>
    <profileApplication xmi:type="uml:ProfileApplication" xmi:id="ID_profileApplication" applyingPackage="ID_myModel">
      <xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
        <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_k-TQ8PO5Ed-p9Nu3qLl7Zw" source="http://www.eclipse.org/uml2/2.0.0/UML">
          <references xmi:type="ecore:EPackage" href="http://argouml.org/user-profiles/myProfile_defined_once.xmi#_vOqHcPOuEd-ZR_t966HNrQ"/>
        </eAnnotations>
      </xmi:Extension>
      <appliedProfile xmi:type="uml:Profile" href="http://argouml.org/user-profiles/myProfile_defined_once.xmi#ID_myProfile"/>
    </profileApplication>
  </uml:Model>
  <myProfile:myStereotype xmi:id="_phd6IPO5Ed-p9Nu3qLl7Zw" base_Class="ID_myClass"/>
</xmi:XMI>

But when I load this again (making sure that the profile is available in my resource set), resource.getContents() only returns the ModelImpl object, the (formerly existent) DynamicEObjectImpl object is gone. Obviously, it is not created when parsing the line
<myProfile:myStereotype xmi:id="_phd6IPO5Ed-p9Nu3qLl7Zw" base_Class="ID_myClass"/>

How can I get back the DynamicEObjectImpl object?
Loading is hard to debug, any hint where to put a breakpoint?

Thanks, Thomas

[Updated on: Sat, 11 December 2010 18:12]

Report message to a moderator

Re: applied stereotype gone after save/load [message #643894 is a reply to message #643286] Wed, 08 December 2010 16:09 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 161
Registered: July 2009
Senior Member
Thomas,

The href pointing to the applied profile does not seem correct:

http://argouml.tigris.org//user-profiles/myProfile_defined_o nce.xmi

I tried to hit that URI and got an error.

Cheers,

Rafael
Re: applied stereotype gone after save/load [message #644182 is a reply to message #643894] Thu, 09 December 2010 19:10 Go to previous messageGo to next message
Thomas Neustupny is currently offline Thomas NeustupnyFriend
Messages: 75
Registered: October 2009
Member
Hi Rafael,

I don't think this is the problem, because I loaded the profile and put it in my resourceSet, I paste it here from my debug session (after loading the above):
resources=[org.eclipse.uml2.uml.internal.resource.XMI2UMLResourceImpl@161091e uri='http://argouml.org/profiles/uml22/default-uml22.xmi', org.eclipse.uml2.uml.internal.resource.XMI2UMLResourceImpl@1c3fd59 uri='http://argouml.tigris.org/euml/resource/default_uri.xmi', org.eclipse.uml2.uml.internal.resource.XMI2UMLResourceImpl@182e445 uri='http://argouml.org/user-profiles/myProfile_defined_once.xmi', org.eclipse.uml2.uml.internal.resource.UMLResourceImpl@155220e uri='pathmap://UML_METAMODELS/UML.metamodel.uml', org.eclipse.uml2.uml.internal.resource.UMLResourceImpl@124fb16 uri='pathmap://UML_PROFILES/Ecore.profile.uml', org.eclipse.uml2.uml.internal.resource.UMLResourceImpl@1420a24 uri='pathmap://UML_PROFILES/Standard.profile.uml', org.eclipse.uml2.uml.internal.resource.XMI2UMLResourceImpl@d573c7 uri='myModel_using_myProfile_defined_once.xmi']

The problem is, that when calling save(...) on my resource, it cannot find the DynamicEObjectImpl object, only my model object.
Re: applied stereotype gone after save/load [message #644195 is a reply to message #644182] Thu, 09 December 2010 20:34 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 161
Registered: July 2009
Senior Member
You are possibly right, sorry for not being able to help.

I never used URIs that are not the actual ones where I am loading the contents from. I guess you are loading the profile resource passing in an input stream?

Cheers,

Rafael
Re: applied stereotype gone after save/load [message #644282 is a reply to message #643286] Fri, 10 December 2010 11:37 Go to previous messageGo to next message
Thomas Neustupny is currently offline Thomas NeustupnyFriend
Messages: 75
Registered: October 2009
Member
Yes, you are right. However, your answer was helpful, it pointed me to the right location in the code: I figured that the parsing correctly created the DynamicEObjectImpl object, but I think I need to manually add this element to the resources associated with the model. So, it's my fault so far, as expected of course... Smile

Anybody knows how to do that?
Re: applied stereotype gone after save/load [message #644348 is a reply to message #644282] Fri, 10 December 2010 16:21 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 161
Registered: July 2009
Senior Member
Just to make sure - have you tried invoking myModel.getAppliedProfiles()? Does it fail with an exception, return an empty list, or returns a singleton list with the profile object? What about myModel.getAppliedStereotypes()?

Posting some code (and models) that shows what you are seeing would help.

[Updated on: Fri, 10 December 2010 16:23]

Report message to a moderator

Re: applied stereotype gone after save/load [message #644467 is a reply to message #643286] Sat, 11 December 2010 18:11 Go to previous message
Thomas Neustupny is currently offline Thomas NeustupnyFriend
Messages: 75
Registered: October 2009
Member
It is solved!!!

I was sure that getAppliedProfiles() works, and it indeed does. My problem was, that I've got some long forgotten "high sofisticated model management code" Razz that spoiled everything even after I perfectly did everything right. After fixing this code, everything work fine.

Thanks Rafael, sorry for the false alarm!
Previous Topic:Getting null for the meta model
Next Topic:Is the XMI file generated by EMF standard and can be opened with other UML tools?
Goto Forum:
  


Current Time: Fri Dec 19 14:37:47 GMT 2014

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

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