jArchi - generate views using graphlib

Started by Hervé, February 05, 2019, 16:41:22 PM

Previous topic - Next topic

Hervé

Dear all,

I discovered few weeks ago the jArchi plugin (https://www.archimatetool.com/plugins) and really believe it is a great tool as it simplifies automation, where a full Java plugin was necessary before.

I'd like to share with you a script I developed under jArchi  that automates the view creation. My use case is simple: when I copy Archi elements in a view, the elements are placed one next to the other but I miss an automatic placement that take in account the relationships between them (a kind of visualizer but in an Archimate view).

So I've written some scripts that allow to do this automatic placement, based on a graph created using the Dagre library, based on Graphlib and Lodash.

The main script is called generate_view.js and is not meant to be called directly by jArchi but receives all its required information through parameters. Four AJS scripts are provided as jArchi front-ends but many more could be easily written to fulfill specific needs:

  • generate_views.ajs: displays a graphical interface that allows to select the type of view to create
  • generate_one_view_per_application_component.ajs: generates one view per application component with all the elements having a relationship to or from them
  • generate_single_view_from_all_concepts.ajs: creates a single view containing all the concepts in the model
  • generate_single_view_from_selected_concepts.ajs: creates a single view containing all the concepts that are selected in the model

To install them, copy the ZIP content to you scripts folder (%appdata%\Archi4\scripts on Windows) including the generate_view folder that contains all the required libraries, select a model or some concepts and run one of the provided scripts.

Of course, you must have the jArchi plugin to be able to run them.

At the moment, the scripts have got the following known limitations:

  • The Graphlib library does not allow to create relationships with group elements, therefore when creating views with nested elements, the relationships with elements that contain other elements do not participate to the graph position.
  • The connections between the elements in the graph are straight lines (bendpoints are not created yet)

Please do not hesitate to provide comments and improvement requests.

Best regards
Hervé

Phil Beauvoir

Hi Hervé,

this is pretty cool. I tired it and it works. 8) Thanks for sharing.

This goes to show what can be achieved with the jArchi scripting plug-in and some ingenuity. I hope other folks can make use of it!

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

Hervé

Yes, quite limited, but it works enough for my needs ...

As you may remember, I get a copy of my CMDB (applications, servers, relationships between them, etc ...) into Achi through my ServiceNow Import plugin. But with 1104 applications, I cannot afford to create views manually.

Si my first need is to generate them automatically ...

jArchi is very powerful ... And I'm event thinking about migrating one or two plugins from Java to jArchi (like the ServiceNow Import plugin). They would be much more easy to maintain ...

ievgenii

Hi Hervé,

Thanks for the script - looks promising. I was just missing something similar in Archi because relations become messy on big models. Would be great to have auto-routing like on attached sample (which BizzDesing does)

Regards,
Ievgenii

Hervé

Hi,

Indeed ... If you develop such script, I'm very interested :-)

Best regards
Hervé

casacde

Hello Hervé,

many thanks for these incredibly useful scripts! Have just tested these and they work great!
I've been working with Archi for some time and slowly realize the incredible potential that lies in using Archi in conjunction with jArchi and (for example) Neo4j.
Thanks a lot!

Regards, Carsten

vegardv

This is *very* useful. Thank you for providing this.

I have created some scripts for generating models from our CMDB, and I needed a way to generate a view based on a newly created element. I created a naive patch (attached) to the main script so that I can pass an actual element in 'param.concepts'.

Have you considered registering this in a public repo (github, gitlab)?

Hervé

Hi,

My scripts are very limited and I was waiting for some improvements before publishing the to public repo. unfortunately, I lack time to work on them at the moment  :-[

Best regards
Hervé

Manj75

Hi Herve,

I've just reconnected with using Archi and had forgotten about this very useful jArchi script.  I was wondering if there's been any newer version of this script or if it's planned for any active developed for improvements.

Regards, M

Hervé

Hi,

Unfortunately, the graphlib library still lacks important features to be very usefull :
    - It does not allow to create relationships with group elements, therefore when creating views with nested elements, the relationships with elements that contain other elements do not participate to the graph position.
    - The connections between the elements in the graph are straight lines (bendpoints are not created yet)
    - It is not possible to create relationships to or from relationships

Thats the key reasons why I stopped working on this javascript. But if you know a better libray, I can have a look :)

Best regards
Hervé