Is your feature related to a problem? Please describe it.
When building a model programmatically using Python, a common situation is that you need to create relationships between parent entities that mirror those of children. For example, assume you have system A with container A1 and system B with container B1, then adding a relationship A1 -> B1 usually implies you also have relationships A1 -> B, A -> B and A -> B1 (for example if you are drawing a container view of A then you would want to see the relationship from A1 ->B, or if you are drawing a system context view then you'd want to see A -> B).
Describe the solution you would like.
In Java, this is handled through setting an ImpliedRelationshipStrategy on the Model with three strategies supported out of the box:
It is also possible to prevent invoking the strategy when adding a single relationship by passing createImpliedRelationships=false on Model.addRelationship(). In Python, this would need to be added in Element.add_relationship() which would then pass through to Model.add_relationship().
Describe alternatives you considered
A simpler solution would be to reproduce the earlier Model.addImplicitRelationships() from Java which you call explicitly after adding a relationship, but it would be better to match the newer Java strategy implementation.
Checklist
Is your feature related to a problem? Please describe it.
When building a model programmatically using Python, a common situation is that you need to create relationships between parent entities that mirror those of children. For example, assume you have system A with container A1 and system B with container B1, then adding a relationship A1 -> B1 usually implies you also have relationships A1 -> B, A -> B and A -> B1 (for example if you are drawing a container view of A then you would want to see the relationship from A1 ->B, or if you are drawing a system context view then you'd want to see A -> B).
Describe the solution you would like.
In Java, this is handled through setting an
ImpliedRelationshipStrategy
on theModel
with three strategies supported out of the box:DefaultImpliedRelationshipStrategy
does nothingCreateImpliedRelationshipsUnlessAnyRelationshipExistsStrategy
will skip implied relationships if there is any existing relationship between the potential source and destination.CreateImpliedRelationshipsUnlessAnyRelationshipExistsStrategy
as above but will only skip if the descriptions also match.We should mirror this structure in Python.
It is also possible to prevent invoking the strategy when adding a single relationship by passing
createImpliedRelationships=false
onModel.addRelationship()
. In Python, this would need to be added inElement.add_relationship()
which would then pass through toModel.add_relationship()
.Describe alternatives you considered
A simpler solution would be to reproduce the earlier
Model.addImplicitRelationships()
from Java which you call explicitly after adding a relationship, but it would be better to match the newer Java strategy implementation.