Load model from resource [message #81650] |
Mon, 19 May 2008 15:05 |
Eclipse User |
|
|
|
Originally posted by: sebastien.minguet.gmail.com
Hi there,
I am currently working on a chain of transformation from java to kdm and I
have
a little problem with model loading.
Until now what I do is
-Create a java model and put it in a Resource
-Save the resource as xmi file
-Load the file as an ASMModel with
ASMModel org.eclipse.m2m.atl.engine.AtlEMFModelHandler.loadModel(Stri ng
name, ASMModel metamodel, URI uri)
and use it as input for my ATL transformation javaModelToKdmModel
It works fine but I would like to skip the save step so I now use the
method
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.loadASMEMFMo del(String
name, ASMEMFModel metamodel, Resource extent, ModelLoader ml) which takes
a Resource as parameter
It doesn't work. I suspect it is because the java Model contained in my
Resource is not an ASMModel. It is a model I create using classes
generated by the EMF wizard and my .ecore metamodel.
If I'm right, is it possible to load my model anyway? Otherwise what am I
missing?
Thanks in advance for your help
|
|
|
Re: Load model from resource [message #81697 is a reply to message #81650] |
Tue, 20 May 2008 11:34 |
Eclipse User |
|
|
|
Originally posted by: Hugo.Bruneliere.univ-nantes.fr
Hi Sebastien,
Sebastien Minguet a écrit :
> Hi there,
>
> I am currently working on a chain of transformation from java to kdm and
> I have a little problem with model loading.
>
> Until now what I do is
> -Create a java model and put it in a Resource
> -Save the resource as xmi file
> -Load the file as an ASMModel with ASMModel
> org.eclipse.m2m.atl.engine.AtlEMFModelHandler.loadModel(Stri ng name,
> ASMModel metamodel, URI uri)
>
If you already have your Java model stored as an EMF resource, you can
normally use the resource URI in order to directly load the model
(within the ATL model handler) without serializing it.
Resource javaModel = ...
AtlEMFModelHandler atlEMFmh = ...
...
ASMModel javaMetamodel = ...
...
atlEMFmh.loadModel("javaModelName", javaMetamodel, javaModel.getURI());
Do you have already tested this?
> and use it as input for my ATL transformation javaModelToKdmModel
>
> It works fine but I would like to skip the save step so I now use the
> method
>
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.loadASMEMFMo del(String
> name, ASMEMFModel metamodel, Resource extent, ModelLoader ml) which
> takes a Resource as parameter
>
> It doesn't work. I suspect it is because the java Model contained in my
> Resource is not an ASMModel. It is a model I create using classes
> generated by the EMF wizard and my .ecore metamodel.
> If I'm right, is it possible to load my model anyway? Otherwise what am
> I missing?
>
> Thanks in advance for your help
>
>
Best regards,
Hugo
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Re: Load model from resource [message #81740 is a reply to message #81697] |
Tue, 20 May 2008 14:44 |
Eclipse User |
|
|
|
Originally posted by: sebastien.minguet.gmail.com
Yes I already tried this. The problem is that I am not sure what URI I
should use to set the Resource URI. Since there is no file associated to
the Resource, I get a File not found exception when loadModel method
internally calls getResource
|
|
|
Powered by
FUDForum. Page generated in 0.05408 seconds