Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: g.makulik 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
-
Günther,
Not yet concrete enough for me.
Can you draw a picture?
Geert
-
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.
-
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
-
What is a state region? I thought you were talking about partitions (from activities).
q.
-
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
-
Here's an image of a state diagram with a composite state containing regions:
(http://img43.imageshack.us/img43/7034/statemachinewithregions.png)
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
-
This is only graphically represented. When you find the Client in t_xref you will find something like
@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.
-
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
-
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.
-
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!!! ;)
-
Any updates about this subject?