Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354636

Summary: It should be forbidden to create an association which is composite on both sides
Product: [Modeling] Papyrus Reporter: Alain Le Guennec <alain.leguennec>
Component: CoreAssignee: Project Inbox <mdt-papyrus-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cletavernier, eclipse-bugzilla, yann.tanguy
Version: 0.8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Alain Le Guennec CLA 2011-08-12 11:41:49 EDT
It should be forbidden to create an association which is composite on both side.
However, it is currently possible to set the aggregation kind to "composite" on both sides through the property page (resulting on a diamond on both ends of the association symbol).
Comment 1 Camille Letavernier CLA 2011-09-20 05:37:45 EDT
Yann, is this something related to the service edit, or should it be handled directly from the property view ?

In the second case, I can fix it.
Comment 2 Yann Tanguy CLA 2011-11-23 06:25:50 EST
Fixed in r6276 (0.8.X) and r6277 (trunk).

The service edit now set the opposite to none to avoid other ends to be composite.
Comment 3 Yann Tanguy CLA 2011-11-23 06:29:00 EST
(In reply to comment #2)
> Fixed in r6276 (0.8.X) and r6277 (trunk).
> 
> The service edit now set the opposite to none to avoid other ends to be
> composite.
Fixed.
Comment 4 Yann Tanguy CLA 2011-12-20 03:28:59 EST
Restriction added on involved property (must be an association end).
Added in r6518 (0.8.X) and r6519 (trunk).
Comment 5 Alain Le Guennec CLA 2011-12-21 04:16:08 EST
I think we also have to consider the 'shared' aggregation kind, not only 'composite'. That is, a binary association can only be an aggregate (shared or composite) on one end.
At the moment, the other end's aggregation is set to 'none' only when setting the first one to 'composite', not to 'shared'.
Comment 6 Yann Tanguy CLA 2011-12-21 04:49:18 EST
Not sure about this, I did not manage to find such rule for shared aggragations in specifications (UML & SysML).

Also note that the rule related to compositions is broader than what is currently implemented (check below) :

"Compositions may be linked in a directed acyclic graph with transitive deletion characteristics; that is, deleting an 
element in one part of the graph will also result in the deletion of all elements of the subgraph below that element. 
Composition is represented by the isComposite attribute on the part end of the association being set to true."
Comment 7 Alain Le Guennec CLA 2011-12-21 05:15:52 EST
Thinking more about it, I don't think there is much difference between shared and composite with respect to that issue.
The thing is, there should not be any cycle in the aggregation graph (composite implies a tree, shared implies a DAG).
By very definition, any link for an association that is aggregate on both sides is such a cycle, isn't it?
I agree the spec is not clear on this point, though..
Comment 8 Yann Tanguy CLA 2011-12-21 05:51:56 EST
(In reply to comment #7)
> By very definition, any link for an association that is aggregate on both sides
> is such a cycle, isn't it?

Yes, composite on both side is a particular case of cycle.