Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] load a model from plugins
[ATL] load a model from plugins [message #90111] Tue, 16 September 2008 13:24 Go to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
Hi,

I'm launching a transformation by code and I have an static model that it
is in plugins. I load this model,

catalogModel = emfamh.loadModel("IN", catalogMM,
URI.createPlatformPluginURI(pluginName + "/models/My.rulescatalog", true));

and then I launch ATL transformation, it throws an error.

If I load this model from workspace,

catalogModel = emfamh.loadModel("IN", catalogMM,
URI.createPlatformResourceURI("/proves/My.rulescatalog", true));

transformation is correct !!!

Question is, can I execute an ATL transformation and load a model that it
is in eclipse plugins ?¿?

Thanks!
Re: [ATL] load a model from plugins [message #90158 is a reply to message #90111] Thu, 18 September 2008 06:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Christos.Sofronis.parades.rm.cnr.it

Hello, the answer is yes (I'm using it lately).

I have the following


String PLATFORM_RESOURCE = "platform:/plugin/";
String rootAtlPath = PLATFORM_RESOURCE + Activator.PLUGIN_ID+"/";
String atlTransformationPath = rootAtlPath + "atl/transformation.asm";
// the above will create a string like this
// "platform:/plugin/plugin_id/atl/transformation.asm"
// which you load as follows

ASMModel model = emfamh.loadModel("modelName", metamodel, (new URL(atlTransformationPath)).openStream());

....


take care the metamodel to be the model of the model that you want to load and if in turn is a metamodel then use the
following:
metamodel = emfamh.getMof()




this works fine to me.
regards,
christos...









Miguel Llácer wrote:
> Hi,
>
> I'm launching a transformation by code and I have an static model that
> it is in plugins. I load this model,
> catalogModel = emfamh.loadModel("IN", catalogMM,
> URI.createPlatformPluginURI(pluginName + "/models/My.rulescatalog", true));
>
> and then I launch ATL transformation, it throws an error.
>
> If I load this model from workspace,
> catalogModel = emfamh.loadModel("IN", catalogMM,
> URI.createPlatformResourceURI("/proves/My.rulescatalog", true));
>
> transformation is correct !!!
>
> Question is, can I execute an ATL transformation and load a model that
> it is in eclipse plugins ?¿?
>
> Thanks!
>
Re: [ATL] load a model from plugins [message #90250 is a reply to message #90158] Mon, 22 September 2008 07:28 Go to previous messageGo to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
Hi,

I don't know if you have understood me.

What I want to load is an input model to transformation that I have into
plugins, not in workspace.
I have tried it with an input uml model and it works correctly but, when I
try to do this with another model, transformation is executed but it
throws an error:


GRAVE: ****** BEGIN Stack Trace
GRAVE: message: feature name does not exist on CATALOG!EObject
GRAVE: A.main() : ??#28 null
GRAVE: local variables = {self=catalog2configuration : ASMModule}
GRAVE: local stack = []
GRAVE: A.__exec__() : ??#28 null
GRAVE: local variables = {e=TransientLink {rule =
'ConfigurationPattern2ConfiguredPattern', sourceElements = {i =
IN!<unnamed>}, targetElements = {}, variables = {}},
self=catalog2configuration : ASMModule}
GRAVE: local stack = []
GRAVE: A.__applyConfigurationPattern2ConfiguredPattern(1 :
NTransientLink;) : ??#31 299:4-299:30
GRAVE: local variables = {i=IN!<unnamed>, link=TransientLink {rule =
'ConfigurationPattern2ConfiguredPattern', sourceElements = {i =
IN!<unnamed>}, targetElements = {}, variables = {}},
self=catalog2configuration : ASMModule}
GRAVE: local stack = []
GRAVE: A.morePatterns(1 : MCATALOG!ConfigurationPattern;) : ??#1
307:7-307:34
GRAVE: local variables = {i=IN!<unnamed>, self=catalog2configuration :
ASMModule}
GRAVE: local stack = []
GRAVE: MCATALOG!ConfigurationPattern;.isGeneralizationPattern() : ??#26
99:5-99:19
GRAVE: local variables = {elem=IN!specificClass, self=IN!<unnamed>}
GRAVE: local stack = [false]
GRAVE: ****** END Stack Trace
INFO: Execution terminated due to error (see launch configuration to allow
continuation after errors).
GRAVE: feature name does not exist on CATALOG!EObject
java.lang.RuntimeException: feature name does not exist on CATALOG!EObject
...

What could be happening ?¿?

Thanks!!!
Re: [ATL] load a model from plugins [message #90446 is a reply to message #90250] Thu, 25 September 2008 07:22 Go to previous messageGo to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
Hi,

My question is:

Can I load input models in ATL if they are not in workspace ?¿?

Thanks.
Re: [ATL] load a model from plugins [message #90503 is a reply to message #90446] Thu, 25 September 2008 10:13 Go to previous messageGo to next message
Gabriel BARBIER is currently offline Gabriel BARBIERFriend
Messages: 106
Registered: July 2009
Senior Member
Hello Miguel,
As Christos told you, yes it is possible.
His example show you how to load a model from a plugin (so this model
cannot be in workspace).

And in your first message, you initialized correctly your URI.
URI.createPlatformPluginURI(<plugin id>/<resourcePath>, false)

Here is an example of what I did :
String kdmMMpath ="org.omg.kdm/model/kdm.ecore";
// plugin id = org.omg.kdm, and resource path = /model/kdm.ecore
// load metamodel
ASMModel kdmMM = modelHandler.loadModel(
"KDM", modelHandler.getMof(),
URI.createPlatformPluginURI(this.kdmMMpath, false));
//Load model instances
ASMModel kdmModel = modelHandler.loadModel("input_kdm", kdmMM,
kdm_Model.getURI());

It is not so far from what you did, yet your stack trace show another
error (your model seems to be correctly loaded) :
GRAVE: ****** BEGIN Stack Trace
GRAVE: message: feature name does not exist on CATALOG!EObject

==> your metamodel is perhaps not correctly loaded. ATL did not find
attribute name in your Catalog element.



--> Hi,
-->
-->My question is:
-->
-->Can I load input models in ATL if they are not in workspace ?¿?
-->
-->Thanks.
Re: [ATL] load a model from plugins [message #90588 is a reply to message #90503] Fri, 26 September 2008 10:56 Go to previous messageGo to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
But, what you are loading with URI.createPlatformPluginURI() is not an
instance model, it is the metamodel !!!!!


----------------- YOUR EXAMPLE ------------------------
// load metamodel
ASMModel kdmMM = modelHandler.loadModel(
"KDM", modelHandler.getMof(),
URI.createPlatformPluginURI(this.kdmMMpath, false));

//Load model instances
ASMModel kdmModel = modelHandler.loadModel("input_kdm", kdmMM,
kdm_Model.getURI());

----------------- MY EXAMPLE --------------------------
// load metamodel
ASMModel catalogMM = modelHandler.loadModel(
"CATALOG", modelHandler.getMof(),
CATALOGnsUri);

// load model instance
ASMModel catalogModel = modelHandler.loadModel("IN", catalogMM,
URI.createPlatformPluginURI(plugin + "/models/UML2DB.rulescatalog",
true));



As you can see, what I do it is to load the instance model from plugin and
not the metamodel.
Problem is not in loading the model, it is when I launch transformation.
Re: [ATL] load a model from plugins [message #90602 is a reply to message #90111] Fri, 26 September 2008 11:51 Go to previous messageGo to next message
Miguel Llàcer San Fernando is currently offline Miguel Llàcer San FernandoFriend
Messages: 63
Registered: July 2009
Member
Thanks for all, What I am doing is correct, problem was another.

As conclusion, I can said that load an instance model that it is not in
workspace is possibly !!!

See you !
Re: [ATL] load a model from plugins [message #90648 is a reply to message #90588] Mon, 29 September 2008 09:16 Go to previous message
Gabriel BARBIER is currently offline Gabriel BARBIERFriend
Messages: 106
Registered: July 2009
Senior Member
Hello Miguel,

I've tried to load a model (and not a meta model :-)).
And it seems that you have perhaps found a bug :

It works if model is in an other plugin. Yet if the model is located in
plugin where you write your code : it fails !

To have the good behavior when code and model are located in same plugin,
instead of using URI.createPlatformPluginURI, you can use :
Bundle bundle = Platform.getBundle("your plugin id");
URL fullPathString = bundle.getEntry("path of your model");
URI inputUri = URI.createURI(fullPathString.toString());

I hope it will help.





But, what you are loading with URI.createPlatformPluginURI() is not an
instance model, it is the metamodel !!!!!


----------------- YOUR EXAMPLE ------------------------
// load metamodel
ASMModel kdmMM = modelHandler.loadModel(
"KDM", modelHandler.getMof(),
URI.createPlatformPluginURI(this.kdmMMpath, false));

//Load model instances
ASMModel kdmModel = modelHandler.loadModel("input_kdm", kdmMM,
kdm_Model.getURI());

----------------- MY EXAMPLE --------------------------
// load metamodel
ASMModel catalogMM = modelHandler.loadModel(
"CATALOG", modelHandler.getMof(),
CATALOGnsUri);

// load model instance
ASMModel catalogModel = modelHandler.loadModel("IN", catalogMM,
URI.createPlatformPluginURI(plugin + "/models/UML2DB.rulescatalog",
true));



As you can see, what I do it is to load the instance model from plugin and

not the metamodel.
Problem is not in loading the model, it is when I launch transformation.
Previous Topic:[ATL] load AADL Model problem
Next Topic:[ATL] retrieve index of an element in a collection
Goto Forum:
  


Current Time: Thu Apr 25 05:55:41 GMT 2024

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

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

Back to the top