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?
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.
Related
I am trying to develop an OWL ontology based on different UML file resources presented in XMI format. Reading through the internet for a while now, it seems that almost all the available tools or approaches are outdated and even when trying some of them they don't provide the expected outcome.
Since this ontology plays a really important role in our project, I wanted to know what is the best approachs/tools to be used in order to convert UML to OWL ?
I have looked into this myself as well and I have found no tools that can do this satisfactory. Problems I ran into were either the tools used an old version of UML, did not support all UML features, used OWL 1 rather than OWL 2 and was supported by only an old version of Protege.
I resorted by doing the translation by hand, which for most UML constructs are not too difficult. For this purpose I have done a write-up on UML vs OWL, which gives an intuitive explanation for why some of the translation is done in a certain why, as well as provide a reference for translating UML to OWL.
There's an OMG spec now available at https://www.omg.org/spec/MOF2RDF/
I haven't yet found an open-source tool implementing this directly (i.e. convert from UML/XMI to OWL/RDF), but there are EMF related activities, that may be relevant (haven't tried), e.g.:
https://github.com/ghillairet/emftriple
You'll probably never get exactly what you want unless you do it by hand, as Henriette mentioned. One viable option is using COGS, which I've found to work pretty well.
The catch is that it's related to Rot's answer by supporting the OMG specification. If it's not much work to make sure that your UML conforms to that specification, it may save some time in the long run. Here's an example of an OWL file produced by COGS.
I have designed UML diagrams in different tools (StarUML, BoUML, Papyrus, Omondo, Rational Rose, etc.) depending on the project and the date (rose was first, after Omondo, then starUMl, ..., now papyrus). However, I see that I cannot open my old UML diagrams because the tool is obsolete.
I would like to know if there is a standard format for UML diagrams. Probably not in production, but at least to know if there is proposal of standard format.
Probably, Eclipse is doing something like that with the M2 project, but do the other tools (not eclipse based) are interested in reading this format.?
Each UML tool uses its own format, but I think the era of proprietary format is over, and open format for diagrams like this should exist.
I have two answers to this:
In theory the standard exchange format for UML models is XMI but it´s true that each vendor implements a slightly different version so interchange is not a reality. Nevertheless, most tools are converging to at least support the Eclipse MDT-UML2 XMI implementation which in my opinion is becoming de facto XMI standard.
The OMG is working on a new standard : Diagram Definition that is supposed to fix the problems with the current XMI one (they are working a lot with many of the top vendors to make sure that this time they all go in the same direction) and, also important, it will allow to interchange not only the data (i.e. the info about the model elements) but also the layout and graphical representation so that after the import you get a model exactly as the same you exported in the first place
Have you heard of XMI?
#JordiCabot here adds some interesting details about it.
Besides Jordi's reference to the Diagram Definition standardization activity, please note that there is another action ongoing from OMG:
a request for comments has been issued in June 2011 for a CANONICAL XMI format, which is basically a subset and a set of additional rules for writing XMI documents that should limit the possibility of creating different XMI dialects, or at least should allow tools to understand a common dialect (the canonical one).
I was reading this Wikipedia page on UML 2 package diagrams. This page mentions a relationship of merge between 2 packages.
Quoting the article:
"A package merge is "a directed relationship between two packages, that indicates that the contents of the two packages are to be combined. It is very similar to Generalization in the sense that the source element conceptually adds the characteristics of the target element to its own characteristics resulting in an element that combines the characteristics of both"
Somehow I just cannot grok this concept of package merging.
Has anyone used this in their modeling? Can anyone give me a real example of where and why you would use package merge.
The wiki quote is right from the OMG spec, as the reference indicates. Two things. The OMG spec goes on to say:
This mechanism should be used when elements defined in different packages have the same name and are intended to
represent the same concept. Most often it is used to provide different definitions of a given concept for different purposes,
starting from a common base definition. A given base concept is extended in increments, with each increment defined in a
separate merged package. By selecting which increments to merge, it is possible to obtain a custom definition of a concept for
a specific end. Package merge is particularly useful in meta-modeling and is extensively used in the definition of the UML metamodel.
Secondly the entire OMG UML spec infrastructure and superstructure is broken into many packages, which are often merged. This is useful when you want to do your own meta modeling and add functionality or exclude it, I have myself. UML is their own best example. Many UML implementations have followed this package merging scheme successfully for inclusion and exclusion to a solution.
The merge package is a kind of dependency link. I never use it because this concept is not needed with my favorite tool EclipseUML Omondo. I mean that my modeling is made at project level which includes packages, inners packages etc....
Many tools are talking about package merge because they have never implemented the project level and still just model at package level :-) If you reverse a multiple packages java project then export the xmi of RSA, EA or any other tool then you will see what I mean. You don't for example see an interface and a class inheritance because not placed in the same package. How can you imagine that I would place all my interfaces and classes in the same package ?
This is what is recommended by tool vendors because they can't manage project level and this is for me bad project architecture !!
I am running UBUNTU. Linux and have tried BOUML, which can show the project in a tree structure, but I am unable to get a diagrammatical over view of the whole system.
I think this is not a direct programming question, but hopefully it can be answered here anyway. :)
Also, would appreciate a good place to start to learn more about UML as it is becoming increasingly important in my project management.
I am not sure what format you have at hand, but I assume, you have XMI and that format does not contain any diagram specific information, it is only about the model, which is represented usually using tree structure, because it is the easiest way. For a diagram you would need to visualize the model and most importantly use some sort of layout algorithm. Layout for large models is quite hard especially with many associations and automatic layout might produce diagrams, which are misleading.
There are many books and places where to start with UML. I would recommend a book, e.g. one from Martin Fowler or Ila Neustadt and Jim Arlow. Recently modeling languages portal released list of UML cheatsheets.
I'm designing a software component which will get instructions from other components on how the UML diagram should look like, and then will produce this UML diagram in different presentation ways (in SVG, GIF, etc.), for example (in Java):
DiagramDesigner designer = new DiagramDesigner();
designer.setStyle('Use Cases')
designer.addActor('User');
designer.addUseCase('Print Document');
// etc.
String svg = designer.getSvg();
I don't want to re-invent the wheel and want to use some industry-standard language/interface for interconnection between my DiagramDesigner and other components. I'm looking for an interface similar to DOM, but for UML, not for XML.
Can anyone help? Thanks in advance.
ps. Besides the example above I would like to make my diagrams inter-operable and transferrable between servers, e.g.:
// first server
String script = designer.getScript();
// second server
DiagramDesigner desiger2 = DiagramDesigner.import(script);
So if I understand you right, you are looking for a way to work with UML on the metamodel level. You should look at the MOF standard and its implementation the EMF (Eclipse Modeling Framework), which is used by almost all Eclipse based UML tools and this framework is used by many other modeling projects, it even somewhat influenced the standardization of MOF (resulting in SMOF and EMOF split) and therefore I would declare it industry standard.
Probably only loosely related but anyhow: PlantUML. It is open source, built in Java and likely contains already parts of what you want to do.
You can inspire from these scripts to generate any output you want:
http://askuml.com/
Currently examples are given in yUML because they're nice but could be anything.
At least for the syntax part, you could get some inspiration from the large set of textual UML tools (theses tools allow designers to textually specify the model and then they automatically show the model graphically using the standard UML notation).
At least of such tools here: http://modeling-languages.com/content/uml-tools#textual