Book a Demo

Author Topic: Specifying the child diagram in a composite elemnt  (Read 6264 times)

George Andronakos

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Specifying the child diagram in a composite elemnt
« on: September 04, 2008, 10:58:08 am »
Hi
Can anybody advise if there is a way to specify an existing diagram to be the child diagram in a composite element?

I am using activity diagrams where more than one activity is set as a composite element. When I drill down to a particular composite activity (structured activity) I have modelled a child activity diagram.
However, I also have another strucutured acvtivity in the parent activity diagram where the same model is required as its child.

Is there a way of having more than one structured activity (composite) drilling-down to a common activity diagram? (ie instead of having to re-model the same logic multiple times)? Thanks.

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #1 on: September 04, 2008, 12:27:23 pm »
OK - this is not recommended use of the Activity or Composite Element structures, and I have no idea how it holds up in any model processing. I won't document it in the Help. BUT...

The principle is that if a non-composite element just happens to have one or more child diagrams, when you make the element composite EA identifies the first diagram in the list as the child diagram of that composite element. And that diagram remains the child regardless of where it wanders off to.

Like this: Create the required number of Activity elements in whatever diagrams are appropriate. Let's have three, called A1, A2 and A3. In A1's diagram, right-click on A1 and make it composite, then develop the child diagram for it. Let's call this diagram Alpha. So, Alpha is the child diagram of A1, and that is the diagram displayed if you click on A1.

Now, in the Project Browser move Alpha underneath A2. In A2's diagram, right-click on A2 and make it composite. This picks up Alpha as A2's child diagram and if you click on A2, Alpha displays. If you go back and click on A1, Alpha displays there too.

Repeat that last paragraph for A3. You now have Alpha as the child diagram of A1, A2 and A3. And any other elements, if you keep moving it on.
Best Regards, Roy

George Andronakos

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #2 on: September 04, 2008, 03:18:10 pm »
Thanks Roy. That worked for me.

Regarding your comment about the "not recommended use of this modelling with activity diagrams and composite elements", are you referring to:-
1) The practice of nesting activity diagrams in composite activity elements or
2) Linking a common child diagram to more than one parent activity element.

1f 1), what is the best practice method of modelling very large and complex logic (whilst keeping the model within a printable page span) if not using nesting?

If 2), can you please suggest a more acceptable approach?

Thank you.

Best regards,
George

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #3 on: September 04, 2008, 04:46:30 pm »
There is no problem at all with nesting activity diagrams and composite elements in modeling complex logic.

The problem lies more with point 2; that is, the various ways in which the reports, summary screens, windows, dialogs, copies, exports and imports capture or represent the multiple ownership of a given child. From the raised eyebrows and thoughtful looks of my colleagues, I gather that multiple ownership is not a routine arrangement.  I just don't want to recommend a step that I cannot guarantee won't cause a report or window somewhere to say "Huh? Whereizit?"

Perhaps someone else could chip in with an alternative suggestion? Possibly Patterns, or element templates?
Best Regards, Roy

George Andronakos

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #4 on: September 04, 2008, 05:16:56 pm »
Thanks for the feedback Roy.

Best regards,
George

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #5 on: September 04, 2008, 06:12:32 pm »
Why would you want a diagram to belong to more than one stuctured activity at all? When two structured activities share something I would put that "something" into a third activity and the diagrams for the first two would only show how they call the third one.

GaryR

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #6 on: September 12, 2008, 08:52:51 am »
Hello - I am new to EA and UML, am still learning, so my apologies if I've got this wrong.

I don't think you answered Geoge's question, which was how to link a new element to an existing diagram. Your example (thank you for the technique), links a new diagram (alpha) to an existing element (A2).

I think George (and I) want to know how to link an existing diagram (beta) to a new element (A4).

Re another comment was " if a non-composite element just happens to have one or more child diagrams".

I am having trouble finding (in the documentation) a common mechanism to link diagrams to elements and vice versa.  The use of Composite Element seems to be a subtle, or not strongly encouraged mechanism. Is there a better generic mechanism to link diagrams to elements?

Thank you, Gary

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #7 on: September 12, 2008, 09:09:10 am »
No problem Gary,

Right-click an element and from the Context Menu choose Add. For most element types you'll one or more diagrams offered near the bottom of the next level menu, as well as a more general Add Diagram option at the bottom.

The end result will be to add a diagram to your element, without making it a composite element. [Or more correctly, without changing its composite status or default diagram.]

David
No, you can't have it!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #8 on: September 12, 2008, 09:18:36 am »
Quote
I don't think you answered Geoge's question, which was how to link a new element to an existing diagram.
In the Project Browser, drag the existing diagram under the new element. Make the new element composite. [optional]Drag the diagram back where it came from.

HTH
The Sparx Team
[email protected]

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #9 on: September 12, 2008, 09:53:12 am »
To answer all of your points (I think):

Generally, you can add existing diagrams to elements by dragging the diagram onto the element in the Project Browser, as Neil says.

To add new diagrams to existing elements, right click on the element in the diagram OR the Project Browser and select the Add option, then pick your diagram type. That's what David explained.

To add new elements to a diagram, drag them off the appropriate Toolbox onto the diagram.

To add existing elements to a diagram, drag them out of the Project Browser onto the diagram, and specify whether this iteration of the element is an instance or a direct link to the original element.

Most of this is covered in the Help by the Getting Started > Quick Start - Create a Project section, the Modeling with Enterprise Architect > Work With Diagrams or Work With Elements sections, and the UML Dictionary > UML Elements > Inbuilt and Extended Stereotypes > Composite Elements topic.  8-)
Best Regards, Roy

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Specifying the child diagram in a composite el
« Reply #10 on: September 12, 2008, 10:21:58 pm »
Thanks Roy, that sews it together nicely.
No, you can't have it!