jArchi Plugin: Support for external Javascript libraries and script files.

Started by mohitd, August 19, 2022, 16:52:51 PM

Previous topic - Next topic

mohitd

Greetings,

I am working on a problem statement involving adding some transformation to the EA models based on mathematical computations.

I am trying to achieve these transformations on EA models via a script using the jArchi scripting plugin version 1.2.0. and the version of Archi I am using is 4.9.3. And I am also using JDK 11 with HotSpot JVM from Eclipse Adoptium (previously, AdoptOpenJDK ), which ships with the Nashorn scripting engine.

Now, I know that we can use external libraries like PapaParse using
load(__DIR__ + "lib/papaparse.min.js");
which works fine, but when I try to add a library like
load(__DIR__ + "lib/math.min.js");
the scripts fail to execute because of the Nashorn scripting engine.

After reading the documentation, I understood that the engine shipped with the JDK does not support all features of ES6 and has full support until ES 5.1. The documentation for the engine says it supports scopes like let and const, but when I run the script from the plugin, it fails. Also, the arrow function expressions commonly used in the foreach loop of JS are not working because of the lack of support from the JS engine.

With the above background information out of the way, I have the following questions,

  • What JS libraries are supported by the jArchi plugin?
  • Is math processing, especially matrix multiplication, possible inside a script?
  • What would be a viable solution for use cases involving matrix computations for EA models?

Thank you,
Mohit

Phil Beauvoir

Try it with the GraalVM engine which has been present in jArchi for some time. Just select that engine in Archi's preferences.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

mohitd

Hi Phil,

Thank you for your prompt response. I am very new to Archi, and I didn't know we could change the engine from preference. Thank you so much. This feature will save a lot of time.

Kind Regards,
Mohit