In last week’s post I discussed Entity Inheritance hierarchies, and showed two ways in which the customisation features of PowerDesigner are useful when dealing with them.
I did get some feedback on the sample model I used, and was also challenged to actually list the multiple “Ultimate Parents”. I rose to the challenge, and this posting is the result.
Remember that PowerDesigner allows an entity in Conceptual and Logical Data Models to be a child of more than one hierarchy. As I said last time, I’m not a database specialist so I take advice from other people, and I’ve been told that this multiple inheritance needs to be avoided when designing a relational database, so please don’t shout at me.
This time I’m avoiding a quasi-real-world model, and using a simple set of multiple hierarchies. They’re shown left-to-right here to help me illustrate what’s happening.

It has three levels, and multiple inheritance – the entity Child has three parents, and 3 GrandParents. Parent 2 also has three parents. This situation could be intentional or unintentional (perhaps several modellers are working on their own parts of the model, or models have been merged together).
My model extension provides information about how an entity fits into inheritance hierarchies. I’ve amended the form since last week – this is the entity that has three parents and three grandparents (notice that Parent 3 is also an Ultimate Parent):

All of the information on this form is up-to-date and reliable, because it’s computed every time it’s viewed. The script to create the list of parent entities is simple – PowerDesigner already provides me with a collection of “SuperEntities”, so I don’t need to derive it from the inheritances. Just 12 lines of code are needed to create the list of parent names (if I wanted to sort them, that would take a few more).

The script to create a list of Ultimate Parents is not quite as simple – I have to examine every Parent entity all the way to the top of all the hierarchies to create my list, then make sure I don’t have any duplicate entries. Remember that multiple inheritance could be introduced anywhere in the chain of entities, so I can’t make any assumptions. The total script is about 60 lines of VBScript; here’s the section that handles the simple situation where an entity has one parent entity that does not have a parent (and is therefore also the ‘Ultimate’ parent):

In a large model with a lot of inheritances (the FIBO LDM I downloaded yesterday has 406 of them, some of them 12 levels deep), the processing overhead of working out the list of ultimate parents every time you look at an entity is too much.
Here’s a different approach – it uses the same script to create the list of Ultimate Parents, but it’s run on-demand, by clicking the ‘Refresh’ button to the left of the list:
There we have it, two different ways of running the same script, both of them through the standard user interface.
Okay, it’s time to add a third way of running that script, via a menu. If I right-click an entity in the object browser, I can refresh the list of ultimate parents without even opening the entity properties:

One thought on “Work smarter with #PowerDesigner – the “Ultimate Parent entity” (part 2)”