Profile picture for user m3b

Hello community,

I have serveral models designed like this :

I have a top "structural elements" which contains either

  • "cluster data / models" objects"
  • or  structural objects which contains "cluster data / models" or ... other structural objects

For example :

  • Sales (structural element)
    • Customer (data object)
    • Export control (structural element)
      • Licence (data object)
    • etc

It's like having a top directory containing files or directories.

What I want is : start a report from the top structural element (the root directory) to get all data objects (listing all the files) and list attributes of these data objects

Is it possible using a wysiwyg  report ?  ( I think it is using queries but we cannot publish queries to Aris connect)

Thanks
Regards

Michel

 

 

 

by Kay Fischbach
Posted on Fri, 10/02/2020 - 13:22

Sure thing is possible.

It's easier to explain if you break your problem into two parts:

  1. Identifying with which object to start with
  2. writing a recursively callable function that can process any element in your hierarchy

Identifying with which object to start with

I don't know which connection direction you used to connect your objects, but your topmost structural element must have either no incoming connections, or no outgoing connections. This sets it apart from all other structural elements in your hierarchy and should make it easily identifiable.

Note that your bottom-most objects also only have one of those connection directions, but it should be in a different direction.

You can retrieve a list of all structural object occurrences of a model and then use the javascript .filter(...) method to only keep those that have zero of the undesired connections. What remains should be one occurrence, your root element that stands at the top of the hierarchy.

If you could tell me the exact data type of your objects (API-Names), which connection types are in use (API-Names) and in which direction the connections connect objects, I could give you a sample code which may help you more than just my written explanation.

***

Writing a recursively callable function that can process any element in your hierarchy

Well as the name implies, you need a function to which you can pass one child element after another. The function must correctly write information with the output object and then call itself again on any sub child elements - one child element at a time.

You should be able to pass your root hierarchy element to this function and the function ensures that everything else in your hierarchy is correctly processed.

 

0
by Michel Bénard Author
Posted on Fri, 10/02/2020 - 14:00

Thanks Kay , I was hoping to do it using the wysiwyg tool , but javascript is OK.

  • "structural element"  api-name : ST_ARCHIMATE_GROUP
  • "cluster data / model" api name :  ST_ARCHIMATE_BUSINESS_OBJECT
  • a structural element may
    • aggregate a cluster data objet
    • or aggregate another structural element ;
  • both relation api names are  CT_ARCHIMATE_AGGREGATES 
  • the top structural element has no incoming connection (that is : it is not aggregated by antother object)

 

 

 

0
by Kay Fischbach
Posted on Fri, 10/02/2020 - 15:17

In reply to by m3b

Ok, I can already tell you that it's basically impossible to do with the WYSIWYG tool, because recursion isn't something you can see (it's determined at runtime how many levels deep it has to dive into your hierarchy) and therefore you can't describe what you want with the WYSIWYG editor.

You can do a super-whacky approach with the WYSIWYG editor and just prepare it for 20 levels of depth or something similar and trust that no hierarchy will ever be this deep - but that's not a "solution" I would ever consider implementing if this was my task (plus it would be a ton of work - with the recursive javascript approach you'd only have to describe it once and it would do it no matter how many levels of depth there are).

***

Thanks to the information you provided I was able to draft some code which should help you, if you're willing to go the Javascript code way.

The Javascript approach may be a bit overwhelming if you've never programmed before, but it's not particularly long.

Note: We do not have Archimate, so I'm writing this without actually having the ability to test it. I'm confident in my abilities however, so it should work.

 

Identifying with which object to start with

var selModel = ArisData.getSelectedModels()[0];

var topHierarchyElements = selModel.ObjOccListBySymbol([ST_ARCHIMATE_GROUP]).filter(filterNoIncomingCxn);

function filterNoIncomingCxn(anOcc){
    return anOcc.Cxns(Constants.EDGES_IN, Constants.EDGES_ALL).length == 0;
}

if (topHierarchyElements.length == 1){
    var topHierarchyElement = topHierarchyElements[0];
    processHierarchyElement(topHierarchyElement) // this will start the element processing
} else {
    //encountered a problem - top hierarchy element could not be determined
}

 

writing a recursively callable function that can process any element in your hierarchy

(put this function in the global code scope, just like the code above)

function processHierarchyElement(hierarchyElementOcc) {
    if(hierarchyElementOcc.SymbolNum() == Constants.ST_ARCHIMATE_BUSINESS_OBJECT) {
        //do the information gathering for Archimate Business Objects here
    } else if(hierarchyElementOcc.SymbolNum() == Constants.ST_ARCHIMATE_GROUP) {
        //do the information gathering for Archimate Group here
        
        //processing children of hierarchy element - current element has symbol type ST_ARCHIMATE_GROUP:
        var allOutgoingCxns = hierarchyElementOcc.Cxns(Constants.EDGES_OUT, Constants.EDGES_ALL);
        for each (var singleOutgoingCxn in allOutgoingCxns) {
            if (singleOutgoingCxn.Cxn().TypeNum() == Constants.CT_ARCHIMATE_AGGREGATES) {
                var targetOccSymbolTypeNum = singleOutgoingCxn.getTarget().SymbolNum();
                if (targetOccSymbolTypeNum == Constants.ST_ARCHIMATE_BUSINESS_OBJECT || targetOccSymbolTypeNum == Constants.ST_ARCHIMATE_GROUP) {
                    processHierarchyElement(singleOutgoingCxn.getTarget());
                }
            }
        }
    }
}

***

This code combined will (hopefully) traverse all hierarchy elements.It won't output any information with an output object, simply because I do not know which information you want from each element. I've left comments in the second code block, at the positions where you can retrieve your information and write them into a file with an output object.

1

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks
  • Profile picture for user frankweise
  • Profile picture for user Henrik Buckler
  • Profile picture for user UffeK
  • SS
  • MZ
  • PacMan

Leaderboard

|
Nobody has collected any points yet this week. This is your chance to become one of the top 5 on this week's leaderboard.
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock