Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » EOperation defined at ecore need to be called at atl ?
EOperation defined at ecore need to be called at atl ? [message #900529] Tue, 07 August 2012 12:09 Go to next message
Kosala Yapa is currently offline Kosala Yapa
Messages: 159
Registered: September 2010
Senior Member
Hi All,

I defined a hexToInt(String) method(EOperation) in the target.ecore. Then i call that method in the following rule.


lazy rule rule_getModule{
from
b:source!ModuleItem
to
d:target!Module(
s7ModuleReference <- b.ModuleReference,
isSelectedWithinStep7<-b.IsSelected
)
do{
d.deviceID<-d.hexToInt(b.getIdentNumber());
}
}

Then at run configuration, I set two ecore files providing explicit paths to ecore file, then I get an error
org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found: OUT!<unnamed>.hexToInt(java.lang.String)


Then i set URI of the target ecore(nsURI="model") for ther target meta model, then i get an error
Error loading platform:/resourcensURI="model": java.net.MalformedURLException: Invalid URL "platform:/resourcensURI="model""


Can someone help me to resolve this issue?
I just need to call an EOperation (defined in ecore) in an ATL program. Any approach is higherly appriciated.

Thanks a million.
Kosala

[Updated on: Tue, 07 August 2012 12:13]

Report message to a moderator

Re: EOperation defined at ecore need to be called at atl ? [message #900704 is a reply to message #900529] Wed, 08 August 2012 08:38 Go to previous messageGo to next message
Kosala Yapa is currently offline Kosala Yapa
Messages: 159
Registered: September 2010
Senior Member
Thanks. I got this working.
Re: EOperation defined at ecore need to be called at atl ? [message #900977 is a reply to message #900704] Thu, 09 August 2012 09:37 Go to previous messageGo to next message
Kosala Yapa is currently offline Kosala Yapa
Messages: 159
Registered: September 2010
Senior Member
Hi all,

Hope this info is useful.

I defined EOperations in the target model and load them using its URI.

code example:

public void loadModels(String inputModelPath) throws ATLCoreException{

ResourceSet resourceSet = getResourceSet();

EMFModelFactory factory = new EMFModelFactory();
IInjector injector = new EMFInjector();

//inject path of the source meta model to IReferenceModel instance
IReferenceModel sourceMetamodel = factory.newReferenceModel();
injector.inject(sourceMetamodel, this.getSourceMetamodelPath());

//inject path of the target meta model from URI to IReferenceModel instance
IReferenceModel targetMetamodel = factory.newReferenceModel();
injector.inject(targetMetamodel, getPackage_eNS_URI());

//create new model instance and inject source model
this.inModel = factory.newModel(sourceMetamodel);
injector.inject(inModel, inputModelPath);

//create new model instance for target model
this.outModel = factory.newModel(targetMetamodel);
}


In order to load the target model, I am using "getPackage_eNS_URI()", which gives the URI of the target model. I defined Eoperations in the target model.

Kosala
Re: EOperation defined at ecore need to be called at atl ? [message #900992 is a reply to message #900704] Thu, 09 August 2012 10:57 Go to previous message
Kosala Yapa is currently offline Kosala Yapa
Messages: 159
Registered: September 2010
Senior Member
No Message Body

[Updated on: Thu, 09 August 2012 10:57]

Report message to a moderator

Previous Topic:Hexa decimal to integer conversion
Next Topic:Assigning to a xs:any/EFeatureMapEntry with ATL
Goto Forum:
  


Current Time: Mon Sep 22 04:23:09 GMT 2014

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

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