Book a Demo

Author Topic: Question - the same instance in diagram  (Read 3501 times)

Jumbik

  • Guest
Question - the same instance in diagram
« on: November 24, 2002, 12:51:39 am »
I have class model with association from the class to the same class - chain of the objects from only one class.
How can I do it in EA? Thanks for advice.

jaimeglz

  • EA User
  • **
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Re: Question - the same instance in diagram
« Reply #1 on: November 24, 2002, 01:01:08 pm »
Hi Jumbik,

Can you tell us a bit more what are you trying to model? Is it the instantiation of a class, and the relationship between the instances (objects)?

Jaime Gonzalez

Jumbik

  • Guest
Re: Question - the same instance in diagram
« Reply #2 on: November 24, 2002, 01:36:50 pm »
My problem in class model:

I have a class CA, association to the second class, and the second class is the same class CA. Source and destination of association is the same class, that means at association ends is the same class - the same CA.  (Model of chain of the objects from the same type or tree of objects from the same type as composite, for instance) How can I do it? EA tells me: This diagram already contains an instance of the element... (...that is instance of UML metaclass - "my class CA"). I cannot put my CA twice to diagram and I cannot create association line to  CA "as circle back to CA". Maybe it is possible, I dont know...Thanks for advice...




jaimeglz

  • EA User
  • **
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Re: Question - the same instance in diagram
« Reply #3 on: November 24, 2002, 01:57:22 pm »
Select the "associate" item from your tool bar (I guess you already know where it is), click on your class, and then click again on the same class. Your association will appear as a relationship between the class and itself. (This will be, for example, an association between "employee" and "supervisor" in an employee class.)

Double click on the newly created reflective association to set its desired characteristics.

Keep us posted if you have any problems.

Jaime

Jumbik

  • Guest
Re: Question - the same instance in diagram
« Reply #4 on: November 24, 2002, 02:29:47 pm »
Thanks it is OK now.

In a future should it be possible to put same element twice to diagram? Sometimes it is better for a good transparency of diagram.

jaimeglz

  • EA User
  • **
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Re: Question - the same instance in diagram
« Reply #5 on: November 24, 2002, 02:53:32 pm »
I'll check UML rules and constraints on the last question, but I can't promise to have an answer today. Lets see what Sparxs has to say on this (though you'd better get some rest and some sleep, Geoff; there's no urgency on anything that has to be answered today...)

Good luck Jumbik.

Jaime

Jumbik

  • Guest
Re: Question - the same instance in diagram
« Reply #6 on: November 24, 2002, 04:04:24 pm »
Hi Jaime,

Thanks, the reason of my litle skill was in "old using" of VISIO and another approach in creating of diagram elements.

I think (as I know metamodel UML) repeating of model element as N diagram elements in diagrams is in UML regular. For instance in class model of genealogical tree (family tree) we create one class for item from this tree. It is class for  some "Individual" (some person-aristocrat, dog or horse). It is association class to itself. That is, it is association class, where on ends is the same class and it is this class (only one class in whole model!). In diagram we can see this:  on association ends of association class Individual is class Individual from one side and class Individual from second side. For instance mapping to RDB table looks so: table has own primary key as ID and foreign keys ID_Father, ID_Mother with join to table = self. It is better to draw it as 3 diagram elements in diagram (but representing the same model element Individual) then one diagram element with association "yourself", which looks obscure.  I am not certain I can model this situation in EA : The class, which is association class to itself (association class with reflection).
But, fortunately, I know only one example of this situation, where all three classes in model with association class are identical - it is mentioned family tree :).

Once more thanks for advice,

Jumbik.