Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Doubt about EGL in ANT
Doubt about EGL in ANT [message #588077] Thu, 01 April 2010 17:04 Go to next message
paolatco  is currently offline paolatco
Messages: 10
Registered: March 2010
Junior Member
Hi!

I get a doubt about egl ant. I did this:
File: launch.xml

<?xml version="1.0"?>
<project default="main">

<target name="main">
<epsilon.emf.register file="../metamodels/MM.ecore"/>
<epsilon.loadModel name="test" type="EMF">
<parameter name="modelFile" file="../models/test.model"/>
<parameter name="metamodelUri" value="/metamodel/MM.ecore"/>
<parameter name="isMetamodelFileBased" value="false"/>
<parameter name="readOnLoad" value="false"/>
<parameter name="storeOnDisposal" value="false"/>
</epsilon.loadModel>

<epsilon.egl src="MM2txt.egl">
<model ref="test"/>
</epsilon.egl>
</target>

</project>


And executes successfully but no generates the files. I get:
File: MM2txt.egl

[% -- Generate Entities
TemplateFactory.setOutputRoot('out'); -- outputDir
var template : Template;
for(entity in DataModel.allInstances()){
template := TemplateFactory.load('other.egl');
template.populate('entity',entity);
--template.process();
template.generate(entity+'.txt');

}
%]


File: other.egl

Hello World! File: [%=entity%]


Am i missing somethig?

Thanks.
Re: Doubt about EGL in ANT [message #588087 is a reply to message #588077] Thu, 01 April 2010 18:00 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi,

As readonload is set to false, the contents of your model file are not
read, and thus, DataModel.allInstances() returns an empty collection, so
the body of the for loop is never executed. To fix this please set the
value of readonload to true.

Cheers,
Dimitris

paolatco <paolatco@gmail.com> wrote:
> Hi!
>
> I get a doubt about egl ant. I did this:
> File: launch.xml
>
> <?xml version="1.0"?>
> <project default="main">
>
> <target name="main">
> <epsilon.emf.register file="../metamodels/MM.ecore"/>
> <epsilon.loadModel name="test" type="EMF">
> <parameter name="modelFile" file="../models/test.model"/>
> <parameter name="metamodelUri" value="/metamodel/MM.ecore"/>
> <parameter name="isMetamodelFileBased" value="false"/> <parameter
> name="readOnLoad" value="false"/>
> <parameter name="storeOnDisposal" value="false"/>
> </epsilon.loadModel>
>
> <epsilon.egl src="MM2txt.egl">
> <model ref="test"/>
> </epsilon.egl>
> </target>
>
> </project>
>
>
> And executes successfully but no generates the files. I get:
> File: MM2txt.egl
>
> [% -- Generate Entities
> TemplateFactory.setOutputRoot('out'); -- outputDir
> var template : Template;
> for(entity in DataModel.allInstances()){
> template := TemplateFactory.load('other.egl');
> template.populate('entity',entity);
> --template.process();
> template.generate(entity+'.txt');
>
> }
> %]
>
>
> File: other.egl
>
> Hello World! File: [%=entity%]
>
>
> Am i missing somethig?
>
> Thanks.
>
Re: Doubt about EGL in ANT [message #588094 is a reply to message #588087] Thu, 01 April 2010 18:21 Go to previous messageGo to next message
paolatco  is currently offline paolatco
Messages: 10
Registered: March 2010
Junior Member
Yes, that was the problem... :blush:
:d Thanks!
Re: Doubt about EGL in ANT [message #588099 is a reply to message #588094] Thu, 01 April 2010 19:04 Go to previous messageGo to next message
paolatco  is currently offline paolatco
Messages: 10
Registered: March 2010
Junior Member
Hi again.
I get a problem with EGL.
When i call package.name.replace('.','_') it replace the whole string with the new character :? ...
But if for instance i write package.name.replace('T','_') it works fine.

Dot character get to be treated different?
Re: Doubt about EGL in ANT [message #588128 is a reply to message #588099] Fri, 02 April 2010 01:13 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi,

The first argument of replace is a regular expression and in reg exps .
means any character. Please use \\. instead of .

Cheers,
Dimitris

paolatco <paolatco@gmail.com> wrote:
> Hi again.
> I get a problem with EGL.
> When i call package.name.replace('.','_') it replace the whole string
> with the new character :? ...
> But if for instance i write package.name.replace('T','_') it works
> fine.
>
> Dot character get to be treated different?
>
>
Previous Topic:Doubt about EGL in ANT
Next Topic:ETL question
Goto Forum:
  


Current Time: Sat Apr 19 00:33:18 EDT 2014

Powered by FUDForum. Page generated in 0.13989 seconds