Archi model round tripping with export and import

Started by Mark Backer, May 17, 2020, 09:38:25 AM

Previous topic - Next topic

Mark Backer

The new Archi 4.7 option to import a model into another model is a very welcome feature. This makes it possible for us to distribute changes in our reference architecture model to municipalities. Municipalities can now easily import the changes into their own models based on the reference architecture. And it's possible to integrate projectmodels into our reference model. We are going to use this a lot!

But there is a problem as we use both Open Exchange files and native Archi files. If you export a model to an Open Exchange file with Archi, the IDs of all objects are given a prefix 'id-'. Changing the IDs makes things go wrong with round tripping. If you import a native Archi file into a model which is created by importing an Open Exchange file, all the objects are duplicated. Archi can not match the ID's.

I tested a work around by first exporting and importing the reference model in Open Exchange format and use this model to create an Archi file for importing into the other model. This works, but is cumbersome...

So, my question is: would it be possible to export to the Open Exchange format without prefixing the ID's.

Phil Beauvoir

Hi Mark,

the reason "id-" is prefixed is because standard XML identifiers cannot begin with numbers and Archi's internal IDs sometimes do begin with numbers.

We could change the way Archi's internal identifiers are generated (use some prefix) and then the export to exchange format would not need the "id-" prefix...but...I don't know if this would affect other things such as coArchi or some jArchi scripts that might not expect this new way of doing things.

In fact, I have provisioned for this case already - https://github.com/archimatetool/archi/blob/master/com.archimatetool.model/src/com/archimatetool/model/util/UUIDFactory.java

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

Jean-Baptiste Sarrodie

Hi,

Quote from: mbacker on May 17, 2020, 09:38:25 AM
So, my question is: would it be possible to export to the Open Exchange format without prefixing the ID's.

Unfortunately it is not possible because XML id can't start with a number while universal unique id (used by Archi) can. That's why the "id-" prefix is added.

Quote from: mbacker on May 17, 2020, 09:38:25 AM
Changing the IDs makes things go wrong with round tripping.

As explained several time on LInkedIn and other places, round tripping is not a use-case for exchange file format. This is in fact made impossible because each an every tool has its own way of managing Ids (some simply use the name of the concept!), so this is not going to be supported.

One has to remind that the exchange format is made to share information, not to collaborate on information. That's the same with (e.g.) image format: you share a png or a jpeg but you don't collaborate on such format, collaboration requires native format of (e.g.) Photoshop.

Regards,

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

Phil Beauvoir

#3
@JB apart from the issues of round-tripping we could, in fact, add a "_" prefix on all of Archi's internal generated IDs. This might help in other cases.

EMF has a UUID generator that does prefix "_" on all generated IDs for this reason.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Jean-Baptiste Sarrodie

Hi Phil,

Quote from: Phil Beauvoir on May 17, 2020, 09:46:15 AM
We could change the way Archi's internal identifiers are generated (use some prefix) and then the export to exchange format would not need the "id-" prefix...but...I don't know if this would affect other things such as coArchi or some jArchi scripts that might not expect this new way of doing things.

Nothing relies on the Id structure in jArchi or coArchi (that would have been a really bad software design), so this could work. The only question would be which prefix to add (should be a single character ideally, like "A" for "Archi" ;-)

Of course, this would help only for future models, not the one already created, which would in turn requires to add new checks when exporting to exchange format to add 'id-' only when needed.

Oh, and of course this would work only with models created with Archi, not other tools, so pretty much useless IMHO (in such case why not simply use Archi native format?)

Regards,

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

Jean-Baptiste Sarrodie

That being said, I guess we could add this character to Ids without too much effort, and checking at export is also doable. This would allow Archi to not change Ids coming from open exchange format, so at least we would be better than other tools ;-)

And people can easily regenerate all ids in their model by saving them as template and create a model from this template. So there's an easy migration path too.

Would make sens after all.

Regards,

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

Phil Beauvoir

It's easy enough to do this with a few simple changes. I'll try it.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Phil Beauvoir

Or we could use the "id-" prefix in Archi rather than "_". This would preserve existing exchange files identifiers when re-exporting.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Mark Backer

Hi Phil and JB,

The reason we distribute our model in Open Exchange format is to that municipalities choose their own architecture tool. But a lot of municipalities use Archi and they started and will start their models from an Open Exchange file import. The main reason for this is the softwarecatalogus.nl, a tool where municipalities can share what software they use. And with the softwarecatalogus.nl they can generate an Open Exchange file with their own software plotted on the GEMMA reference architecture.

So much for our use case for sharing and round tripping ..

Changing the internal Archi identifiers will also solve the issue. As long as the id's are equal, the import into another model will sync the matched objects.

Actually we have recently changed the id's in our reference model. As you already mentioned, all tools treat id's different. In our model every object has a property with a GUID, this property is our own tool independent id. We have created a PHP script which replaces all the Archi id's with our own id. This way we can now import models into another model, wich was maintained in different tool.

For new models it would be great if the Archi id's and Open Exchange id's are equal. Totally agree with Phil on the 'id-' prefix ;D

Regards,

Mark

Phil Beauvoir

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

Phil Beauvoir

Archi 4.7 uses the "id-" prefix for all newly generated identifiers.

- All newly generated IDs will be prefixed with "id-"
- When exporting to the exchange format "id-" will be prefixed to the identifier only if the identifier begins with a digit (this will be from Archi < 4.7)

This should solve the original issue.

The aim is to preserve identifiers in all cases - in the *.archimate file and in the exported XML file. Legacy identifiers still might need the prefix if they are non-XML (start with a digit)
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.