Book a Demo

Author Topic: Why do I lose all Profile stereotypes when importing XMI?  (Read 9026 times)

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Why do I lose all Profile stereotypes when importing XMI?
« on: August 26, 2020, 01:35:04 am »
I did an export of a package that had several classes with stereotypes. I used version UML 2.1 for the export and did not export EA extensions. If I use EA Extensions it works, but I have to be able to export without them because the EA extensions contains a lot of information that is not needed for the export.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #1 on: August 26, 2020, 07:17:18 am »
Hello,


Are you sure you've actually lost them?

The stereotypes should be listed as <profile:stereotype> elements after the <packagedElement> elements in the <uml:Model> element, with an attribute for each (non-empty) tagged value.

Stereotypes that are defined in a profile but not used in the model are not included, but that's not to be expected.


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

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #2 on: August 26, 2020, 07:55:10 am »
That section shows up in the XMI, but it's like it never helps when I import the XMI again. Only if I include EA Extensions will it work and even then I had lots of trouble until I inserted the following line:

Code: [Select]
<xmi:Documentation exporter="Enterprise Architect" exporterVersion="6.5"/>

Now the stereotypes are showing up but all this has been guesswork so far.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #3 on: August 26, 2020, 08:08:25 am »
You're hacking a bloody mess. Exporter version 6.5? What should that be? We are pretty much at 2.5.1: https://www.omg.org/spec/XMI/About-XMI/

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #4 on: August 26, 2020, 08:20:40 am »
You're hacking a bloody mess. Exporter version 6.5? What should that be? We are pretty much at 2.5.1: https://www.omg.org/spec/XMI/About-XMI/

q.
It means you should have some idea what you are talking about before shooting your mouth off. Here's the full header from 15.2 exporting XMI 2.5.1.
Code: [Select]
<?xml version="1.0" encoding="windows-1252"?>
<xmi:XMI xmlns:uml="http://www.omg.org/spec/UML/20161101" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:umldi="http://www.omg.org/spec/UML/20161101/UMLDI" xmlns:dc="http://www.omg.org/spec/UML/20161101/UMLDC">
<xmi:Documentation exporter="Enterprise Architect" exporterVersion="6.5" exporterID="1554"/>
<uml:Model xmi:type="uml:Model" name="EA_Model">
Both the UML and XMI versions are in represented by a URI.

6.5 corresponds to when Enterprise Architect added XMI 2 support. Unfortunately, it was hard coded instead of taking the actual version number. It's now a backwards compatibility artifact, while we added exporterID to show the exact build that performed the export.

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #5 on: August 26, 2020, 04:43:21 pm »
My question here however is, for a importing stereotypes, do I have to enable EA extensions or not?

I tried a simple model with some stereotypes and exported it with EA extensions and without and got different results. With EA extensions however there is a lot of extra content that is not required.

For example, suppose a supplier gave us a model in XMI with important stereotype information but that was not developed in EA. How do we get these stereotypes imported as well?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #6 on: August 26, 2020, 05:01:06 pm »
It means you should have some idea what you are talking about before shooting your mouth off.
Oh yes. Silly me. Of course the culprit is EA's documentation. Shouldn't I know what guesswork it means when dealing with EA? Of course I should. Mea maxima culpa.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #7 on: August 26, 2020, 05:34:30 pm »
My question here however is, for a importing stereotypes, do I have to enable EA extensions or not?

I tried a simple model with some stereotypes and exported it with EA extensions and without and got different results. With EA extensions however there is a lot of extra content that is not required.

For example, suppose a supplier gave us a model in XMI with important stereotype information but that was not developed in EA. How do we get these stereotypes imported as well?
You should be able to import models with stereotypes from xmi files, even if they weren't exported from EA.
I had some experience import from MagicDraw and MEGA

But that was before 15.1, where each stereotype has to be fully qualified. I think in theory it should work, but I haven't tried in 15.1, so there might be something broken.

Geert

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #8 on: August 26, 2020, 06:47:21 pm »
Here is a simple XMI for everyone to try to illustrate what I  mean. Try importing it, you will see that the stereotype ApplicationSWComponentType does not import even though it is in the XMI.

Code: [Select]
<?xml version="1.0" encoding="windows-1252"?>
<xmi:XMI xmi:version="2.1" xmlns:uml="http://schema.omg.org/spec/UML/2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:thecustomprofile="http://www.sparxsystems.com/profiles/thecustomprofile/1.0">
<xmi:Documentation exporter="Enterprise Architect" exporterVersion="6.5"/>
<uml:Model xmi:type="uml:Model" name="EA_Model" visibility="public">
<packagedElement xmi:type="uml:Package" xmi:id="EAPK_F18D0037_D9C1_44a7_AC3A_DA7DE16718E2" name="Package1" visibility="public">
<packagedElement xmi:type="uml:Package" xmi:id="EAPK_FD3237DF_2E7B_40ed_90B4_C5756496B3EE" name="company" visibility="public">
<packagedElement xmi:type="uml:Package" xmi:id="EAPK_D351918F_4F89_4d01_B9CB_342BABBB09D3" name="CompositionSparx" visibility="public">
<packagedElement xmi:type="uml:Class" xmi:id="EAID_2FAA7FEE_E985_4285_88F3_31EF89B9F671" name="Class1" visibility="public">
<ownedPort xmi:type="uml:Port" xmi:id="EAID_CE475839_2A6D_49f6_B946_7860EF1FF756" name="Port1" visibility="public" aggregation="composite" isService="false" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_EDECC0D4_42EC_496e_92B6_E5D2BEBBD710" name="Property1" visibility="public" aggregation="composite" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false">
<type xmi:idref="EAID_A6AB5DB9_4051_4a55_B6AD_10F4A9212F3F"/>
<qualifier xmi:type="uml:Property" xmi:id="EAID_AFCC7691_D0A9_499a_BF32_045203140AA0" name="Port2" visibility="private" associationEnd="EAID_EDECC0D4_42EC_496e_92B6_E5D2BEBBD710" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
<qualifier xmi:type="uml:Property" xmi:id="EAID_AFCC7691_D0A9_499a_BF32_045203140AA0" name="Port2" visibility="private" associationEnd="EAID_EDECC0D4_42EC_496e_92B6_E5D2BEBBD710" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
<qualifier xmi:type="uml:Port" xmi:id="EAID_AFCC7691_D0A9_499a_BF32_045203140AA0" name="Port2" visibility="public" aggregation="composite" isService="false" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
</ownedAttribute>
<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_D3551DB7_2886_4b21_8EDC_F2C9A83EE06C" name="Property2" visibility="public" aggregation="composite" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false">
<type xmi:idref="EAID_E3ABDC1B_287E_449a_B032_2D9FA504CE10"/>
<qualifier xmi:type="uml:Property" xmi:id="EAID_E79BD94E_F02B_42a7_8289_E122D7A96977" name="Port3" visibility="private" associationEnd="EAID_D3551DB7_2886_4b21_8EDC_F2C9A83EE06C" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
<qualifier xmi:type="uml:Property" xmi:id="EAID_E79BD94E_F02B_42a7_8289_E122D7A96977" name="Port3" visibility="private" associationEnd="EAID_D3551DB7_2886_4b21_8EDC_F2C9A83EE06C" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
<qualifier xmi:type="uml:Port" xmi:id="EAID_E79BD94E_F02B_42a7_8289_E122D7A96977" name="Port3" visibility="public" aggregation="composite" isService="false" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
</ownedAttribute>
</packagedElement>
</packagedElement>
<packagedElement xmi:type="uml:Package" xmi:id="EAPK_760DAD48_7545_4a92_A253_F36D05552113" name="ifs" visibility="public">
<packagedElement xmi:type="uml:Class" xmi:id="EAID_6F4A0254_1C35_4cc3_876A_96DF6F4EF6C0" name="nq" visibility="public"/>
<packagedElement xmi:type="uml:Class" xmi:id="EAID_B96B25B3_8124_4b6d_BE44_AE291FF6F347" name="nq2" visibility="public"/>
<packagedElement xmi:type="uml:Interface" xmi:id="EAID_DEF4DFF7_7F95_45cd_9D7D_E58F6E5E271F" name="i1" visibility="public" isAbstract="true"/>
</packagedElement>
<packagedElement xmi:type="uml:Package" xmi:id="EAPK_3D29226D_701C_4a54_99C0_BDF644EC9E91" name="Sparx" visibility="public">
<packagedElement xmi:type="uml:Class" xmi:id="EAID_E3ABDC1B_287E_449a_B032_2D9FA504CE10" name="bar" visibility="public">
<ownedPort xmi:type="uml:Port" xmi:id="EAID_A42708D1_80D4_4d4e_9E07_7A6B80A24520" name="p1" visibility="public" aggregation="composite" isService="false" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false"/>
<ownedPort xmi:type="uml:Port" xmi:id="EAID_C9C13069_9348_45be_B480_9527C8888FA1" name="Port3" visibility="public" aggregation="composite" isService="false" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false">
<required xmi:id="EAID_D531337F_71A1_496b_B344_F839AB833021" name="i1"/>
</ownedPort>
</packagedElement>
<packagedElement xmi:type="uml:Class" xmi:id="EAID_A6AB5DB9_4051_4a55_B6AD_10F4A9212F3F" name="Class2" visibility="public">
<ownedPort xmi:type="uml:Port" xmi:id="EAID_5E3BBBA0_E80C_4765_A553_4E905C82126D" name="Port2" visibility="public" aggregation="composite" isService="false" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="false" isDerivedUnion="false">
<provided xmi:id="EAID_AEBFAB57_D0CC_4fa9_AF6E_7CF06673DBFB" xmi:idref="EAID_8BE6A2FD_1AC8_4766_9343_3635908368EE" name="i1"/>
</ownedPort>
</packagedElement>
</packagedElement>
</packagedElement>
</packagedElement>
<thecustomprofile:ApplicationSWComponentType base_Class="EAID_E3ABDC1B_287E_449a_B032_2D9FA504CE10"/>
<thecustomprofile:ApplicationSWComponentType base_Class="EAID_A6AB5DB9_4051_4a55_B6AD_10F4A9212F3F"/>
</uml:Model>
</xmi:XMI>

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #9 on: August 26, 2020, 07:40:08 pm »
Hi again,

Here is a simple XMI for everyone to try to illustrate what I  mean. Try importing it, you will see that the stereotype ApplicationSWComponentType does not import even though it is in the XMI.
Not only that, but if you then try to publish it back out again, EA crashes. This is on 15.1.1528.

So yeah, something is seriously broken.

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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #10 on: August 26, 2020, 07:41:44 pm »
Yeah, exactly the same with 13.5.

q.

P.S. run a consistency check on the imported model and you see EA croak about duplicate stereotypes.

P.P.S. Even after the check EA keeps crashing. Oh well.
« Last Edit: August 26, 2020, 07:45:06 pm by qwerty »

eausernl

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #11 on: February 07, 2022, 09:20:16 pm »
The inability to reconstruct stereotypes (and tagged values) from XMI import without EA extensions seems to be still the case for 15.2.1559 as well as the 16.0.1602 RC. To me this really seems an important issue. What can be done to work around this?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #12 on: February 08, 2022, 08:52:45 am »
I'm not sure if the original poster actually reported the issue.

My notes would be:
  • You will lose information without the EA specific information, it's just a matter of if you're using the information that will be lost or care about it.
  • In the sample xmi below the profile is thecustomprofile, which is what we use when the source stereotypes doesn't come from a profile.
  • There was a comment about needing to put the exporter information back in. If that isn't included the importer won't have any idea how to deal with thecustomprofile at all.
  • Non-profile stereotypes are likely to be dropped importing XMI when they don't already exist in the model and the user doesn't have permission to edit model stereotypes.

What can be done to work around this?
My recommendation would be to export with EA extensions. What is the issue with doing that?

eausernl

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Why do I lose all Profile stereotypes when importing XMI?
« Reply #13 on: February 13, 2022, 07:39:25 pm »
> Non-profile stereotypes are likely to be dropped importing XMI when they don't already exist in the model and the user doesn't have permission to edit model stereotypes.

I guess this was the key issue here for me. I think the documentation would surely benefit from explicitly stating this.

> exist in the model and the user doesn't have permission to edit model stereotypes

I have the premonition that these things in my case didn't matter, but I can't fully judge. It seems that "non-profile stereotypes are dropped period". But I can't fully judge that being unaware of the internal details.

The good news is that indeed publishing the stereotypes as a profile and importing that prior to importing the XMI works (so far) as expected. So most of my issues are solved.

> My recommendation would be to export with EA extensions. What is the issue with doing that?

The issue would be twofold: (a) interoperability with other tools (b) creating a canonical minimal representation for version control.

But as said, so far the route with profiles gives me some hope. I think incorporating the limitations of customprofile with XMI import without EA extensions could be noted in the exporter documentation. I don't think it's an unreasonable limitation per se, just novices in this field such as me might appreciate the heads up.