Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] FeatureMap for Beginners
[ETL] FeatureMap for Beginners [message #699968] Fri, 22 July 2011 16:04 Go to next message
Eclipse User is currently offline Eclipse User
Messages: 257
Registered: July 2009
Senior Member
Hi

I generated an Ecore model from a schema. I am doing a transformation
from one domain model to the generated schema model. The generated model
is used in my application thus a M2T from the domain model to XML is not
an option.

I am encountering problems with the following piece of XML which is
implemented using a FeatureMap:

<value>0.001</value>

How to add the '0.001'???

In EMF code I do:

Sting value = "0.001";
ValueType valueType = cpfFactory.eINSTANCE.createValueType();
FeatureMap valueMixed = valueType.getMixed();
FeatureMapUtil.addText(valueMixed, value);

What is the equivalent in ETL/EOL?

var value = new Target!Value;
var mixed = value.mixed;
//and then what?

-H
Re: [ETL] FeatureMap for Beginners [message #701480 is a reply to message #699968] Mon, 25 July 2011 06:58 Go to previous message
Eclipse User is currently offline Eclipse User
Messages: 257
Registered: July 2009
Senior Member
On 07/22/2011 06:04 PM, Hugo A. Garcia wrote:
> Hi
>
> I generated an Ecore model from a schema. I am doing a transformation
> from one domain model to the generated schema model. The generated model
> is used in my application thus a M2T from the domain model to XML is not
> an option.
>
> I am encountering problems with the following piece of XML which is
> implemented using a FeatureMap:
>
> <value>0.001</value>
>
> How to add the '0.001'???
>
> In EMF code I do:
>
> Sting value = "0.001";
> ValueType valueType = cpfFactory.eINSTANCE.createValueType();
> FeatureMap valueMixed = valueType.getMixed();
> FeatureMapUtil.addText(valueMixed, value);
>
> What is the equivalent in ETL/EOL?
>
> var value = new Target!Value;
> var mixed = value.mixed;
> //and then what?
>
> -H
>

I solved it by creating a wrapper for FeatureMapUtil and calling from
EOL as indicated in the article "Call Java from Epsilon":

http://www.eclipse.org/gmt/epsilon/doc/articles/call-java-from-epsilon/

The transformation is programmatic thus these two additional steps must
be done in addition to the steps in the article:

1) Add "org.eclipse.epsilon.eol.dt" as a plug-in dependency.
2) Add the following line of code before you parse() and execute() the
module:

etlModule.getContext().getNativeTypeDelegates().add(new
ExtensionPointToolNativeTypeDelegate());

In the transformation file you would do something like:

var value = new Target!Value;
var mixed = value.mixed;
var text = activity.priority.asString();//Just a text property
featureMapUtilTool.addText(mixed, text);


-H
Previous Topic:[Epsilon] How can an EOL module which loads one model access to more than one ecore metamodels?
Next Topic:Replacing table row in XML file with EVL
Goto Forum:
  


Current Time: Wed Sep 17 03:39:08 GMT 2014

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

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