Author Topic: UML Profile with Metaconstraints and Addin-Scripts  (Read 1859 times)

vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
UML Profile with Metaconstraints and Addin-Scripts
« on: June 15, 2023, 04:17:11 am »
Hello all,

we have an UML Profile, that we recently  extended by MetaConstraints and StereotypedRelationships between Elements. We use both for Toolboxes and ModelValidation.

However we would also use some scripts for input automation and to perform model transformations.
After adding MetaConstraints and StereotypedRelationships to the MDG, neither AddElement nor AddPackage does work.
Did someone have similar issues or an idea what could be the root cause? For our scripts we use both Python and C# via EA API.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: UML Profile with Metaconstraints and Addin-Scripts
« Reply #1 on: June 15, 2023, 05:38:46 am »
What do you mean by AddElement or AddPackage?
I don't know these methods.

If you share the code that is misbehaving we might have a clue about what is going on.

Geert

vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: UML Profile with Metaconstraints and Addin-Scripts
« Reply #2 on: June 15, 2023, 04:53:26 pm »
sorry I meant AddNew() for elements, packages and diagrams.
meanwhile I found out, that in the mdg a metatype has been added to the stereotypes.
as the AddNew() is based on checks using .type of the element, package, diagram the scripts require some adaptions.

our fault then but actually not completely obvious

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: UML Profile with Metaconstraints and Addin-Scripts
« Reply #3 on: June 15, 2023, 05:22:52 pm »
You can use the fully qualified stereotype name in the AddNew operations

e.g. Package.Elements.AddNew("MyComponent", "ArchiMate3::ArchiMate_ApplicationComponent") (there might be typos in the fully qualified stereotype in this example)

That avoids rework when you change the base type of your stereotypes elements.
The only caveat is when you have a stereotype can be applied to multiple basetypes (such as BPMN intermediate events). In that case you'll get one type, but maybe not the one you really wanted.

Geert