Finding the Root

Started by René, February 26, 2021, 12:55:05 PM

Previous topic - Next topic


I wanna write an export script to get all capabilities in an hierarchical order, set by composition relationship. For this I have to determine one (or maybe more) root objects.

A root object means: this one has no inRels for Composition Relationship.

I have no glue how to catch them best. A simple solution: Making an further element called "root" and combine the root(s) manually with Composition Relations.

But I'm sure there must be a better solution. I thought not() - but this function gave me every relation except the named one. Is there a better way to filter it?

Phil Beauvoir

Hi, as with any jArchi adivce, the best thing to do is post part of the jArchi script that you have tried (just the relevant part).

Also, a simple numbered sequence of what you are trying to do - e.g "1. Iterate through all concepts 2. Find all concepts that match critieria x 3. etc"
If you value and use Archi please consider making a donation. :-)

Jean-Baptiste Sarrodie


You have to use the filter() function on a collection to check if there's no incoming composition relationships.

Here's a small example:

function isRoot(e) {
  return ! $(e).inRels('composition-relationship').size()

function doSomething(e) {



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


@JB: Thanks. That's perfect.