[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.uml2] Re: Reading UML Profile Elements in Java (Me too, help please!)

Dawid,

I'm glad to hear that it's working better for you now (but I'll take a pass on the kiss)!

1. Yes, this is expected; basically, everything in the resource that was encapsulated within XMI extension elements will be instantiated as AnyType elements and captured in the extension map for the resource. If you aren't interested in preserving these elements, you can simply discard them.

2. The 'String' primitive type is actually supposed to be part of the standard metamodel rather than a profile, but this is an example of the differences you'll see between the way tools interpret the UML specification. Interchange of profiles and stereotype applications is generally a challenge as a result, so unfortunately you will likely run into problems unless the model you are trying to open/import is in "native" Eclipse UML2 format... For information on how to work with profiles in UML2, please see the "Introduction to UML2 Profiles" article on the Wiki.

Kenn


Dawid Loubser wrote:
Kenn,

If you were neither thousands of kilometers away, nor a man, I would KISS you. By registering the UMLPackage for the URI of UML 2.1.2, my model is indeed loading, standard output of MagicDraw UML (16.x) in a stand-alone app outside of eclipse. I can see my classes, packages, etc.

Now to take the process further, there are two issues I need some clarification on:

1. There are still a large number of AnyType instances in-between the useful UML-related instances, is this normal? I suspect these are for
e.g. all the non-standard MagicDraw-specific elements present in the model, e.g. diagram stuff, extensions, saved UI preferences, and so on.
In general, we don't want to care about any non-UML-standard elements, so we are happy to ignore this.


2. In my sample UML model, I have class Person with attribute 'name' of
   type 'string' from the UML standard profile. When I inspect (in code)
   the class Person, I get the following:

Class: Person
- has a name of type org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@618821 (eProxyURI: http://schema.omg.org/spec/UML/2.2/uml.xml#String)


Obviously, the UML Standard profile (even though the file is present, next to the model file) is not loading (or loading properly). Could you point me to the best guide to load a model such as this properly with the UML standard profile, in order for me to e.g. access the name of the
Person as type String?


Unless I misunderstand, and that this is the way this works, i.e. the UML2 project does not offer Java classes representing the UML standard profile?

I basically just want to understand how the EMF UML2 project "deals" with profiles, furthermore because I need to load other (non-standard)
profiles in the future.


kind (and very relieved) regards,
Dawid


Kenn Hussey het geskryf:
Dawid,

There is no default registration mapping the '2.1.2' version of the "official" metamodel (there in fact was no such version) to the Eclipse UML metamodel. You have two choices here - change the URI in the document to use '2.1.1' or '2.2' as the version instead or register the UML package against this URI.

The editor is opening the document, but I suspect many of the elements are still being instantiated as generic AnyType elements...

Kenn