Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Parameterize node types?

Hi Jens,

in you example model, the applied stereotype manifests as such an element:

<UMLsec:Internet xmi:id="_RbsbkAl1EeKqzsm1UJxSIA" base_CommunicationPath="_EDoDwAiwEeKU97Orryn2zQ"/>

So this is an object of type 'Internet', where this type is defined in the UML profile. Specifically it is defined like this:

      <eClassifiers xmi:type="ecore:EClass" xmi:id="__wdvF7FCEeCXHfYhNhPYCw" name="Internet">
        <eAnnotations xmi:id="__wdvGLFCEeCXHfYhNhPYCw" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_mlK9gDtJEeCP85Qan380IQ"/>
   ...
      </eClassifiers>

So 'Internet' really is an ordinary EClass. I think, however, it is not the own that you created when you specified your stereotype in your UML profile. It is rather *generated* from your profile description. This process is explained at http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Introduction_to_UML2_Profiles/article.html in the section 'Defining Profiles'.

If you look at the 'Internet' EClass above you can see that it has a UML-eAnnotation which points to some other element. If you look up the ID of this element, you find in the profile specification:

  <packagedElement xmi:type="uml:Stereotype" xmi:id="_mlK9gDtJEeCP85Qan380IQ" name="Internet">

This is the 'real' stereotype that you created in the first place.

To make a long story short: the UML profile mechanism uses a somewhat bizarre 'definition' process to make the UML and the Ecore world compatible (that is at least my guess). I do not see how you could match and modify stereotypes in a generic way. This holds for Henshin but also generally. If you want to work with a stereotype, you have to use it explicitly using the EClass generated in the definition process. The only way out I see would be to use reflection -- but that would be a hack.

I am by no means an expert in this area. You could also ask the Eclipse UML developers for help.

Cheers,
Christian

PS: you have multiple EClass called 'Internet' in you profile. Could it be that you repeated the definition process a couple of times? I would expect that you get exactly one EClass for every Stereotype.

On 11/05/2012 04:21 PM, Jens Bürger wrote:
Am 05.11.2012 08:52, schrieb Christian Krause:
Hi Jens,

I am a bit surprised that there is no generic way of recognizing and
modifying stereotypes. Is there no common superclass for your
stereotypes that can be used in the rule?

"Class" would be a potential superclass, and there is "Stereotype" also.
I built a rule just containing one preserve node. Using types Class and Association, I can match to nodes and CommunicationPaths, for example.

I tried the obvious possibilities to match a stereotype "LAN":

node-type Class, attribute name="LAN"
node-type Stereotype, attribute name="LAN"

Neither of them works. I'm a bit confused, as matching using superclasses this way seems to work in general.

I took a look at the UML EMF metamodel and "Stereotype" directly extends "Class", so the class-types I chose should be right.

Did I overlook something?

Jens
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev


Back to the top