问题
I found this sentence in article about XMI on wikipedia:
At the moment there are several incompatibilities between different modeling tool vendor implementations of XMI, even between interchange of abstract model data.
I wondered how it is possible that, despite using a well-documented standard, tools are not compatible. After looking through documentations of UML and XMI and through other people's questions I found out that there is no XML scheama or DTD for UML models saved as XMI.
According to the best answer to this question -https://stackoverflow.com/a/36885550/9329778 -the correct approach to check if XMI is well formed should be to validate/process it through a conforming UML model.
I also found this in XMI 2.5.1 documentation in section "7.3.2 Model Class Representation":
By default, XMI allows you to serialize features using either XML elements or XML attributes; however, XMI allows you to specify how to serialize them if you wish.
This looks to me like a source of the problem.
My questions are:
Is there an official guide that strictly describes how to save UML model using XMI? I don't mean the UML syntax meatamodel (which can be downloaded from OMG website).
If the answer to the first question is "no" - does it mean that different modeling tools can perform serialization of the same UML model differently even if they use the same version of XMI?
回答1:
- the reference is this current document by OMG
- Though there is a "standard" the people which defined it are from different vendors under the hat of OMG. Of course every vendor tries to keep his sheep dry and warm (and likely if possible leave those of others in the rain - well). This simply lead to a standard which is open to anyone. While OMG ("trying" to holding its hand over such standards) allowed the addition of vendor individual extensions to pass, each vendor took advantage and used this addendum to his own favor. And that's what we see in different fora: why can't I import my model (completely/at all) from vendor A's tool into vendor B's tool. It's a cross.
Note: regarding 1: No. You can not take this document and create XMI from a model. It's not written that way. What I did was to create a simple model, export it (from my favorite tool) and see what had been created. Then I tried to import that into another tool (finding to where it fails). Or even export and import in the same tool to find what was missing afterwards.
来源:https://stackoverflow.com/questions/50162752/saving-uml-model-as-xmi-ambiguity