Re: Verifying Stereotypes with OCL constraints



Date view Thread view Subject view Author view Attachment view

From: Miguel Goulăo (miguel.goulao@di.fct.unl.pt)
Date: Wed 24 Mar 2004 - 17:33:23 GMT


That is pretty much my doubt. With UML 1.x this would seem to me straightforward, but I am having trouble to understand how it works with UML 2.0.

On the new metamodel, in the Profiles package, Stereotype inherits from Class.
Class has an association with Extension (association end is called extension), which in turn has an aggregation of exactly one ExtensionEnd (ownedEnd). ExtensionEnd is typed (type) by Stereotype.

So inside the Profiles package, you can get from Class to Extension from there to ExtensionEnd and from ExtensionEnd, finally, to the Stereotype.
So, shouldn't the navigation to get to the stereotypes, starting from an instance of Class be something like:

this.extension->ownedEnd.type

Now, suppose I need to create a stereotype called <<constructor>> as an extension of class Operation (from Kernel).
Operation is not a subclass of Class (neither direct nor indirect). How can I check if an instance of operation is stereotyped by <<constructor>> under these circumstances?

There must be an elegant way of doing it, but I am having trouble figuring out how.

Regards, 
Miguel
----- Original Message ----- 
  From: Jörn Guy Süß 
  To: puml-list@cs.york.ac.uk 
  Sent: Wednesday, March 24, 2004 4:04 PM
  Subject: RE: Verifying Stereotypes with OCL constraints


  Although I do not have the document available (and thus cannot verify the structure), this sounds like UML 1.x, where all types where derived from ModelElement, which provided a link to the stereotype in the Extension system. Under those circumstances, the approach is a perfectly normal navigation.


  regards,

  Jörn Guy Süß
  Dipl.-Inform. Jörn Guy Süß            | CIS - Sekr. EN7
  phone / fax : +49(30) 314-23553/21601 | TU Berlin, FB Informatik
  phone (secretary) : +49(30) 314-23555 | Einsteinufer 17
  mailto:jgsuess@cs.tu-berlin.de       | D-10587 BERLIN / GERMANY


    -----Original Message-----
    From: puml-list-request@cs.york.ac.uk [mailto:puml-list-request@cs.york.ac.uk]On Behalf Of Miguel Goulăo
    Sent: Wednesday, March 24, 2004 2:15 PM
    To: puml-list@cs.york.ac.uk
    Subject: Verifying Stereotypes with OCL constraints


    Hello, 

    How can one verify if a given model element in OCL has a specific stereotype?

    For instance, in section 15.3.14 of the UML superstructure document, version 3 (030208), page 499, the specification of Transition (from BehaviorStatemachines), there is an association to trigger, specifying the triggers that may fire a transition. Among other constraints, there is one that says that an initial transition at the topmost level either has no trigger or it has a trigger with the stereotype "create", defined in OCL as:

    self.source.oclIsKindOf(Pseudostate) implies
         (self.source.oclAsType(Pseudostate).kind = #initial) implies
               (self.source.container = self.statemachine.top) implies
                     ((self.trigger->IsEmpty) or
                      (self.trigger.stereotype.name = 'create'))

    My question is, how can "self.trigger.stereotype" be a valid navigation on the UML 2.0 metamodel? I can't find an attribute called stereotype in the trigger's class, or any of its ancestors, so I don't really understand how this works.

    Assuming this is not a mistake, what am I missing here?
    Is this the normal way of verifying stereotypes with OCL constraints, or is there a better one?

    Thanks in advance,
    Miguel
    --
    Miguel Goulăo
    Departamento de Informática da FCT/ UNL
    Quinta da Torre, 2829-516 Caparica, Portugal
    Tel: +351-21 294 85 36  - Ext. 10731
    Fax: +351-21 294 85 41
    E-mail: miguel.goulao@di.fct.unl.pt
    http://ctp.di.fct.unl.pt/QUASAR


     

Date view Thread view Subject view Author view Attachment view