Improvement: The Open Group ArchiMate Exchange File Format - Folder structure

Started by barrel, February 22, 2016, 14:55:42 PM

Previous topic - Next topic

barrel

Hello all,

We have defined layer on top of ArchiMate, which we also represent in our folder structure.
As example:

* Project
   * Business
      * Semantic View Concepts
      * Legal View Concepts
      * ..
    * Application
      * Semantic View Concepts
      * ...

This works fine using the archi format. When exporting to the open group archimate exchange file format however, this information gets lost. The exported file contains the structure:

Here is a snippet of the output

    <item>
      <label xml:lang="en">Business</label>
      <item>
        <label xml:lang="en">Legal View Concepts</label>
        <item identifierref="id-2d6f43d3" />

However, when this information is imported in Archi, the folder structures disappear. It would be great if this feature can be added

Kind regards,
Barry

barrel

Hello again,

I have been poking around in the code and added some code. In my case, this works and correctly imports all items in a folder structure. I do not know what kind of tests you perform, but it would be great if you could have a look at my code snippet and let me know what you think.

In the XMLModelImporter, the 'parseOrganisation' method is commented out (line 94 current version, in the 'createArchiMateModel'), this should be included:

       
        // TODO Parse Organization - not implemented as yet.
        parseOrganization(rootElement.getChild(ELEMENT_ORGANIZATION, OPEN_GROUP_NAMESPACE));


The parseOrganisation method refers to a parseItem method, where I added a Folder as extra parameter to the call, use null on the first time:
Afterwards, I implemented the 'parseItem' method, which was empty


    @SuppressWarnings("unused")
    private void parseOrganization(Element organizationElement) {
        if(organizationElement == null) { // Optional
            return;
        }

        for(Element childElement : organizationElement.getChildren(ELEMENT_ITEM, OPEN_GROUP_NAMESPACE)) {
            parseItem(childElement, null); // Added NULL to the call for initialisation
        }
    }
   
    private void parseItem(Element itemElement, IFolder parent) {
        // The idea is to see if we can match any referenced elements/relations into a suitable folder
        // and then move them to that folder. At this stage, it's not worth it.

        String idref = itemElement.getAttributeValue(ATTRIBUTE_IDENTIFIERREF);
        IFolder folder = null;
        if(idref != null) {
            EObject eObject = ArchimateModelUtils.getObjectByID(fModel, idref);
            if(eObject instanceof IArchimateComponent) {
            parent.getElements().add(eObject);
            }
        }
        // Folder?
        else {
        List<Element> children = itemElement.getChildren();
        for (Element folderElement : children) {
        String folderName = folderElement.getValue().trim();

        if (!folderName.equals("")) {
        folder = IArchimateFactory.eINSTANCE.createFolder();
        folder.setName(folderElement.getValue().trim());
        if (parent == null) { // First time
        parent = folder;
            fModel.getFolders().add(0, folder);
        }
        else {
        parent.getFolders().add(folder);
                for(Element childElement : folderElement.getChildren(ELEMENT_ITEM, OPEN_GROUP_NAMESPACE)) {
                    parseItem(childElement, folder);
                }
        }
        }
        }
           
        }
    }


As said; comments are much appreciated!

barrel

One remark; this does leave the default 'ArchiMate' folder structure in place. Additionally, there is no sorting on the Folders either.
If you have created sub-folders in the default folders, they will show up twice. In my specific case I have (* indicating a folder added by the import, # indicating a folder in the default structure)

* Application
***Semantic View Concepts
*** Technical View - Application Concepts
*** Technical View - Infrastructure Concepts
* Business
*** Interoperability View Concepts
*** Legal View Concepts
*** Organisational View Concepts
*** Semantic View Concepts
# Relations
* Technology
*** Technical View - Infrastructure concepts
# Views
# Business
# Application
# etc etc


Phil Beauvoir

Hi,

yes the import folder structure was left in a "to do" state. It needs a bit more thought than assuming that a given folder structure can be easily mapped onto an Archi folder structure. For example, other tools may not have the "Business", "Appication", etc top folders so it would require some sensible defaults, hence the inline comment:

        // The idea is to see if we can match any referenced elements/relations into a suitable folder
        // and then move them to that folder. At this stage, it's not worth it.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

barrel

Hello Philippe,

I totally agree, that is why I did not spent too much time on it :-)

It works as it is for me, but indeed poses a few additional questions, what to do with existing folders? We could look if a folder with a name already exists, and use it, but what if we have nested folders, where the parent name is different, but the children have the same name (this is the case for us), what about sorting...

However, I do think that is a nice feature to implement. At the moment, an export from archi -> open xml and import results in "data loss", the folder structure...

Do you think that this feature can be implemented for a future release? You can take the code and modify it to your needs, I am willing to work on it as well....


Phil Beauvoir

Well, all I can say at this stage is that it may be better to wait until a little later in the year. I believe The Open Group have some changes coming.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.


bdendulk

Hi Phil,

In this thread you mention that the folder structure is not imported. However, in my experience it is also not included in the export when using the open group exchange format although there is an explicit option to include or exclude the folder structure when doing an export. Why is that? I would expect that including the default Archi folders poses no problem.

This is in fact a serious issue for my current assignment where (as part of the delivery) I have to hand over my model to the internal organisation which uses Enterprise Architect.

With kind regards,

Bart den Dulk

Phil Beauvoir

Bart:

For the ArchiMate Exchange Format 2.1 the folder structure is not imported into Archi, because of the possible complications that may arise. For example, what if an exporting tool has a mixture of business and application elements in a folder? Given that Archi groups the same element types together what should it do?

For exporting the folder structure, Archi does do this when the option is set. Here's an example of what it does with one element in Business folder


<elements>
  <element identifier="id-0564c34c" xsi:type="BusinessActor">
    <label xml:lang="en">Business Actor</label>
  </element>
</elements>
<organization>
  <item>
    <label xml:lang="en">Business</label>
    <item identifierref="id-0564c34c" />
  </item>
</organization>


When you say it is not exported what do you mean?

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

bdendulk

Hi Phil,

I did find it, however it is stored seperately in the XML file and not shown in the way you showed. In the file I have there is a section which starts with <organization> and then lists al the elements per folder.

WIth kind regards,

Bart

Phil Beauvoir

That's how it works. The Exchange Format uses an abstraction of "organization" and "items". This could be interpreted as "folders" or "table of contents".
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.