Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF Compare] UML: Added Element with Stereotyp(Where is the information about the stereotype attached to the added element?)
icon5.gif  [EMF Compare] UML: Added Element with Stereotyp [message #974940] Wed, 07 November 2012 13:05 Go to next message
Johannes Kowald is currently offline Johannes Kowald
Messages: 3
Registered: November 2012
Junior Member
Hi,

first, i want to explain what i´m doing:
1) I compare two UML2 models with EMF Compare (not 2.0) via source code and i´m ignoring all kind of IDs.
2) I´m doing the exact same thing with the UI of EMF Compare
3) Both ways detect the same differences (jeah!), but the UI seems to have more information about the elements added

My question is:
Regarding to the attached screenshot: How does the UI know, that the added "Usage" has the stereotypes "<<call>>" and "<<secrecy>>" attached to it? If I take a look at the given attributes and values, none of them gives me this information. Even a check for possible sub-elements (code) is not successful.

If the evolved UML model has only a new stereotype attached to it, the stereotype appears as an own DiffElement (kind=addition) in the list of differences. Why are there no added stereotypes as independent DiffElements connected to the added "Usage"?

Thanks in anticipation,
Johannes Kowald
(sorry for my 'bumpy' english)
Re: [EMF Compare] UML: Added Element with Stereotyp [message #975098 is a reply to message #974940] Wed, 07 November 2012 15:44 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4098
Registered: July 2009
Senior Member
Hi

The XMI structure for stereotype applications is really wierd; rather
the the normal hierarchy of elements with cross-references, there are a
bunch of top level elements at the end that contain the extra
information. This is easily overlooked by simple tools using the tree
structure.

Regards

Ed Willink

On 07/11/2012 14:06, Johannes Kowald wrote:
> Hi,
>
> first, i want to explain what i´m doing:
> 1) I compare two UML2 models with EMF Compare (not 2.0) via source
> code and i´m ignoring all kind of IDs. 2) I´m doing the exact same
> thing with the UI of EMF Compare
> 3) Both ways detect the same differences (jeah!), but the UI seems to
> have more information about the elements added
>
> My question is: Regarding to the attached screenshot: How does the UI
> know, that the added "Usage" has the stereotypes "<<call>>" and
> "<<secrecy>>" attached to it? If I take a look at the given attributes
> and values, none of them gives me this information. Even a check for
> possible sub-elements (code) is not successful.
>
> If the evolved UML model has only a new stereotype attached to it, the
> stereotype appears as an own DiffElement (kind=addition) in the list
> of differences. Why are there no added stereotypes as independent
> DiffElements connected to the added "Usage"?
>
> Thanks in anticipation,
> Johannes Kowald
> (sorry for my 'bumpy' english)
Re: [EMF Compare] UML: Added Element with Stereotyp [message #976027 is a reply to message #975098] Thu, 08 November 2012 08:59 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
Johannes,

The most likely reason why the EMF Compare UI has more information than your 'source code' is that you are missing some initialization code for UML. The UI runs from within an Eclipse instance, where UML is properly initialized by the UML2 project itself. In you source code, you are most likely calling EMF Compare as a standalone application, which has no idea about UML's own resource and stereotypes.

If you are running the code as a standalone application, you will need to follow the explanations from the UML wiki about standalone initialization.

If your problem is only to locate the stereotype information, first check that your loaded resource is indeed an instance of "UMLResource". Then finding the stereotypes applied to a given UML element is a matter of using the UML APIs, namely : "class1.getAppliedStereotypes()" should yield the list of stereotypes applied to element "class1".

Laurent Goubet
Obeo
Re: [EMF Compare] UML: Added Element with Stereotyp [message #976222 is a reply to message #976027] Thu, 08 November 2012 12:08 Go to previous messageGo to next message
Johannes Kowald is currently offline Johannes Kowald
Messages: 3
Registered: November 2012
Junior Member
Hi,

thank you two for your fast responses. I will try to use the given information to solve my problem and response back here. Btw: I am sorry that I missed to attach the screenshot I was talking about Wink

Regards,
Johannes Kowald
Re: [EMF Compare] UML: Added Element with Stereotyp [message #987368 is a reply to message #976222] Mon, 26 November 2012 10:23 Go to previous message
Johannes Kowald is currently offline Johannes Kowald
Messages: 3
Registered: November 2012
Junior Member
Hi again,

first of all: I am using the UML2 package in the project. The Match- and DiffEngine are using the UmlCompare stuff.

Nevertheless:
I still got a problem with the UML Stereotypes in the DiffModel. Following Situation:
1) I got a class in both UML models (i want to compare) with the same name (ignoring xmi-ids they are matched to each other)
2) I attach two stereotypes from different profiles (e.g. "secret" from "testprofile1" and "secret" from "testprofile2") to the class in the modified model.
3) Both stereotypes appear as Additions in the DiffModel with references (getLeftElement) to objects of the type DynamicEObjectImpl.

Problem: From this DynamicEObjectImpl objects i can´t get any informations about the profile, the stereotype are belonging to.

As a workaround I tried the solution to match the given DiffElements with their meta-informations (like eClass, Class, qualifiedName or something like this) to the list of stereotypes of the parent uml-element (getParent() -> getAppliedStereotypes()) but this seems to fail. Et al I can´t get any qualifiedName from the DiffElement or the DynamicEObjectImpl which fits to the qualifiedName of the applied stereotypes of the parent uml-element.

I hope, i got no "tunnel vision".

Thanks in anticipation,
Johannes Kowald
(Sorry again for my bumpy english)

[Update]
I found the solution a few minutes after i posted the above question (as always). With the help of the UMLUtil.getStereotype it is easy to get the needed information.

[Updated on: Mon, 26 November 2012 11:18]

Report message to a moderator

Previous Topic:getting editing domain from resource set
Next Topic:[CDO] Server does not send 'Respository ADDED' event
Goto Forum:
  


Current Time: Sun Oct 26 06:16:50 GMT 2014

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

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