Archi Forum

Archi Plug-ins => coArchi => Topic started by: klindley on January 26, 2021, 13:15:22 PM

Title: Error when trying to Import Remote Model to Workspace
Post by: klindley on January 26, 2021, 13:15:22 PM
Hi,

I'm having a problem when trying to Import Remote Model to Workspace.

The model was created in version 4.6.0 build 2019111111111 and passes all validations tests (green tick).

However when I try and import this model to a 4.7.1 build 20207151058 client I get the following error message (see attachment):

Error in model

Diagram connection relationship has wrong target end component 'view name' GUID.


I have checked the views and they seem valid. The problem is that Archie won't load the model and just sits there so I can't even investigate what is wrong.  Does anyone know if:

Any advice or suggestions welcome.

I do have another client with 4.6 loaded so I can make changes and refresh the model before trying to pull it down to my 4.8 client.

Kind Regards
Kevin.
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: Jean-Baptiste Sarrodie on January 26, 2021, 14:41:20 PM
Hi,

That a know edge case. This happens because your model got somewhat corrupted but older versions of Archi was not trapping this specific case. Archi 4.7 includes better controls on this and now doesn't allow you to load or save the model (which is one of the steps done automatically by coArchi).

The source of this corruption is most certainly a conjuction of someone merging concepts (through a jArchi script) while someone else created or updated a view involving the same concepts being merged. This might lead to a visual relationship in a view to target a concept which is not the same as the one declared in the real relationship inside the model.

To solve this, you have to import your remote model into Archi 4.6 and run the following jArchi script:

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");


This script will log and delete any corrupted connection. Simply commit and publish the result and you should be able to import it in Archi 4.7 or 4.8.

Regards,

JB
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: Phil Beauvoir on January 26, 2021, 14:48:22 PM
Thanks for answering this, JB.  :)

There's also more information here - https://github.com/archimatetool/archi-modelrepository-plugin/issues/136

We will be working on a new version of coArchi, and this issue won't arise then.
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: klindley on January 26, 2021, 16:47:50 PM
Hi, JB.

Excellent, fixed my problem 100%.

In my 4.6 version, I commented out the connection.delete line (yeah I'm a coward) in your script, ran it then looked up the faulty connections on my views. Took a few snapshots (just in case) then ran the script with the connection.delelet back in and then double checked my model against my snapshots. Finally added the 4 removed connections, checked in my model to GitHub. Then in my 4.7.1 version pulled the model and VoilĂ , I was able to open my model no problem!.

Really appreciate you taking the time to help me fix this.   :)

Kind Regards
Kevin.
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: Jean-Baptiste Sarrodie on January 26, 2021, 17:06:08 PM
Hi,

Quote from: klindley on January 26, 2021, 16:47:50 PM
Excellent, fixed my problem 100%.
Really appreciate you taking the time to help me fix this.   :)

You're welcome.

That's Phil & I philosophy ;-)

Let me know when you'll find paid software support quicker than our free community support ;-)

Regards,

JB
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: Jean-Baptiste Sarrodie on January 26, 2021, 17:08:38 PM
Re,

Thinking about it...

@Kevin, there's something you could do in return: would you mind writting a small wiki page on https://github.com/archimatetool/archi/wiki to describe the issue you faced and the solution provided? I'm sure this could help other people in the future.

Regards,

JB
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: Phil Beauvoir on January 26, 2021, 17:15:58 PM
@JB

> The source of this corruption is most certainly a conjuction of someone merging concepts (through a jArchi script)

I managed to reproduce this once by renaming (and perhaps other changes) and moving a concept to a different sub-folder. Git calculated that there were enough changes made to see it as a different file (because of the move to a sub-folder)
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: BuilderBob on July 12, 2021, 14:33:30 PM
Hi, this post says you must use Archi 4.6 and then run the command using JArchi but JArchi requires 4.7?.... So how do I get this to work?

I experience the same error. Where do I get the JArchi console? I tried to install JArchi in to Archi 4.6 but I dont see a menu item anywhere after the install and restart.

Quote from: Jean-Baptiste Sarrodie on January 26, 2021, 14:41:20 PM
Hi,

That a know edge case. This happens because your model got somewhat corrupted but older versions of Archi was not trapping this specific case. Archi 4.7 includes better controls on this and now doesn't allow you to load or save the model (which is one of the steps done automatically by coArchi).

The source of this corruption is most certainly a conjuction of someone merging concepts (through a jArchi script) while someone else created or updated a view involving the same concepts being merged. This might lead to a visual relationship in a view to target a concept which is not the same as the one declared in the real relationship inside the model.

To solve this, you have to import your remote model into Archi 4.6 and run the following jArchi script:

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");


This script will log and delete any corrupted connection. Simply commit and publish the result and you should be able to import it in Archi 4.7 or 4.8.

Regards,

JB
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: Phil Beauvoir on July 12, 2021, 14:40:42 PM
Quote from: BuilderBob on July 12, 2021, 14:33:30 PM
Hi, this post says you must use Archi 4.6 and then run the command using JArchi but JArchi requires 4.7?.... So how do I get this to work?



For Archi 4.6 you need an earlier version of jArchi (version 0.8.0). I can get that to you.

But there may be a better way...

The issue is that Archi 4.7.1 and later won't let coArchi save the model because it checks its integrity. But in the latest beta version there is a switch to turn this off.

1. Download Archi 4.9 Alpha (Windows zip) from https://www.archimatetool.com/beta/
2. Unzip it
3. Edit the Archi.ini file and add -noModelCheck as the first line

Now try again.
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: BuilderBob on July 12, 2021, 14:47:04 PM
Thank you very much. Can you please mail me a link the 0.8.0 version of JArchi? I joined the patreon especially to get JArchi.

I would rather not risk using a Alpha and if I did it would mean the other collaborator would have to upgrade aswell to 4.9 Alpha. The risk is to high for this.

Quote from: Phil Beauvoir on July 12, 2021, 14:40:42 PM
Quote from: BuilderBob on July 12, 2021, 14:33:30 PM
Hi, this post says you must use Archi 4.6 and then run the command using JArchi but JArchi requires 4.7?.... So how do I get this to work?



For Archi 4.6 you need an earlier version of jArchi (version 0.8.0). I can get that to you.

But there may be a better way...

The issue is that Archi 4.7.1 and later won't let coArchi save the model because it checks its integrity. But in the latest beta version there is a switch to turn this off.

1. Download Archi 4.9 Alpha (Windows zip) from https://www.archimatetool.com/beta/
2. Unzip it
3. Edit the Archi.ini file and add -noModelCheck as the first line

Now try again.
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: Phil Beauvoir on July 12, 2021, 14:51:22 PM
Quote from: BuilderBob on July 12, 2021, 14:47:04 PM
Thank you very much. Can you please mail me a link the 0.8.0 version of JArchi?


I sent you the link via email.

Note - Archi 4.6 will share the same dropins folder as your current version of Archi, so jArchi will be replaced by the older version. When done, you can re-install jArchi 1.1.0 in Archi 4.7.1.
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: BuilderBob on July 12, 2021, 15:29:30 PM
Thank you very much. I am sorted and everything is working.
Title: Re: Error when trying to Import Remote Model to Workspace
Post by: wnad on February 22, 2022, 12:20:07 PM
hi

I try with archi 4.9 and archi.ini modifie with -noModelCheck but I have the same message does not match etc..