Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Explicit invocation of ETL rule
Explicit invocation of ETL rule [message #581621] Thu, 08 October 2009 10:41
Eclipse UserFriend
Originally posted by:

Dear All,
I have two transformation rules of the form:

rule LogAttributesType2LogAttributesSwitchType
transform logAtts1 : Source!LOGATTRIBUTESType
to switchType : Target!LogAttributesSwitchType {
guard : logAtts1.type = Source!LogAttType#CODE and
logAtts1.codeType = Source!CodeType#SWITCH
switchType.switchValues := logAtts1.cODEVAL.collect(v |

rule LogAttributesType2LogAttributesEnumType
transform logAtts1 : Source!LOGATTRIBUTESType
to enumType : Target!LogAttributesEnumType {
guard : logAtts1.type = Source!LogAttType#CODE and
logAtts1.codeType = Source!CodeType#ENUM
enumType.enumeratedValues := logAtts1.cODEVAL.collect(v |

The 'cODEVAL' attribute on the source class is the same in both cases,
however I want to apply different transformation rules to this attribute
depending of which transformation is currently being invoked.

I have defined the two transformation operations as:

operation Source!CODEVALType transformCodeVal2EnumVal() : Target!EnumVal {
var result : Target!EnumVal;
result.value := self.value;
result.meaning := self.meaning;
return result;

operation Source!CODEVALType transformCodeVal2SwitchVal() :
Target!SwitchVal {
var result : Target!SwitchVal;
result.value := self.value;
result.meaning := self.meaning;
return result;

The execution trace shows the following error message:
EXCEPTION: Called feature value on undefined object

The appropriate transformation operation has been invoked
(transformCodeVal2EnumVal), and self is of the expected type
(CODEVALType), however it appears to suggest that the receiver (self) is
undefined when I try to access one of the attributes.

Using the following 'generic' transformation runs without throwing an
error (although it doesn't provide me with the flexibility of specifying
when to return an EnumVal object and when to return a SwitchVal object):

rule CodeVal2EnumVal
transform cv1 : Source!CODEVALType
to ev2 : Target!EnumVal {
ev2.value := cv1.value;
ev2.meaning := cv1.meaning;

So I guess I have two questions:
1. Why does self.eClass().name return the expected type (CODEVALType),
and yet on the very next line when I try to access self.value does self
appear to be undefined?
2. Is there an easier way to achieve the explicit invocation of one rule
from another?

Best Wishes
Previous Topic:Visibility of link when i click group element in the diagram
Next Topic:Null Pointer Exception when invoking .asOrderedSet in EOL query
Goto Forum:

Current Time: Sun Jun 24 09:38:49 GMT 2018

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

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

Back to the top