Error "Diagram connection relationship has wrong target end"

Started by Martine, March 03, 2023, 09:08:37 AM

Previous topic - Next topic

Martine

Hello,
since I refreshed my model I have an error "wrong target..." yet the validation of the model does not display any error. I cannot save and exit anymore.
Can anyone help me fix this?
(Archi 4.10)

Phil Beauvoir

Hi Martine,

is this error occurring when you are doing something with coArchi?

Phil
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Martine

Hi Phil,
I use CoArchi.
I did a "refresh", the refresh went well, there was a conflict on a relationship it seems to me, I said to keep the relationship that was on the GIT and everything ended well.
But when I tried to exit I got this error....

Phil Beauvoir

If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Martine

Hi Phil,
I couldn't find any help on the given post unfortunately.
On the other hand, I was able to find a solution by using the export that I had just done on a database.
I made queries using the id provided in the error code, which gave me the name of the relationship concerned ("views_connections" table for those who have the database plugin).
As the error message mentions the name of the view on which there is an error, I went to delete this relation on this view and it worked.
However, I don't see how this could have happened or why the validation does not see it...

Best regards
Martine

Jean-Baptiste Sarrodie

Hi,

This is indeed the same issue as the one described here - https://github.com/archimatetool/archi-modelrepository-plugin/issues/136

Quote from: Martine on March 03, 2023, 10:48:40 AMI couldn't find any help on the given post unfortunately.

You had to run the provided jArchi script.

BTW, here is and enhanced version of this scrcipt:
console.show();
console.clear();


$('relationship').each(function(r) {
  if (! $.model.isAllowedRelationship(r.type, r.source.type, r.target.type)) {
    // One way to solve the issue is to delete the model realtionship
    // r.delete();
    console.log(r.type, " with id=", r.id, " from ", r.source.type, " '", r.source.name, "' to ", r.target.type, " '", r.target.name, "' is not valid");
  }
});

$('view').find('relationship').each(function(connection) {
  var relation = connection.concept;
  var relationSource = relation.source;
  var relationTarget = relation.target;

  var connectionSource = connection.source.concept;
  var connectionTarget = connection.target.concept;
 
  if (connectionSource.id != relationSource.id || connectionTarget.id != relationTarget.id) {
    // Another approach could be to create another model relationship and to add it to the view instead of the unvalid one (more complicated to implement)
    console.log("In view \'", connection.view, "' : Visual connection", relation.type, " with id=", relation.id, " from ", connectionSource.type, " '", connectionSource.name, "' to ", connectionTarget.type, " '", connectionTarget.name, "' does not match underlying model relationship");
    // One way to solve the issue is to delete the visual connection:
    // connection.delete();
  }
});

console.log("End of validation");

This code looks for connections and checks whether or not the connection's ends match the underlying relationship's ends. If not, the connection is listed on the console so you can check by yourself. If you want, you can even uncomment the deletion.

Quote from: Martine on March 03, 2023, 10:48:40 AMHowever, I don't see how this could have happened [...]

This can be raised by some very specific list of operations with coArchi. The idea is that in some occasion someone can edit an already existing relationship (e.g. a relationship was created between A and B but is now between A and C), while at the same time someone else creates a new view using the first version of the relationship. When publishing (and thus merging) both changes, you might end up with a model containing both the new version of the relationship (from A to C), but a view showing you this relationship in its original state (thus a visual connection from A to B) which is no more conform.

Quote from: Martine on March 03, 2023, 10:48:40 AM[...] or why the validation does not see it...

The Validator validates the use of the ArchiMate Language, not the "technical" integrity of the model.

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Martine

Hi Phil,
Sorry, my English is not very good, I was not sure to understand everything because the post was very long and with several problems.
Also I don't have the Jarchi plugin so I couldn't run the script.
Thank you for your detailed and simple answer :-)

Best regards,
Martine