Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: michielper on October 10, 2020, 12:41:12 am

Title: How to distinguish between Aggregation and Composition?
Post by: michielper on October 10, 2020, 12:41:12 am
Although in models and diagrams there is a distinction between Aggregation and Composition, this seems to be lost when accessing the model in a script where both types of connectors get the same EA.Connector.Type: "Aggregation". This seems weird, or am I missing something?

Although the two relationship types have similarities, the differences can be very significant and essential in a model. So, how can I find the difference when accessing the model from a script?

Regards, Michiel
Title: Re: How to distinguish between Aggregation and Composition?
Post by: pvickers on October 10, 2020, 01:08:50 am
In the repository see table t_connector.
The indication of a connector being "aggregate" is shown with a value of 1 in column "DestIsAggregate"...
If it has a value of 2 it is composite.

Hope this helps.
Perry
Title: Re: How to distinguish between Aggregation and Composition?
Post by: Geert Bellekens on October 10, 2020, 01:29:13 am
Yeah, don't realy on the connector type. An connector of type association can also be an Aggregation or Composition.
Check the aggregate properties at both ends.

Geert
Title: Re: How to distinguish between Aggregation and Composition?
Post by: Paolo F Cantoni on October 10, 2020, 11:04:19 am
Yeah, don't rely on the connector type. A connector of type association can also be an Aggregation or Composition.
Check the aggregate properties at both ends.

Geert
To echo what Geert says and also provide some historical context (in case you come across an ancient repository).  In the "old days" Aggregation and Composition arcs were of type "Aggregation" with the subtype = Strong for Composition.  As UML evolved, Sparx converted to a more consistent mechanism whereby all three "Association", "Aggregation" and "Composition" were all of type "Association" differing only in their AggregationKind (none, shared, composite) (DestIsAggregate, SourceIsAggregate).

For your sanity, try to standardise on which end the AggregationKind is to be applied.  We have made all such arcs, be Direction: Source -> Destination with AggregationKind (compisitionKind in MDG) at the Destination end.

HTH,
Paolo