Book a Demo

Author Topic: Duplicated relationship - how to delete safely  (Read 7541 times)

MaXyM

  • EA User
  • **
  • Posts: 120
  • Karma: +8/-0
    • View Profile
Duplicated relationship - how to delete safely
« on: April 24, 2019, 11:28:02 pm »
From time to time I find duplicated relationship between elements (let's say between components).
I expect that one of those relationships has been created incidentally and is probably used on some diagrams. Hard is to find which one is the bad one.

Could you share your workflow to get rid of redundant one (less used) in a safe way, incl help with fix all affected diagram.

with regards

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Duplicated relationship - how to delete safely
« Reply #1 on: April 25, 2019, 04:13:47 am »
That's probably not trivial since sometimes you DO have duplicates intentionally. To get them out you need to get all t_connector entries and build a hash of connectorId/source/target plus connectorId/target/source and sort that for (1:target, 2:source). no you  go through that list and make sub-lists for identical target/source connectors. Any list that has more than 2 entries is one of the suspects you look for. Good luck.

q.

MaXyM

  • EA User
  • **
  • Posts: 120
  • Karma: +8/-0
    • View Profile
Re: Duplicated relationship - how to delete safely
« Reply #2 on: April 25, 2019, 09:13:56 pm »
Thanks, fair enough. Working directly with DB would be a way for me, Unfortunately not to all EA users are capable enough.
It's pity, EA's option "Find in all diagrams" is not applying to connectors. 

We found the quickest but dirty way: to remove all redundant connectors from the element, and create single one instead. The side effect is that such new created connector will appear on all diagrams where 2 connected elements exists, and it's shape will be different, likely suboptimal.

with regards

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Duplicated relationship - how to delete safely
« Reply #3 on: April 25, 2019, 10:07:40 pm »
You can suppress appearance of new connectors in other diagrams (there is some menu option somewhere) though I don't see the point in doing that. That always looks like people put the diagrams on first place, not the model.

q.

MaXyM

  • EA User
  • **
  • Posts: 120
  • Karma: +8/-0
    • View Profile
Re: Duplicated relationship - how to delete safely
« Reply #4 on: April 25, 2019, 11:07:19 pm »
Yes, I know that feature.
But this time appearing of the new relation on all diagrams is kinda desired behavior. It's because it replaces (potentially) previously existing relation, removed together with redundant one.
Quote
That always looks like people put the diagrams on first place, not the model.

Because a diagram is most natural tool to add relationships between elements probably...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Duplicated relationship - how to delete safely
« Reply #5 on: April 25, 2019, 11:29:40 pm »
A diagram is a view on the model. Multiple diagrams are multiple views on the model. Adding a relationship changes the model (irrelevant where this addition is made). Naturally all created views (showing that aspect) are affected.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Duplicated relationship - how to delete safely
« Reply #6 on: April 26, 2019, 01:02:11 am »
Technically it is possible to merge a "duplicate" relation before deleting it.
You could write a script to do so. This could then ensure you keep your nicely formatted relations and don't mess up the diagram layout.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Duplicated relationship - how to delete safely
« Reply #7 on: April 26, 2019, 09:40:44 am »
Technically it is possible to merge a "duplicate" relation before deleting it.
You could write a script to do so. This could then ensure you keep your nicely formatted relations and don't mess up the diagram layout.

Geert
Hi MaXym,

We do this as part of our "Consolidator" technology.  There are a number of things to consider.
  • What constitutes semantic equivalence between two arcs connecting the same two vertices?
  • You then need to decide which arc is to be retained and which merged with the retained.
  • For non-key properties, which value takes precedence, the retained arc or the merging arc?  We took the view that if the retained arc property had an intrinsic value (as opposed to missing or extrinsic) and the merging property also had an intrinsic value; then the base value took precedence, but the conflict noted in the logs.  Otherwise, the intrinsic value overwrote the non-intrinsic value.
  • As Geert noted, you need to replace the merged arc on diagrams with the retained arc.  Where both are present on the same diagram, you can just remove the merged arc.  Otherwise, you'd think you could just replace the merged Connector_ID with the retained Connector_ID for the merged DiagramLink, but a defect in the API will "bite you".  You can, however, do it simply with direct DB SQL.
  • Finally, don't forget to purge the merged arc from the repository - including ALL its dependent properties.

I think that's all.  It's non-trivial, but not quite "rocket science".

HTH,
Paolo
« Last Edit: April 26, 2019, 09:43:43 am by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!