Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsMetamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/699887/#msg_699887
that I can read the elements such as Class in the uml
file using the following code:
if(resource.getContents().get(i) instanceof Model)
{
System.out.println("Model name is " + ((Model) resource.getContents().get(i)).getName());
}
else if (resource.getContents().get(i) instanceof Class)
System.out.println("Class name is " + ((Class) resource.getContents().get(i)).getName());
....
But when I try to load the UML Metamodel from the Superstructure.uml file, the above code failed. When I check Superstructure.uml, I find this file is different from the
uml file where I saved a class model created using UML2 api. The element in my created uml file is like UML:MetaClass such as UML:Class while Superstructure.uml has elements whose name is PackagedElement... In this case, how Superstructure.uml is created? It does not seem to be created by ECore... How can I read Superstructure.uml? Thanks.
Wuwei]]>wws_ques wws_ques2011-07-22T14:40:54-00:00Re: Metamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/699909/#msg_699909
something like that?
On 22/07/2011 7:40 AM, Wuwei wrote:
> I wrote a simple program to save a class diagram to a uml file. After
> that I can read the elements such as Class in the uml
> file using the following code:
>
> if(resource.getContents().get(i) instanceof Model)
> {
> System.out.println("Model name is " + ((Model)
> resource.getContents().get(i)).getName());
> } else if (resource.getContents().get(i)
> instanceof Class)
> System.out.println("Class name is " + ((Class)
> resource.getContents().get(i)).getName());
> ...
>
> But when I try to load the UML Metamodel from the Superstructure.uml
> file, the above code failed. When I check Superstructure.uml, I find
> this file is different from the
> uml file where I saved a class model created using UML2 api. The
> element in my created uml file is like UML:MetaClass such as UML:Class
> while Superstructure.uml has elements whose name is PackagedElement...
> In this case, how Superstructure.uml is created? It does not seem to
> be created by ECore... How can I read Superstructure.uml? Thanks.
> Wuwei]]>Ed Merks2011-07-22T14:54:23-00:00Re: Metamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/699918/#msg_699918
from Superstructure.uml is an instance of Model...
Ed Merks wrote on Fri, 22 July 2011 10:54
Don't classes generally need to be contained in a Package or Model or
something like that?
On 22/07/2011 7:40 AM, Wuwei wrote:
> I wrote a simple program to save a class diagram to a uml file. After
> that I can read the elements such as Class in the uml
> file using the following code:
>
> if(resource.getContents().get(i) instanceof Model)
> {
> System.out.println("Model name is " + ((Model)
> resource.getContents().get(i)).getName());
> } else if (resource.getContents().get(i)
> instanceof Class)
> System.out.println("Class name is " + ((Class)
> resource.getContents().get(i)).getName());
> ...
>
> But when I try to load the UML Metamodel from the Superstructure.uml
> file, the above code failed. When I check Superstructure.uml, I find
> this file is different from the
> uml file where I saved a class model created using UML2 api. The
> element in my created uml file is like UML:MetaClass such as UML:Class
> while Superstructure.uml has elements whose name is PackagedElement...
> In this case, how Superstructure.uml is created? It does not seem to
> be created by ECore... How can I read Superstructure.uml? Thanks.
> Wuwei
]]>wws_ques wws_ques2011-07-22T15:12:41-00:00Re: Metamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/699964/#msg_699964
can assure you everything you see serialized was created with the UML2 APIs.
On 22/07/2011 8:12 AM, Wuwei wrote:
> Yes. The following code should catch Model's name. But it seems nothing
> from Superstructure.uml is an instance of Model...
>
> Ed Merks wrote on Fri, 22 July 2011 10:54
>> Don't classes generally need to be contained in a Package or Model or
>> something like that?
>>
>>
>> On 22/07/2011 7:40 AM, Wuwei wrote:
>> > I wrote a simple program to save a class diagram to a uml file. After
>> > that I can read the elements such as Class in the uml
>> > file using the following code:
>> >
>> > if(resource.getContents().get(i) instanceof Model)
>> > {
>> > System.out.println("Model name is " + ((Model) >
>> resource.getContents().get(i)).getName());
>> > } else if (resource.getContents().get(i) >
>> instanceof Class)
>> > System.out.println("Class name is " + ((Class)
>> > resource.getContents().get(i)).getName());
>> > ...
>> >
>> > But when I try to load the UML Metamodel from the
>> Superstructure.uml > file, the above code failed. When I check
>> Superstructure.uml, I find > this file is different from the
>> > uml file where I saved a class model created using UML2 api. The >
>> element in my created uml file is like UML:MetaClass such as
>> UML:Class > while Superstructure.uml has elements whose name is
>> PackagedElement... > In this case, how Superstructure.uml is created?
>> It does not seem to > be created by ECore... How can I read
>> Superstructure.uml? Thanks.
>> > Wuwei
>
>]]>Ed Merks2011-07-22T15:20:44-00:00Re: Metamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/700005/#msg_700005
The Indigo version of Superstructure.uml starts
demonstrating that the root element is a Model and that the namespace is http://www.eclipse.org/uml2/3.0.0/UML rather than ...omg... It differs
variously becuase OMG URI policy has been evolving and because an Ecore
prpfile is applied.
The file is readable by the UML model editor so you can debug that
editor to compare it with your code.
Regards
Ed Willink
On 22/07/2011 16:12, Wuwei wrote:
> Yes. The following code should catch Model's name. But it seems nothing
> from Superstructure.uml is an instance of Model...]]>Ed Willink2011-07-22T17:03:45-00:00Re: Metamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/700007/#msg_700007
The Indigo version of Superstructure.uml starts
demonstrating that the root element is a Model and that the namespace is http://www.eclipse.org/uml2/3.0.0/UML rather than ...omg... It differs
variously becuase OMG URI policy has been evolving and because an Ecore
prpfile is applied.
The file is readable by the UML model editor so you can debug that
editor to compare it with your code.
Regards
Ed Willink
On 22/07/2011 16:12, Wuwei wrote:
> Yes. The following code should catch Model's name. But it seems nothing
> from Superstructure.uml is an instance of Model...]]>Ed Willink2011-07-22T17:03:45-00:00Re: Metamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/701748/#msg_701748
It works when I use the model from UML2 v3.2. But I still get confused about why the previous model I used didn't work out. Here is the beginning of that file:
Now, I try to visit a navigable end of an association. According to the UML spec_2.1.2 p. 43, it says:
"navigable notation was often used in the past according to an informal convention, whereby non-navigable ends were assumed to be owned by the association whereas navigable ends were assumed to be owned by the classifier at the opposite end. This convention is now deprecated"
Then, how UML2 is implemented to support the navigability for an association? It seems UML2 still supports the informal convention, right?
Thanks.
Wuwei
demonstrating that the root element is a Model and that the namespace is http://www.eclipse.org/uml2/3.0.0/UML rather than ...omg... It differs
variously becuase OMG URI policy has been evolving and because an Ecore
prpfile is applied.
The file is readable by the UML model editor so you can debug that
editor to compare it with your code.
Regards
Ed Willink
On 22/07/2011 16:12, Wuwei wrote:
> Yes. The following code should catch Model's name. But it seems nothing
> from Superstructure.uml is an instance of Model...
]]>wws_ques wws_ques2011-07-25T14:26:05-00:00Re: Metamodel in Superstructure.uml
https://www.eclipse.org/forums/index.php/mv/msg/222594/701842/#msg_701842
> It works when I use the model from UML2 v3.2. But I still get
> confused about why the previous model I used didn't work out.
Wierd things sometimes happen. Not all are easy to explain. Some take a
long time to make them go away.
> Then, how UML2 is implemented to support the navigability for an
> association? It seems UML2 still supports the informal convention, right?
No idea. You can study the code as well as I can.