Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Launch programmatically + Transformation from UML2 with Profile
[ATL] Launch programmatically + Transformation from UML2 with Profile [message #66837] Wed, 28 November 2007 13:42 Go to next message
No real name is currently offline No real nameFriend
Messages: 33
Registered: July 2009
Member
Hi,

I have implemented some rules, tranforming an UML2 model with applied
SysML Profile. When I launch the configuration inside Eclipse, the
transformation works fine. Mainly applied stereotypes are used to
control which rules are executed.

Launching the same configuration programmatically fails, because I
cannot access applied stereotypes. The function getAppliedStereotypes()
always returns an empty sequence. The profile is included into the
model, so a separate in parameter for the profile is not needed.

As starting point I used the code from Milan Milanovic's template bundle:

....
// register uml2
EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).
put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);

// get default emf handler
this.emfMh = (AtlEMFModelHandler)
AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);

// load uml metamodel
this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
"uri:http://www.eclipse.org/uml2/2.1.0/UML");

// load the input model
ASMModel in = this.emfMh.loadModel("IN",
this.uml2Mm, URI.createURI(inFileName));
....

During execution no error is reported and an output model is created.
But due to the empty sequences from getAppliedStereotypes() the output
is completly wrong.
What wrong with my transformation? Do I have to use special parameter?



Best regards

Sebastian
Re: [ATL] Launch programmatically + Transformation from UML2 with Profile [message #67361 is a reply to message #66837] Thu, 29 November 2007 07:51 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 33
Registered: July 2009
Member
Hi,

after some further debugging I think I have found one problem. The
following code produces a strange output:

this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
"uri:http://www.eclipse.org/uml2/2.1.0/UML");
ASMModel in = this.emfMh.loadModel("IN",
this.uml2Mm, URI.createURI(inFileName));
AtlModelHandler.getHandler(uml2Mm).saveModel(in, "tmp.uml");


In the dumped model, the references are not correctly resolved. Each XMI
element is assigned a new xmi:id, but in the stereotype applience the
reference to the element the stereotype is applied to is not updated:

....
<packagedElement xmi:type="uml:Class" xmi:id="a259" name="System">
....
</packagedElement>
...
<Extension:User_RootBlock xmi:id="a1037"
base_Class="_lXz1z524EdytSYwcMVoawA"/>
....

The attribute base_Class should have the value a259.

Any ideas how to solve the problem?



Best regards

Sebastian



bfeater schrieb:
> Hi,
>
> I have implemented some rules, tranforming an UML2 model with applied
> SysML Profile. When I launch the configuration inside Eclipse, the
> transformation works fine. Mainly applied stereotypes are used to
> control which rules are executed.
>
> Launching the same configuration programmatically fails, because I
> cannot access applied stereotypes. The function getAppliedStereotypes()
> always returns an empty sequence. The profile is included into the
> model, so a separate in parameter for the profile is not needed.
>
> As starting point I used the code from Milan Milanovic's template bundle:
>
> ...
> // register uml2
> EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).
> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>
> // get default emf handler
> this.emfMh = (AtlEMFModelHandler)
> AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
>
> // load uml metamodel
> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>
> // load the input model
> ASMModel in = this.emfMh.loadModel("IN",
> this.uml2Mm, URI.createURI(inFileName));
> ...
>
> During execution no error is reported and an output model is created.
> But due to the empty sequences from getAppliedStereotypes() the output
> is completly wrong.
> What wrong with my transformation? Do I have to use special parameter?
>
>
>
> Best regards
>
> Sebastian
Re: [ATL] Launch programmatically + Transformation from UML2 with Profile [message #67404 is a reply to message #67361] Thu, 29 November 2007 08:53 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 33
Registered: July 2009
Member
The problem with the references was a mistake of my part. The saved
model is now equal to the loaded model.

But why returnes getAppliedStereotypes() an empty sequence?


bfeater schrieb:
> Hi,
>
> after some further debugging I think I have found one problem. The
> following code produces a strange output:
>
> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
> ASMModel in = this.emfMh.loadModel("IN",
> this.uml2Mm, URI.createURI(inFileName));
> AtlModelHandler.getHandler(uml2Mm).saveModel(in, "tmp.uml");
>
>
> In the dumped model, the references are not correctly resolved. Each XMI
> element is assigned a new xmi:id, but in the stereotype applience the
> reference to the element the stereotype is applied to is not updated:
>
> ...
> <packagedElement xmi:type="uml:Class" xmi:id="a259" name="System">
> ...
> </packagedElement>
> ..
> <Extension:User_RootBlock xmi:id="a1037"
> base_Class="_lXz1z524EdytSYwcMVoawA"/>
> ...
>
> The attribute base_Class should have the value a259.
>
> Any ideas how to solve the problem?
>
>
>
> Best regards
>
> Sebastian
>
>
>
> bfeater schrieb:
>> Hi,
>>
>> I have implemented some rules, tranforming an UML2 model with applied
>> SysML Profile. When I launch the configuration inside Eclipse, the
>> transformation works fine. Mainly applied stereotypes are used to
>> control which rules are executed.
>>
>> Launching the same configuration programmatically fails, because I
>> cannot access applied stereotypes. The function
>> getAppliedStereotypes() always returns an empty sequence. The profile
>> is included into the model, so a separate in parameter for the profile
>> is not needed.
>>
>> As starting point I used the code from Milan Milanovic's template bundle:
>>
>> ...
>> // register uml2
>> EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI,
>> UMLPackage.eINSTANCE);
>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).
>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>
>> // get default emf handler
>> this.emfMh = (AtlEMFModelHandler)
>> AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
>>
>> // load uml metamodel
>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>
>> // load the input model
>> ASMModel in = this.emfMh.loadModel("IN",
>> this.uml2Mm, URI.createURI(inFileName));
>> ...
>>
>> During execution no error is reported and an output model is created.
>> But due to the empty sequences from getAppliedStereotypes() the output
>> is completly wrong.
>> What wrong with my transformation? Do I have to use special parameter?
>>
>>
>>
>> Best regards
>>
>> Sebastian
Re: [ATL] Launch programmatically + Transformation from UML2 with Profile [message #67712 is a reply to message #67404] Thu, 29 November 2007 23:42 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

If you want to use UML2 programmatically, you should make sure it is
properly registered.

When loaded in Eclipse as a plugin, the metadata (i.e., plugin.xml) is
queried for extensions of extension points. This process generally
performs some initializations (like registering the UML2 Resource factory).

However, if you simply add the UML2 jar to your classpath, this will not
automatically take care of proper initialization.

You should first find out what initializations are required to use UML2
outside of Eclipse, then add them in your code.


For reference, here is the information about EMF:
http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F
The EMF driver of ATL actually registers the XMI Resource factory for
every extension.


Because the UML2 plugin is not simply an EMF metamodel but requires
additional Java code, you most probably have to do similar things.


Once you have solved this, please let us know (e.g., by updating the
wiki with the information, and replying to this thread telling us you did).


Thanks,

Frédéric Jouault


bfeater wrote:
> The problem with the references was a mistake of my part. The saved
> model is now equal to the loaded model.
>
> But why returnes getAppliedStereotypes() an empty sequence?
>
>
> bfeater schrieb:
>> Hi,
>>
>> after some further debugging I think I have found one problem. The
>> following code produces a strange output:
>>
>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>> ASMModel in = this.emfMh.loadModel("IN",
>> this.uml2Mm, URI.createURI(inFileName));
>> AtlModelHandler.getHandler(uml2Mm).saveModel(in, "tmp.uml");
>>
>>
>> In the dumped model, the references are not correctly resolved. Each
>> XMI element is assigned a new xmi:id, but in the stereotype applience
>> the reference to the element the stereotype is applied to is not updated:
>>
>> ...
>> <packagedElement xmi:type="uml:Class" xmi:id="a259" name="System">
>> ...
>> </packagedElement>
>> ..
>> <Extension:User_RootBlock xmi:id="a1037"
>> base_Class="_lXz1z524EdytSYwcMVoawA"/>
>> ...
>>
>> The attribute base_Class should have the value a259.
>>
>> Any ideas how to solve the problem?
>>
>>
>>
>> Best regards
>>
>> Sebastian
>>
>>
>>
>> bfeater schrieb:
>>> Hi,
>>>
>>> I have implemented some rules, tranforming an UML2 model with applied
>>> SysML Profile. When I launch the configuration inside Eclipse, the
>>> transformation works fine. Mainly applied stereotypes are used to
>>> control which rules are executed.
>>>
>>> Launching the same configuration programmatically fails, because I
>>> cannot access applied stereotypes. The function
>>> getAppliedStereotypes() always returns an empty sequence. The profile
>>> is included into the model, so a separate in parameter for the
>>> profile is not needed.
>>>
>>> As starting point I used the code from Milan Milanovic's template
>>> bundle:
>>>
>>> ...
>>> // register uml2
>>> EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI,
>>> UMLPackage.eINSTANCE);
>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).
>>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>>
>>> // get default emf handler
>>> this.emfMh = (AtlEMFModelHandler)
>>> AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
>>>
>>> // load uml metamodel
>>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>>
>>> // load the input model
>>> ASMModel in = this.emfMh.loadModel("IN",
>>> this.uml2Mm, URI.createURI(inFileName));
>>> ...
>>>
>>> During execution no error is reported and an output model is created.
>>> But due to the empty sequences from getAppliedStereotypes() the
>>> output is completly wrong.
>>> What wrong with my transformation? Do I have to use special parameter?
>>>
>>>
>>>
>>> Best regards
>>>
>>> Sebastian
Re: [ATL] Launch programmatically + Transformation from UML2 with Profile [message #67841 is a reply to message #67712] Fri, 30 November 2007 12:15 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 33
Registered: July 2009
Member
I have found the problem. I created the uri for the input file with the
following instruction:

URI.createFileURI("infile.uml");

After changing it to

URI.createFileURI(new java.io.File("infile.uml").getAbsolutePath());

it works. The stereotypes are found.


Frédéric Jouault schrieb:
> Hello,
>
> If you want to use UML2 programmatically, you should make sure it is
> properly registered.
>
> When loaded in Eclipse as a plugin, the metadata (i.e., plugin.xml) is
> queried for extensions of extension points. This process generally
> performs some initializations (like registering the UML2 Resource factory).
>
> However, if you simply add the UML2 jar to your classpath, this will not
> automatically take care of proper initialization.
>
> You should first find out what initializations are required to use UML2
> outside of Eclipse, then add them in your code.
>
>
> For reference, here is the information about EMF:
> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F
>
> The EMF driver of ATL actually registers the XMI Resource factory for
> every extension.
>
>
> Because the UML2 plugin is not simply an EMF metamodel but requires
> additional Java code, you most probably have to do similar things.
>
>
> Once you have solved this, please let us know (e.g., by updating the
> wiki with the information, and replying to this thread telling us you did).
>
>
> Thanks,
>
> Frédéric Jouault
>
>
> bfeater wrote:
>> The problem with the references was a mistake of my part. The saved
>> model is now equal to the loaded model.
>>
>> But why returnes getAppliedStereotypes() an empty sequence?
>>
>>
>> bfeater schrieb:
>>> Hi,
>>>
>>> after some further debugging I think I have found one problem. The
>>> following code produces a strange output:
>>>
>>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>> ASMModel in = this.emfMh.loadModel("IN",
>>> this.uml2Mm, URI.createURI(inFileName));
>>> AtlModelHandler.getHandler(uml2Mm).saveModel(in, "tmp.uml");
>>>
>>>
>>> In the dumped model, the references are not correctly resolved. Each
>>> XMI element is assigned a new xmi:id, but in the stereotype
>>> applience the reference to the element the stereotype is applied to
>>> is not updated:
>>>
>>> ...
>>> <packagedElement xmi:type="uml:Class" xmi:id="a259" name="System">
>>> ...
>>> </packagedElement>
>>> ..
>>> <Extension:User_RootBlock xmi:id="a1037"
>>> base_Class="_lXz1z524EdytSYwcMVoawA"/>
>>> ...
>>>
>>> The attribute base_Class should have the value a259.
>>>
>>> Any ideas how to solve the problem?
>>>
>>>
>>>
>>> Best regards
>>>
>>> Sebastian
>>>
>>>
>>>
>>> bfeater schrieb:
>>>> Hi,
>>>>
>>>> I have implemented some rules, tranforming an UML2 model with
>>>> applied SysML Profile. When I launch the configuration inside
>>>> Eclipse, the transformation works fine. Mainly applied stereotypes
>>>> are used to control which rules are executed.
>>>>
>>>> Launching the same configuration programmatically fails, because I
>>>> cannot access applied stereotypes. The function
>>>> getAppliedStereotypes() always returns an empty sequence. The
>>>> profile is included into the model, so a separate in parameter for
>>>> the profile is not needed.
>>>>
>>>> As starting point I used the code from Milan Milanovic's template
>>>> bundle:
>>>>
>>>> ...
>>>> // register uml2
>>>> EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI,
>>>> UMLPackage.eINSTANCE);
>>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).
>>>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>>>
>>>> // get default emf handler
>>>> this.emfMh = (AtlEMFModelHandler)
>>>> AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
>>>>
>>>> // load uml metamodel
>>>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>>>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>>>
>>>> // load the input model
>>>> ASMModel in = this.emfMh.loadModel("IN",
>>>> this.uml2Mm, URI.createURI(inFileName));
>>>> ...
>>>>
>>>> During execution no error is reported and an output model is
>>>> created. But due to the empty sequences from getAppliedStereotypes()
>>>> the output is completly wrong.
>>>> What wrong with my transformation? Do I have to use special parameter?
>>>>
>>>>
>>>>
>>>> Best regards
>>>>
>>>> Sebastian
Re: [ATL] Launch programmatically + Transformation from UML2 with Profile [message #67859 is a reply to message #67841] Fri, 30 November 2007 15:27 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

> I have found the problem. I created the uri for the input file with the
> following instruction:
>
> URI.createFileURI("infile.uml");
>
> After changing it to
>
> URI.createFileURI(new java.io.File("infile.uml").getAbsolutePath());
>
> it works. The stereotypes are found.

Good news! :-)

Could you please put this information on the wiki?


Thanks,

Frédéric Jouault


bfeater wrote:
>
>
> Frédéric Jouault schrieb:
>> Hello,
>>
>> If you want to use UML2 programmatically, you should make sure it is
>> properly registered.
>>
>> When loaded in Eclipse as a plugin, the metadata (i.e., plugin.xml) is
>> queried for extensions of extension points. This process generally
>> performs some initializations (like registering the UML2 Resource
>> factory).
>>
>> However, if you simply add the UML2 jar to your classpath, this will
>> not automatically take care of proper initialization.
>>
>> You should first find out what initializations are required to use
>> UML2 outside of Eclipse, then add them in your code.
>>
>>
>> For reference, here is the information about EMF:
>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F
>>
>> The EMF driver of ATL actually registers the XMI Resource factory for
>> every extension.
>>
>>
>> Because the UML2 plugin is not simply an EMF metamodel but requires
>> additional Java code, you most probably have to do similar things.
>>
>>
>> Once you have solved this, please let us know (e.g., by updating the
>> wiki with the information, and replying to this thread telling us you
>> did).
>>
>>
>> Thanks,
>>
>> Frédéric Jouault
>>
>>
>> bfeater wrote:
>>> The problem with the references was a mistake of my part. The saved
>>> model is now equal to the loaded model.
>>>
>>> But why returnes getAppliedStereotypes() an empty sequence?
>>>
>>>
>>> bfeater schrieb:
>>>> Hi,
>>>>
>>>> after some further debugging I think I have found one problem. The
>>>> following code produces a strange output:
>>>>
>>>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>>>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>>> ASMModel in = this.emfMh.loadModel("IN",
>>>> this.uml2Mm, URI.createURI(inFileName));
>>>> AtlModelHandler.getHandler(uml2Mm).saveModel(in, "tmp.uml");
>>>>
>>>>
>>>> In the dumped model, the references are not correctly resolved. Each
>>>> XMI element is assigned a new xmi:id, but in the stereotype
>>>> applience the reference to the element the stereotype is applied to
>>>> is not updated:
>>>>
>>>> ...
>>>> <packagedElement xmi:type="uml:Class" xmi:id="a259" name="System">
>>>> ...
>>>> </packagedElement>
>>>> ..
>>>> <Extension:User_RootBlock xmi:id="a1037"
>>>> base_Class="_lXz1z524EdytSYwcMVoawA"/>
>>>> ...
>>>>
>>>> The attribute base_Class should have the value a259.
>>>>
>>>> Any ideas how to solve the problem?
>>>>
>>>>
>>>>
>>>> Best regards
>>>>
>>>> Sebastian
>>>>
>>>>
>>>>
>>>> bfeater schrieb:
>>>>> Hi,
>>>>>
>>>>> I have implemented some rules, tranforming an UML2 model with
>>>>> applied SysML Profile. When I launch the configuration inside
>>>>> Eclipse, the transformation works fine. Mainly applied stereotypes
>>>>> are used to control which rules are executed.
>>>>>
>>>>> Launching the same configuration programmatically fails, because I
>>>>> cannot access applied stereotypes. The function
>>>>> getAppliedStereotypes() always returns an empty sequence. The
>>>>> profile is included into the model, so a separate in parameter for
>>>>> the profile is not needed.
>>>>>
>>>>> As starting point I used the code from Milan Milanovic's template
>>>>> bundle:
>>>>>
>>>>> ...
>>>>> // register uml2
>>>>> EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI,
>>>>> UMLPackage.eINSTANCE);
>>>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).
>>>>> put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>>>>>
>>>>> // get default emf handler
>>>>> this.emfMh = (AtlEMFModelHandler)
>>>>> AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
>>>>>
>>>>> // load uml metamodel
>>>>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>>>>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>>>>
>>>>> // load the input model
>>>>> ASMModel in = this.emfMh.loadModel("IN",
>>>>> this.uml2Mm, URI.createURI(inFileName));
>>>>> ...
>>>>>
>>>>> During execution no error is reported and an output model is
>>>>> created. But due to the empty sequences from
>>>>> getAppliedStereotypes() the output is completly wrong.
>>>>> What wrong with my transformation? Do I have to use special parameter?
>>>>>
>>>>>
>>>>>
>>>>> Best regards
>>>>>
>>>>> Sebastian
Re: [ATL] Launch programmatically + Transformation from UML2 with Profile [message #68322 is a reply to message #67859] Fri, 07 December 2007 07:48 Go to previous message
No real name is currently offline No real nameFriend
Messages: 33
Registered: July 2009
Member
Frédéric Jouault schrieb:
> Hello,
>
> > I have found the problem. I created the uri for the input file with the
> > following instruction:
> >
> > URI.createFileURI("infile.uml");
> >
> > After changing it to
> >
> > URI.createFileURI(new java.io.File("infile.uml").getAbsolutePath());
> >
> > it works. The stereotypes are found.
>
> Good news! :-)
>
> Could you please put this information on the wiki?
Done

>
>
> Thanks,
>
> Frédéric Jouault
>
>
> bfeater wrote:
>>
>>
>> Frédéric Jouault schrieb:
>>> Hello,
>>>
>>> If you want to use UML2 programmatically, you should make sure it is
>>> properly registered.
>>>
>>> When loaded in Eclipse as a plugin, the metadata (i.e., plugin.xml)
>>> is queried for extensions of extension points. This process generally
>>> performs some initializations (like registering the UML2 Resource
>>> factory).
>>>
>>> However, if you simply add the UML2 jar to your classpath, this will
>>> not automatically take care of proper initialization.
>>>
>>> You should first find out what initializations are required to use
>>> UML2 outside of Eclipse, then add them in your code.
>>>
>>>
>>> For reference, here is the information about EMF:
>>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F
>>>
>>> The EMF driver of ATL actually registers the XMI Resource factory for
>>> every extension.
>>>
>>>
>>> Because the UML2 plugin is not simply an EMF metamodel but requires
>>> additional Java code, you most probably have to do similar things.
>>>
>>>
>>> Once you have solved this, please let us know (e.g., by updating the
>>> wiki with the information, and replying to this thread telling us you
>>> did).
>>>
>>>
>>> Thanks,
>>>
>>> Frédéric Jouault
>>>
>>>
>>> bfeater wrote:
>>>> The problem with the references was a mistake of my part. The saved
>>>> model is now equal to the loaded model.
>>>>
>>>> But why returnes getAppliedStereotypes() an empty sequence?
>>>>
>>>>
>>>> bfeater schrieb:
>>>>> Hi,
>>>>>
>>>>> after some further debugging I think I have found one problem. The
>>>>> following code produces a strange output:
>>>>>
>>>>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>>>>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>>>> ASMModel in = this.emfMh.loadModel("IN",
>>>>> this.uml2Mm, URI.createURI(inFileName));
>>>>> AtlModelHandler.getHandler(uml2Mm).saveModel(in, "tmp.uml");
>>>>>
>>>>>
>>>>> In the dumped model, the references are not correctly resolved.
>>>>> Each XMI element is assigned a new xmi:id, but in the stereotype
>>>>> applience the reference to the element the stereotype is applied to
>>>>> is not updated:
>>>>>
>>>>> ...
>>>>> <packagedElement xmi:type="uml:Class" xmi:id="a259" name="System">
>>>>> ...
>>>>> </packagedElement>
>>>>> ..
>>>>> <Extension:User_RootBlock xmi:id="a1037"
>>>>> base_Class="_lXz1z524EdytSYwcMVoawA"/>
>>>>> ...
>>>>>
>>>>> The attribute base_Class should have the value a259.
>>>>>
>>>>> Any ideas how to solve the problem?
>>>>>
>>>>>
>>>>>
>>>>> Best regards
>>>>>
>>>>> Sebastian
>>>>>
>>>>>
>>>>>
>>>>> bfeater schrieb:
>>>>>> Hi,
>>>>>>
>>>>>> I have implemented some rules, tranforming an UML2 model with
>>>>>> applied SysML Profile. When I launch the configuration inside
>>>>>> Eclipse, the transformation works fine. Mainly applied stereotypes
>>>>>> are used to control which rules are executed.
>>>>>>
>>>>>> Launching the same configuration programmatically fails, because I
>>>>>> cannot access applied stereotypes. The function
>>>>>> getAppliedStereotypes() always returns an empty sequence. The
>>>>>> profile is included into the model, so a separate in parameter for
>>>>>> the profile is not needed.
>>>>>>
>>>>>> As starting point I used the code from Milan Milanovic's template
>>>>>> bundle:
>>>>>>
>>>>>> ...
>>>>>> // register uml2
>>>>>> EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI,
>>>>>> UMLPackage.eINSTANCE);
>>>>>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).
>>>>>> put(UMLResource.FILE_EXTENSION,
>>>>>> UMLResource.Factory.INSTANCE);
>>>>>>
>>>>>> // get default emf handler
>>>>>> this.emfMh = (AtlEMFModelHandler)
>>>>>> AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
>>>>>>
>>>>>> // load uml metamodel
>>>>>> this.uml2Mm = this.emfMh.loadModel("uml", this.emfMh.getMof(),
>>>>>> "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>>>>>>
>>>>>> // load the input model
>>>>>> ASMModel in = this.emfMh.loadModel("IN",
>>>>>> this.uml2Mm, URI.createURI(inFileName));
>>>>>> ...
>>>>>>
>>>>>> During execution no error is reported and an output model is
>>>>>> created. But due to the empty sequences from
>>>>>> getAppliedStereotypes() the output is completly wrong.
>>>>>> What wrong with my transformation? Do I have to use special
>>>>>> parameter?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Best regards
>>>>>>
>>>>>> Sebastian
Previous Topic:[atl] problem setting properties of stereotypes
Next Topic:[ATL] : Bug report ? UML 2 Driver and Primitive types from pathmap
Goto Forum:
  


Current Time: Thu Mar 28 16:43:43 GMT 2024

Powered by FUDForum. Page generated in 0.03826 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top