Re: Verifying Stereotypes with OCL constraints

Date view Thread view Subject view Author view Attachment view

From: Frédéric FONDEMENT (
Date: Wed 24 Mar 2004 - 17:30:01 GMT


Here my understanding in UML 2.0 profile, I hope somebody will complain on this list if I tell bad stories...

The Stereotype metaclass inherits from the Class metaclass, so that you can create an object out of it (a stereotype instance).
The Extension metaclass inherits from the Association metaclass and is used to relate a stereotype and its metaclass, so that you can create a link out of it. This link must have two ends: one on the stereotype instance, and the other on the extended element, instance of the metaclass (but I cannot find the constraint stating the extended element must be instance of this metaclass... - see figure 455 and 458). The pity here is this link cannot be navigated from the extended element (see 18.3.2). But from the stereotype instance, it is possible to navigate the extended element, with the name defined by the property of the extension. Note that by default OCL provides a name to unnamed properties ends of associations.
In that we are in the context of UML, and as a stereotype inherits Class, a stereotype instance is a metaclass, so, in a metalevel constraint, the create.allInstance seems valid to me. To determine wether your trigger is a creator or not, I assume it should be done a complicated query like:
    create.allInstances->exists(trigger = self.trigger)
The problem here is UML does not define the profile where the create stereotype is defined. I feel this is an inconsistent way for the UML metamodel: if it is the official metamodel, why must it be extended a mandatory way ?
Personally, I must admit I merge stereotype and metaclass instances what allows using the oclIsKindOf predefined operation

Does anyone know a tool UML 2.0 compliant that also deals with stereotypes to check that with a good XMI ?

Frederic Fondement
  ----- Original Message ----- 
  From: Miguel Goulăo 
  Sent: Wednesday, March 24, 2004 2:14 PM
  Subject: Verifying Stereotypes with OCL constraints


  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 = implies
                   ((self.trigger->IsEmpty) or
                    ( = '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 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


Date view Thread view Subject view Author view Attachment view