Bug 397461 - Cannot constrain stereotyped element
Summary: Cannot constrain stereotyped element
Status: ASSIGNED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Patrick Tessier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 399251
  Show dependency tree
 
Reported: 2013-01-04 11:19 EST by Ed Willink CLA
Modified: 2013-03-19 15:17 EDT (History)
1 user (show)

See Also:


Attachments
profile test to edit OCL constraint (4.32 KB, application/octet-stream)
2013-01-29 04:46 EST, Patrick Tessier CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2013-01-04 11:19:59 EST
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"
Comment 1 Patrick Tessier CLA 2013-01-24 08:12:50 EST
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.
Comment 2 Ed Willink CLA 2013-01-28 04:36:50 EST
(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.
Comment 3 Patrick Tessier CLA 2013-01-28 09:39:24 EST
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?
Comment 4 Patrick Tessier CLA 2013-01-28 09:40:07 EST
I attach the bug to the task 399251
Comment 5 Ed Willink CLA 2013-01-28 11:02:27 EST
(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.
Comment 6 Patrick Tessier CLA 2013-01-29 04:46:20 EST
Created attachment 226243 [details]
profile test to edit OCL constraint
Comment 7 Patrick Tessier CLA 2013-01-29 04:51:04 EST
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
Comment 8 Ed Willink CLA 2013-02-15 08:50:21 EST
(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.