Community
Participate
Working Groups
In a Profile Class Diagram a Constraint can be linked to a Stereotype to allow the stereotype to impose limitations on its use. However a Constraint cannot be linked to a <<metaclass>> element, which is where it would be appropriate to locate constraints involving the mis-application of multiple stereotypes. "cannot be linked" means "the dragged link end cannot be dropped on"
It is normal, if you want to constraint the metaClass, the context becomes the metaclass. So the contraints belongs to the metaclasses. In this case you change the metamodel UML. So it is not possible.
(In reply to comment #1) > It is normal, if you want to constraint the metaClass, the context becomes > the metaclass. So the contraints belongs to the metaclasses. Absolutely. Constraint.context = 'the-metaclass' But the constraint doesn't constrain anything unless Constraint.constrainedElement = 'the-metaclass' as well. This is what I would expect to be the consequence of a Link between Constraint and 'the-metaclass'. > In this case you change the metamodel UML. So it is not possible. I do not understand this comment.
I explain that in uml when you set Constraint.context='the-metaclass'. The-metaclass owns this rules (by the feature ownedRule). I means that you try to change the metamodel, no?
I attach the bug to the task 399251
(In reply to comment #3) > I explain that in uml when you set Constraint.context='the-metaclass'. > The-metaclass owns this rules (by the feature ownedRule). Yes the meta-class owns (is the context of) the rule, but without a constrainedElement, nothing is constrained by the rule. > I means that you try to change the metamodel, no? I'm still not quite clear what you mean by this, which meta-model the UML spec, or my example? I am trying to make what the UML 2.5 specification suggests work without change.
Created attachment 226243 [details] profile test to edit OCL constraint
Hi Ed, I have added a model to test the edition of OCL constraint in a profile. 1. I have succeed to attach a constraint to a metaclass ;D, but in fact I cannot drop the link, i have to use the property view. 2. I can write several constraint on metaclass and in the profile. but I cannot write the constraint on my stereotype self.Property1='Toto' for the StereotypeA
(In reply to comment #7) > 2. I can write several constraint on metaclass and in the profile. but I > cannot write the constraint on my stereotype self.Property1='Toto' for the > StereotypeA self.Property1='Toto' works fine for me now (although I had to manually stretch the Cosntraint to show the update). Sole remaining problems are the graphics, but since Constraint-Links have now semantic significance, this could be changed to an enhancement.