<< Click to Display Table of Contents >>
Navigation: Bizagi Studio > Experience design > Advanced topics >
Inheritance in data modeling
One of the key features in Bizagi is how the Work portal empowers knowledge workers with everything they need to make informed decisions while providing the flexibility and support for processes which can be seen as unstructured, because of their high rate of unpredictability or dynamism.
For detailed information on this features and overall concept, refer to Experience design.
Within new features leveraging the possibilities for knowledge workers, Bizagi introduces inheritance in data modeling.
What is inheritance?
Similarly, as the concept in Object-oriented programming (or database generalization/specialization concepts), inheritance allows you to break-down definitions of your objects so that you see them in terms of "sets".
For entity type objects, you would define a base entity (analog to a super-class) from which other entities derive (analog to a sub-class).
Deriving implies that such new entities automatically inherit the properties of base entity, while also being able to extend such properties.
Classical examples for this concept are:
•A car, boat, airplane, or train are all means of transportation. Though transportation concepts apply to all (car, boat, airplane, or train inherit from transportation), each have their own differences.
•Birds, mammals, reptiles, or fish are all animals. Similarly, general animal characteristics are inherited by these all.
Furthermore, you may define an inheritance model in cascade, while having base entities derive from other entities as well.
Referring to the example on how a Hospital's Emergency Room operates, a Doctor stakeholder may request exams for a patient while diagnosing him/her.
Exam is a base entity, from which many specific types of exams derive, such as: a blood test, electrocardiogram, x-rays, pregnancy tests, etc.
All Blood test, Electrocardiogram, or x-rays have their significant differences and own specifics, but these are all exams.
What are the advantages it provides in Bizagi?
When designing your data model, regarding stakeholder entities or any master entity (not applicable to virtualized entities), you may rely on the inheritance concept to optimize how you define data model attributes for best maintainability.
This means that you need to maintain/modify less, whenever additions or changes are made to these entities because derived entities already share the set of actions and attributes defined for its base entity.
But the major advantage to use an inheritance-based model in Bizagi, is that it enables you to use polymorphism, with a new special control that allows for maximum flexibility and adaptability to new entities.
The direct advantage of polymorphism through its special control, is described in the section below.
In order to define inheritance, go into the Expert view and click Entities.
While ensuring you have defined a base entity (e.g., Exam), create and locate an entity which derives from it and right-click it to select Advanced properties:
Go to the Inheritance tab and select the Base entity from which the current entity extends.
In our case the Laboratory extends from Available exams.
Click OK to save the changes.
Verifying the configuration
In order to verify that an entity is configured to extend a definition from another one, you may use one of the following options:
•Browse the attributes of the entity.
Attributes inherited from a base entity will be displayed as read-only.
This means that if you need to change their definition, then you will need to do it at the base entity.
•Use the Show heritage option.
Right-click on the entity and select this option to view a diagram illustrating the inheritance.
The complete inheritance model, including involved actions or attributes, are shown at this point.
Attributes and actions displayed with a gray color means that these are inherited from base entities (in this example, Blood test extends from Laboratory, which in turn extends from Available exams).
In the Children tab you can see all the entities that extend from the selected one (in this example, the list of entities displayed in the tab extends from Laboratory).
Using inherited entities in your processes
After you have created the inherited entity, you can use all the inherited attributes in expressions as a normal attribute.
However, when you use inherited attributes, Bizagi does not show a dependency of the attribute, or entity, with the expression.
If the entity that you are inheriting from has relationships with other entities, you have to keep in mind that Bizagi does not display the relationships between the inherited entity and the parent's relationships.
Polymorphism and the potential of inheritance during execution
Polymorphism (also present in Object-oriented programming concepts), means many shapes.
Based on the definition of inheritance, in which many specific entities reuse a single definition (derived from a base entity), polymorphism implies that Bizagi knows how to handle and create new records at these many derived entities.
A new special control for forms, called the Polymorphic launcher, will be able to smartly create new instances of any derived entity, by parting only from the definition of the base entity.
The potential of this control during execution, is that whenever you need to add a new type of derived entity, the control will automatically interpret all possibilities without demanding you to make any changes in your forms, promoting agility in your implementation through best flexibility and adaptability.
For detailed information about this concept, refer to Polymorphism and constructors.
Exam icons taken from http://dapinographics.com/projects/medical-icon-set/.