Book a Demo

Author Topic: Bulk update of elements to new stereotype based on MDG  (Read 6988 times)

tjlindsay

  • EA User
  • **
  • Posts: 21
  • Karma: +2/-0
    • View Profile
Bulk update of elements to new stereotype based on MDG
« on: July 03, 2017, 05:30:14 pm »
Hi,


I've recently created an MDG file which extends the ArchiMate 3 language.  I now want to update my existing elements (say capability element) within a package to my new MDG version of the capability element.  I can make the update manually but this is quite time consuming to go through all elements.  Does anyone know how to automate such a procedure please?


Many thanks in advance,
TJ.

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Bulk update of elements to new stereotype based on MDG
« Reply #1 on: July 03, 2017, 05:45:15 pm »
When you create an MDG you get a toolbox containing elements within your MDG (assuming that you not define your own toolboxes). Either way, open up the toolbox containing your MDG elements (Toolbox | More Tools...)

Right-click on an element within your MDG toolbox
Select Synchronize Stereotype

You should see a dialog display

Click OK

After a while all affected elements will be displayed
Click Cancel

Repeat for all other elements in your MDG

NOTE
This action will update the Tagged Values associated with the stereotype defined within your MDG and I assume this is the update you are referring to

Phil


Models are great!
Correct models are even greater!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Bulk update of elements to new stereotype based on MDG
« Reply #2 on: July 03, 2017, 05:50:28 pm »
I was about to suggest the same as Phil.

When you changed an MDG you will likely not have changed each and every metatype. If so, you did something very bad. Your desire to have the change automated lets me think there's something wrong in what you are asking.

q.

tjlindsay

  • EA User
  • **
  • Posts: 21
  • Karma: +2/-0
    • View Profile
Re: Bulk update of elements to new stereotype based on MDG
« Reply #3 on: July 03, 2017, 06:13:07 pm »
Thanks for the suggestion.  Historically I had used the vanilla 'Capability' element from the ArchiMate 3 language, creating a capability map of 15 or so capability elements.  More recently I have created my own MDG which has profile, toolbox and diagrams set.


I've done as suggested and selected the toolbox, right clicked on 'Capability' and re-synchronised.  This didn't work because the historical 'Capability' element is associated to the vanilla ArchiMate 3 language and not to my MDG version.  I want to transition the existing elements with stereotype 'ArchiMate_Capability' to my version called 'Capability'.  Once done the syncronisation steps mentioned should work.


TJ.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Bulk update of elements to new stereotype based on MDG
« Reply #4 on: July 03, 2017, 06:37:01 pm »
This is a transition rather than a synchronization. You need to scan all elements of the model and change its stereotype from the old to your new MDG. Once that's done you can do the synch operation as noted above. However, I would not recommend doing that stand alone automatically. This is a subtle process. I would do that metatype by metatype and checking for consistency of the model after each transition.

q.

tjlindsay

  • EA User
  • **
  • Posts: 21
  • Karma: +2/-0
    • View Profile
Re: Bulk update of elements to new stereotype based on MDG
« Reply #5 on: July 03, 2017, 07:35:43 pm »
Agreed querty - Are you suggesting a manual transition for each element to the new MDG element?  Or can this be automated in some way, on a per stereotype basis?


TJ

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Bulk update of elements to new stereotype based on MDG
« Reply #6 on: July 03, 2017, 09:13:58 pm »
I would go for a script that transforms a single stereotype. You would need to search all elements with an old stereotype and set this to the new stereotype. That's pretty much straight forward so you can write that in less than 30 minutes. Now after running the script the new stereotype should be synchronized and cross checked. This could be done with all your stereotypes.

Please keep in mind that altering an MDG is like changing the fundaments of a system. It can easily break your whole building. So think twice. Best have a test run with a copy of your model and see what comes out.

q.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1349
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Bulk update of elements to new stereotype based on MDG
« Reply #7 on: July 04, 2017, 07:00:47 am »
There are several ways you can do bulk changes
a) use Import/Export CSV with search and replace or
b) JScript or
c) SQL.

To query the model for existing stereo types you could use some SQL in the search custom query tab.
For example
Code: [Select]
SELECT t_object.Stereotype, Count (*) as NumberOfStereotypes
FROM t_object
GROUP BY t_object.Stereotype
ORDER BY t_object.Stereotype

Search the forum for stereotype conversion code. Here is one example done in JScript
http://sparxsystems.com/forums/smf/index.php/topic,31109.msg225418.html#msg225418
Change the code to add conversion[] array elements you want to change
Code: [Select]
...
// Conversion Array parameters are sourceObject, sourceStereotype, targetObject, targetStereotype
//Add one or more Conversion mappings here
Conversions[0] = new TypeConversion("Requirement", "", "Requirement", "extendedRequirement");
Conversions[1] = ... etc

As Qwerty say's try it out on test model first.

Hope that helps
 :)
« Last Edit: July 04, 2017, 07:06:17 am by Sunshine »
Happy to help
:)