Topic
  • 2 replies
  • Latest Post - ‏2013-09-13T12:22:26Z by WCWA_Massimiliano_D'Angelo
WCWA_Massimiliano_D'Angelo
19 Posts

Pinned topic composite class, composition relation and parts

‏2013-09-12T17:08:31Z |

Hi guys,

I want to represent that a class is composed by instances of other classes. I know two ways to do that:

-use a class diagram, where I can show that a class is in composition/aggregation relation with another classes.

-use a structure diagram. I need to create instances of the inner classes and I can then drag them as parts of a composite class

Is it possible to use both representations at the same time in Rhapsody to represent the same "composition" relation? (as different views, one at the class level, the other explicitly showing the parts the containment relation refers to).

I noticed that when I create the class diagram, Rhapsody creates an association end to represent the class instance inside the composite class. it seems there is no way to link this association end with a part in a structure diagram; if you try to create a structure diagram with the part named as the association end, the part gets marked in red; same if you first create the structure diagram and then try to rename the association end as the part (Rhapsody complains that the name is already used by the part). Basically, the default behavior seems to be that the composition relation in the class diagram creates its own instance(s), and the parts in the structure diagrams are created as distinct instances.

 

Thanks,

Massimiliano

Updated on 2013-09-12T17:09:04Z at 2013-09-12T17:09:04Z by WCWA_Massimiliano_D'Angelo
  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: composite class, composition relation and parts

    ‏2013-09-13T00:38:27Z  

    Hi Massimiliano,

    Not exactly, but I do vaguely understand why you want to do that. Anyway, have you tried ObjectModelGe::Composition::RepresentParts set to true?

    Property Definition:
    The RepresentParts property determines what type of element is added to the Rational Rhapsody object model diagram when you draw a composition connector (black diamond). By default, when you add a composition relationship to a diagram, you see an Association that is added in the diagram. If you prefer that Rational Rhapsody display this relationship as a Part in the diagram, set the value of this property to True.
    Default = Cleared

    Sorry, I can't think of any other ways.

    Best Regard,

    --Shinji

  • WCWA_Massimiliano_D'Angelo
    19 Posts

    Re: composite class, composition relation and parts

    ‏2013-09-13T12:22:26Z  

    Hi Massimiliano,

    Not exactly, but I do vaguely understand why you want to do that. Anyway, have you tried ObjectModelGe::Composition::RepresentParts set to true?

    Property Definition:
    The RepresentParts property determines what type of element is added to the Rational Rhapsody object model diagram when you draw a composition connector (black diamond). By default, when you add a composition relationship to a diagram, you see an Association that is added in the diagram. If you prefer that Rational Rhapsody display this relationship as a Part in the diagram, set the value of this property to True.
    Default = Cleared

    Sorry, I can't think of any other ways.

    Best Regard,

    --Shinji

    Hi Shinji,

    thanks a lot. This is exactly what I was looking for.

     

    Regards,

    Massimiliano