One of the main reasons I created my own script library for Sparx EA was to have an efficient way to quickly retrieve and update information for all the child Objects that occur under a given set of parent Objects. From what I can tell, there are 8 main types of Objects: Packages, Elements, Diagrams, DiagramLinks, DiagramObjects, Attributes, Methods and Connectors.
The allowed hierarchy for these objects is:
- Package (child)
- Element (child)
- Connector (represented by the DiagramLink)
- Element (represented by the Diagram Object)
- Element (classifier)
- Element (Parameter Type)
- Element (Return Type)
- Element (source)
- Element (target)
As you can see there is a matrix relationship between these objects where the decedent of one path may end up being it’s own parent, e.g. Element 1 -> Diagram 1 -> Diagram Object 1 -> Element 1.
The getHierarchy function in my script library allows me to specify one or more starting Objects (of the same object type), and specify what child objects I’d like returned (by providing an array of object type IDs).