Book a Demo

Author Topic: Best way to batch apply tagged value to elements?  (Read 6213 times)

McBie

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Best way to batch apply tagged value to elements?
« on: July 09, 2009, 12:43:54 am »
Hi there,

I'm looking for the best  way to attach a tagged value to almost all elements of our model.
We don't want to attach it  manually to every element, so I'm looking for a kind of automatic way apply it to (almost) all at once.

As far as I  understood Version7.5 has built in scripting support, which might be helpful for this, but we are still with version 7.1.

So I guess this leaves me with the automation interface or is there any other way?

Any comments, ideas are welcome!

Thanks in advance!


mArco


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Best way to batch apply tagged value to elemen
« Reply #1 on: July 10, 2009, 04:33:45 am »
Maybe you could do this with a template package. I don't know if tagged values are among the things you can set up for elements using templates.

Loop up template packages in the EA help. Note that this is a term specific to EA; don't confuse it with template classes and such in UML or programming languages.
No, you can't have it!

McBie

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Best way to batch apply tagged value to elemen
« Reply #2 on: July 10, 2009, 11:56:03 am »
Quote
Maybe you could do this with a template package. I don't know if tagged values are among the things you can set up for elements using templates.
You can set up tagged values at least it worked with the class element.

But this template mechanism works for elements you are going to create.
I need to bulk apply to existing elements.

Part of our elements have stereotypes from our UML-Profile, so for these I can add the tagged value to the stereotype in the profile and sync them to all elements with these stereotypes.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Best way to batch apply tagged value to elemen
« Reply #3 on: July 10, 2009, 11:45:43 pm »
Ouch!

You are correct, there's no easy way to 'retrofit' the elements you already have.

Perhaps a simple one-time add-in is the solution. Nothing fancy, just enough to find the appropriate elements and add the tagged value. You might include a simple UI that asked you (on a yes/no basis) about each package (or diagram or whatever), perhaps by element type. You could keep the add-in around in case you ever got into this position again.

I don't think there's any other quick(er) fix.

But it might be worth holding on for a little while and watching this forum thread. There are a lot of innovative users out here and you are definitely not the first to have this problem. Perhaps someone know of something I've overlooked (it would not be the first time). Or maybe someone has some add-in code they could share with you.

HTH, David
No, you can't have it!

McBie

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Best way to batch apply tagged value to elemen
« Reply #4 on: July 13, 2009, 10:29:05 pm »
I was wondering if the new srcipting feature in 7.5 is a kind of light weight alternative to an add-in.

We haven't don any add-in yet so the the whole "Active X COM" stuff appears to be kind of heavy for just adding a tag.

Do you have experience with scripting within EA?
Would that work for what we want to do (adding a tagged value to existing elements)?

If so , that could be a reason to upgrade to Version 7.5

McBie

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Best way to batch apply tagged value to elemen
« Reply #5 on: July 13, 2009, 10:36:52 pm »
Just adding to my previous post:

The user guide 7.5 says:
Scripts executed in Enterprise Architect have access to the currently open model and are a powerful tool for querying the model in situations that would otherwise require you to perform time consuming and repetitive GUI tasks.

As it says "tool for querying", does it mean I cant do any changes via scripting?

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: Best way to batch apply tagged value to elemen
« Reply #6 on: July 13, 2009, 11:17:35 pm »
Quote
As it says "tool for querying", does it mean I cant do any changes via scripting?

You can do the same things with scripting as with Add-Ins. The API is the same.
Just remember that some scripting languages have limitations. Eg. it is not possible to access the filesystem via JavaScript (without using native ActiveX capabilities of the Windows Scripting Host).
You can also not call a script from a transformation template via EXEC_ADDIN macro- this is left to addins only.

Besides this you can read and write attributes, tags, elements, etc., create ressources, constraint, whatever you want.
Scripting is just not that performant when it comes to large model modifications, there is no comfortable IDE (besides the advanced scripting editor) and it takes some time to feel comfortable with it.

I just finished a hew JavaScripts and JScripts to help me import and modify data models and I can assure you it works :)

Oliver
« Last Edit: July 13, 2009, 11:19:05 pm by ofels »

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Best way to batch apply tagged value to elemen
« Reply #7 on: July 15, 2009, 04:05:59 am »
Hi there!


It might be possible to create an MDA Transform which sets the tags you want, and then invoke the transform specifying the same package as source and target.
Normally, an MDA Transform creates new elements from old; this method might allow you to just add things to old elements. I haven't tried this.

If it's a one-shot affair, and if your elements aren't stereotyped, here's an alternative:

1) Create a profile with a stereotype which contains the tags, and import it into the project.
2) Export the model to XMI.
3) In the XMI file, search-and-replace to add stereotype="TheNewStereotype" to relevant elements.
4) Reimport the XMI file.
5) Synch the stereotype's tagged values.

Should work, but I haven't tested this either.

Good luck!


/Uffe
My theories are always correct, just apply them to the right reality.