Author Topic: Finding partition for an element  (Read 8159 times)

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Finding partition for an element
« on: April 21, 2012, 03:04:00 am »
Hi,

Can anyone give me a pointer how to find the partition that contains a specific EA.Element instance (either by API or SQL-Query).

To be more concrete:
I want to know how a state modelled in a state machine (composite state) relates to a orthogonal states region containing that state.

Any help appreciated!
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Finding partition for an element
« Reply #1 on: April 23, 2012, 04:28:31 pm »
Günther,

Not yet concrete enough for me.
Can you draw a picture?

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Finding partition for an element
« Reply #2 on: April 23, 2012, 06:45:36 pm »
If you not only have a graphical relation, this should not be too difficult. Just place the related elements inside te according partition and you can find them via Parent_ID.

q.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Finding partition for an element
« Reply #3 on: April 24, 2012, 06:03:00 pm »
Quote
If you not only have a graphical relation, this should not be too difficult. Just place the related elements inside te according partition and you can find them via Parent_ID.

q.
Hi,

I'm afraid there's no such thing like a Parent_ID for the state regions. Regions (partitions) don't seem to be 1st class citizens in the DB model. The only thing I could find in the DB was an entry in t_xref table for the state containing the regions with the related Client GUID. That entry contains a Description for (all!) the regions with just some graphical info. Any (sub-)states of the (composite) state that contains the regions are just listed as child elements, appearantly without any hint in which region they reside.
That's kind of bad, because according to the UML 2.3 spec states should always reside within at least one(!!!) (implicit) region of their parent state machine/ composite state.
May be one of the Sparx folks can clarify this a bit more ...

Best regards,
Günther

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Finding partition for an element
« Reply #4 on: April 24, 2012, 07:12:12 pm »
What is a state region? I thought you were talking about partitions (from activities).

q.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Finding partition for an element
« Reply #5 on: April 24, 2012, 07:46:59 pm »
Hi,

State (machine) regions are used as containers for orthogonal (concurrent) sub states. These appear in the Partitions collection of StateMachine or State elements in the API object model.
I'll try to post a picture as Geert proposed ...

Best regards,
Günther

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Finding partition for an element
« Reply #6 on: April 25, 2012, 02:15:38 am »
Here's an image of a state diagram with a composite state containing regions:


I want to find out programmatically that State4 and State5 are inside RegionA and State6, State7 and State8 are in RegionB (same for the various pseudo state nodes).

Best regards,
Günther
« Last Edit: April 25, 2012, 02:17:00 am by g.makulik »
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Finding partition for an element
« Reply #7 on: April 25, 2012, 06:44:13 am »
This is only graphically represented. When you find the Client in t_xref you will find something like
Code: [Select]
@PAR;Name=two;Size=40;@ENDPAR;@PAR;Name=one;Size=40;@ENDPAR;@PAR;Name=<anonymous>;Size=40;@ENDPAR;in the Description (my test has 'one' and 'two' as partitions). Now you need to pull the coordinates from t_diagramobject and make some computation.

q.

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Finding partition for an element
« Reply #8 on: April 25, 2012, 07:38:37 am »
Hi,

Thanks, I already was afraid of this ...
But as mentioned, according the UML 2.3 superstructure definition regions should be respected as 1st class modelling elements for state diagrams.

Best regards,
Günther

Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Finding partition for an element
« Reply #9 on: April 25, 2012, 07:54:12 am »
Good luck with your feature request.

...but even relations are still 2nd class...

And this request will result in a real cross: old models having stored the info in t_xref and new ones with 'real' elements. That will not make life easier.

q.

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Finding partition for an element
« Reply #10 on: April 26, 2012, 02:32:46 am »
BTW: In this case it's easier to get the graphical information directly from the API using the Partitions collection instead of querying t_xref and parse the Description field.
I see potential problems deriving the sub state to region relation getting from the diagram objects though:
  • Theoretically there could be more than one state diagram containing the composite state, which one's the master?
  • Multiple diagrams won't necessarily show the same sub states within the regions (didn't try this so far), this can cause inconsitencies
  • The region can be identified only by order (from top to bottom), since there's no ID
I've been also thinking about to determine sub state orthogonality just from their transition connections. Sub states will build an orthogonal group, if there's no shared path in their vertex/edge graph. But that won't work for the history pseudo state (which is absolutely correct w.o. any connection to the other sub states in the same region IMHO).

What I'm actually trying to do is to translate EA's object model to a neutral UML 2.3 compliant object model (as provided by Geert Bellekens UML Tooling Framework: https://github.com/GeertBellekens/UML-Tooling-Framework).
I'm thinking about submitting a feature request. Don't think it would hurt backwards compatibility with the graphical info stored in the t_xref table so far when an additional ID for the regions would be introduced and sub state elements residing in the region will refer to this ID.
Of course I won't wait for this but just go for the PITA to retrieve the info just from the state diagram  :'(

Best regards,
Günther

PS.: To cite one of our well known companions in this forum, Consistency, Consistency, Consistency!!!  ;)
« Last Edit: April 26, 2012, 04:52:35 am by g.makulik »
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

mtb

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Finding partition for an element
« Reply #11 on: January 31, 2017, 04:04:06 am »
Any updates about this subject?