Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Operation (EObject) eGet with enumeration values
[ATL] Operation (EObject) eGet with enumeration values [message #83411] Mon, 02 June 2008 11:25 Go to next message
Eclipse UserFriend
Originally posted by: rivera.lcc.uma.es

Hi all,

I'm using (EObject) eGet(EStructuralFeature) operation to get the value
of Objects' attributes and references. In all cases it works properly,
but I get an error when trying to get the value of an attribute that has
a EEnumLiteral as value...

The ATL rule I'm working with is the following:

lazy rule MaudeDataType{
from
o : Ecore!EObject,
a : Ecore!EAttribute,
i : Integer
using {...}
to
c : Maude!Constant(
op <- if ...
else if a.eType.oclIsKindOf(Ecore!EEnum)
then o.eGet(a)->asSequence()->at(i).name
else o.eGet(a)->asSequence()->at(i).toString()
endif
endif,
...
)
}

For attributes with a simple data type value works properly (the "else"
branch), but when the value is a enumeration literal (the "then" branch)
does not, and the following error:

GRAVE: ERROR: get unsupported on OclAny.
java.lang.RuntimeException: ERROR: get unsupported on OclAny.
at
org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:185)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:81)
at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.get(ASMOcl Any.java:140)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:288)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)...

is obtained. (In the example, i=1)
If (as I have been told in e.t.emf newsgroup) the generated EMF code for
eGet (or by the dynamic instance) works correctly for enums, what can be
the problem?

Thanks in advance,
Jose E. Rivera
Re: [ATL] Operation (EObject) eGet with enumeration values [message #85205 is a reply to message #83411] Wed, 25 June 2008 17:43 Go to previous message
Eclipse UserFriend
Originally posted by: rivera.lcc.uma.es

Hi all,

finally I solved my problem. It was no a problem about the eGet
operation but accesing the attribute name of a EEnumLiteral. Using
toString() instead works properly,

Regards,
Jose E. Rivera


Jose E. Rivera escribió:
> Hi all,
>
> I'm using (EObject) eGet(EStructuralFeature) operation to get the value
> of Objects' attributes and references. In all cases it works properly,
> but I get an error when trying to get the value of an attribute that has
> a EEnumLiteral as value...
>
> The ATL rule I'm working with is the following:
>
> lazy rule MaudeDataType{
> from
> o : Ecore!EObject,
> a : Ecore!EAttribute,
> i : Integer
> using {...}
> to
> c : Maude!Constant(
> op <- if ...
> else if a.eType.oclIsKindOf(Ecore!EEnum)
> then o.eGet(a)->asSequence()->at(i).name
> else o.eGet(a)->asSequence()->at(i).toString()
> endif
> endif,
> ...
> )
> }
>
> For attributes with a simple data type value works properly (the "else"
> branch), but when the value is a enumeration literal (the "then" branch)
> does not, and the following error:
>
> GRAVE: ERROR: get unsupported on OclAny.
> java.lang.RuntimeException: ERROR: get unsupported on OclAny.
> at
> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:185)
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
>
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:81)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.get(ASMOcl Any.java:140)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:288)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)...
>
> is obtained. (In the example, i=1)
> If (as I have been told in e.t.emf newsgroup) the generated EMF code for
> eGet (or by the dynamic instance) works correctly for enums, what can be
> the problem?
>
> Thanks in advance,
> Jose E. Rivera
Previous Topic:How to recognize an UML 2.0 ontology file
Next Topic:[Announce] M2M ATL 2.0.0 is available
Goto Forum:
  


Current Time: Mon Oct 14 06:04:27 GMT 2019

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

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

Back to the top