Archi: visual connection does not match the model relationship
Fix the Archi message 'visual connection does not match underlying model relationship' with a jArchi script that removes the invalid visual connections.
Archi sometimes reports that a visual connection in a view no longer matches the underlying model relationship. The message looks like this:
In view 'archimate-diagram-model: Example view' : Visual connection serving-relationship with id= 00000000-0000-0000-0000-000000000000 from technology-interface 'DbInterface' to application-component 'AppComponent' does not match underlying model relationship
To see the details of the affected connections, install the jArchi scripting plugin in Archi. The following script, run in the jArchi console, goes through the view connections, prints each mismatch and deletes the invalid visual connection. The approach is described on the Archi forum.
console.show();
console.clear();
$('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");
Notes
- The script deletes the inconsistent visual connections without asking for confirmation: save the model before running it.
- Only the visual connection is removed from the view. The model relationship is not deleted.