Reversing a related attribute

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Data Modeling > Relationship types >

Reversing a related attribute

Overview

Occasionally a relationship between two entities is defined as a Related Attribute relationship. This relationship allows visibility from one entity, but not the other.

 

Indirect_2

 

In this case, an instance of Entity A has one Stakeholder related, but the Stakeholder does not have any relationship with Entity A instances. This situation may lead to unnavigable Xpaths and finally a process hard to automatize.

 

Bizagi allows the data designer to reuse the relationship already defined to create a new one-to-many relationship. This allows both entities to navigate through each other. Therefore, the design becomes easily navigable through Xpaths.

 

Indirect_5

 

Once the relationship is configured, each Stakeholder instance will have one or many instances related to the Entity A, and the Entity A will be aware of its relationship with the Stakeholder instance.

 

This procedure avoids the loss of data already stored in the database, making it ideal to redefine a relationship previously deployed.

 

note_pin

In case you only need navigability to display collections in the My stuff section of the Me Menu in the Work Portal, consider using Indirect Collections instead of reversing a related attribute. To learn more regarding indirect collections, follow this link.

 

Re-utilization procedure

Having two entities with a Related Attribute relationship, create a new one-to-many relationship from the entity with any visibility over the other entity. In this case a Cargo in the data model has been defined as related with a Freight Dispatch. Nonetheless, we want every Freight Dispatch instance to be related with all its correspondent Cargo instances, making easy to navigate with Xpaths through the data model.

 

reversed_relationship1

 

The creation of a new one-to-many relationship can be performed through the edition of the current attributes of the entity. Right-click the entity with no navigation, in this case Freight Dispatch, and select Edit attributes.

 

reversed_relationship2

 

Add a new collection of the entity Cargo.

 

reversed_relationship3

 

Once the entity Cargo is selected, a window will appear prompting if you want to reuse the foreign key stored in the entity Cargo. Select the attribute (the attribute displayed is has been defined in the entity Cargo). Finally select Ok to save.

 

reversed_relationship4

 

Now a new one-to-many relationship replaces the previous one, and the foreign keys stored in the entity Cargo are being reused in this relationship.

 

reversed_relationship6