Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Load model from resource
Load model from resource [message #81650] Mon, 19 May 2008 15:05 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:[ATL]: Getting data from XMI input model
Next Topic:[ATL] Launch ATL from Java
Goto Forum:
  


Current Time: Thu Sep 19 12:11:31 GMT 2024

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

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

Back to the top