Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL/EOL][newbie] Dealing with EFeatureMapEntry?
[ETL/EOL][newbie] Dealing with EFeatureMapEntry? [message #467883] Mon, 03 August 2009 05:33 Go to next message
Eclipse User
Originally posted by: d.clowes.lboro.ac.uk

Hello all,

I'm trying to transform data from a model based on an XSD to one based on
my own meta-model. I'm having difficult with EFeatureMapEntry and wondered
if anyone has any experience of transforming these relationships?

In more detail I have an element that contains 4 different sub-elements.
The order of these is important and I am assuming it is defined in the
EFeatureMapEntry relationship.

I have tried something like this:

for (x in v.element.group){
if(x.isTypeOf(XMLMetaModel!XMLElement){
var z := x.equivalent();
-- Do stuff for this type
}
if(x.isTypeOf(XMLMetaModel!XMLElement2){
var z := x.equivalent();
-- Do stuff for this type
}
}

However the if statements for the 4 element types are never entered. Is
there an operation for returning an elements type? i.e.
x.type().println(), or should this be approached another way?

Thanks, Darren
Re: [ETL/EOL][newbie] Dealing with EFeatureMapEntry? [message #467959 is a reply to message #467883] Mon, 03 August 2009 08:52 Go to previous messageGo to next message
Louis Rose is currently offline Louis Rose
Messages: 439
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Darren,

Darren Clowes wrote:
> Hello all,
>
> I'm trying to transform data from a model based on an XSD to one based
> on my own meta-model. I'm having difficult with EFeatureMapEntry and
> wondered if anyone has any experience of transforming these relationships?

IIRC, feature maps are used in place of derived features for
encapsulating complicated relationships, such as the one described here:

http://www.eclipse.org/modeling/emf/docs/overviews/FeatureMa p.pdf

If so, I think there's probably an easier way to achieve what you want.
I'm not sure what is that easier way, but the PDF above might be of some
help.

>
> In more detail I have an element that contains 4 different sub-elements.
> The order of these is important and I am assuming it is defined in the
> EFeatureMapEntry relationship.
>
> I have tried something like this:
>
> for (x in v.element.group){
> if(x.isTypeOf(XMLMetaModel!XMLElement){
> var z := x.equivalent();
> -- Do stuff for this type
> }
> if(x.isTypeOf(XMLMetaModel!XMLElement2){
> var z := x.equivalent();
> -- Do stuff for this type
> }
> }
>
> However the if statements for the 4 element types are never entered. Is
> there an operation for returning an elements type? i.e.
> x.type().println(), or should this be approached another way?


Is x an element of an EMF model? If so, try:

x.eClass().println()

Cheers,
Louis.
Re: [ETL/EOL][newbie] Dealing with EFeatureMapEntry? [message #468467 is a reply to message #467959] Wed, 05 August 2009 11:42 Go to previous message
Eclipse User
Originally posted by: d.clowes.lboro.ac.uk

Thanks Louis,

I found that I needed a .getValue() to get the class from the EFeatureMap,
so something like this worked:

for(x in class.group){
if(x.getValue().isTypeOf()){}
}
Re: [ETL/EOL][newbie] Dealing with EFeatureMapEntry? [message #572272 is a reply to message #467883] Mon, 03 August 2009 08:52 Go to previous message
Louis Rose is currently offline Louis Rose
Messages: 439
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Darren,

Darren Clowes wrote:
> Hello all,
>
> I'm trying to transform data from a model based on an XSD to one based
> on my own meta-model. I'm having difficult with EFeatureMapEntry and
> wondered if anyone has any experience of transforming these relationships?

IIRC, feature maps are used in place of derived features for
encapsulating complicated relationships, such as the one described here:

http://www.eclipse.org/modeling/emf/docs/overviews/FeatureMa p.pdf

If so, I think there's probably an easier way to achieve what you want.
I'm not sure what is that easier way, but the PDF above might be of some
help.

>
> In more detail I have an element that contains 4 different sub-elements.
> The order of these is important and I am assuming it is defined in the
> EFeatureMapEntry relationship.
>
> I have tried something like this:
>
> for (x in v.element.group){
> if(x.isTypeOf(XMLMetaModel!XMLElement){
> var z := x.equivalent();
> -- Do stuff for this type
> }
> if(x.isTypeOf(XMLMetaModel!XMLElement2){
> var z := x.equivalent();
> -- Do stuff for this type
> }
> }
>
> However the if statements for the 4 element types are never entered. Is
> there an operation for returning an elements type? i.e.
> x.type().println(), or should this be approached another way?


Is x an element of an EMF model? If so, try:

x.eClass().println()

Cheers,
Louis.
Re: [ETL/EOL][newbie] Dealing with EFeatureMapEntry? [message #572369 is a reply to message #467959] Wed, 05 August 2009 11:42 Go to previous message
Darren  is currently offline Darren
Messages: 40
Registered: September 2009
Member
Thanks Louis,

I found that I needed a .getValue() to get the class from the EFeatureMap,
so something like this worked:

for(x in class.group){
if(x.getValue().isTypeOf()){}
}
Previous Topic:Behaviour of String.split()
Next Topic:[ETL] How to deal with removing circular references
Goto Forum:
  


Current Time: Fri Aug 22 11:45:32 EDT 2014

Powered by FUDForum. Page generated in 0.01812 seconds