Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Getting tha value of an enumeration attribute (eGet())
Getting tha value of an enumeration attribute (eGet()) [message #419591] Wed, 28 May 2008 12:15 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...Is it the correct way to to access to it?

I'm working with ATL (ATLAS trasnformation language) instead of directly
with Java code, but these operations are supported as well. I get 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)...


Thanks in advance,
Jose E. Rivera
Re: Getting tha value of an enumeration attribute (eGet()) [message #419592 is a reply to message #419591] Wed, 28 May 2008 12:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Jose,

This seems to be an OCL question so I've added that newsgroup to the
"to" list of the reply. You might want to show the OCL expression you used.

Or maybe it's a question more appropriate for the m2m newsgroup which
I've also added to the "to" list of the reply.

I don't see EMF on the stack trace at all, so I don't have a clue.


Jose E. Rivera wrote:
> 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...Is it the correct way to
> to access to it?
>
> I'm working with ATL (ATLAS trasnformation language) instead of
> directly with Java code, but these operations are supported as well. I
> get 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)...
>
>
> Thanks in advance,
> Jose E. Rivera


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Getting tha value of an enumeration attribute (eGet()) [message #419594 is a reply to message #419592] Wed, 28 May 2008 12:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rivera.lcc.uma.es

Sorry,

I saw other questions regarding this operation in this newsgroup and I
though that was the proper one. I though that implemented operations for
the Ecore metamodel were handled here,

sorry again and thank you

Ed Merks escribió:
> Jose,
>
> This seems to be an OCL question so I've added that newsgroup to the
> "to" list of the reply. You might want to show the OCL expression you
> used.
>
> Or maybe it's a question more appropriate for the m2m newsgroup which
> I've also added to the "to" list of the reply.
>
> I don't see EMF on the stack trace at all, so I don't have a clue.
>
>
> Jose E. Rivera wrote:
>> 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...Is it the correct way to
>> to access to it?
>>
>> I'm working with ATL (ATLAS trasnformation language) instead of
>> directly with Java code, but these operations are supported as well. I
>> get 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)...
>>
>>
>> Thanks in advance,
>> Jose E. Rivera
Re: Getting tha value of an enumeration attribute (eGet()) [message #419595 is a reply to message #419594] Wed, 28 May 2008 12:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Jose,

Well eGet is definitely implemented by the generated EMF code or by the
dynamic instance, but I know they work correctly for enums and I don't
see anything directly EMF related on the stack, so the issue must lie
elsewhere, or in your own code, which you've not shown at all. I expect
folks will need more details from you...


Jose E. Rivera wrote:
> Sorry,
>
> I saw other questions regarding this operation in this newsgroup and I
> though that was the proper one. I though that implemented operations
> for the Ecore metamodel were handled here,
>
> sorry again and thank you
>
> Ed Merks escribió:
>> Jose,
>>
>> This seems to be an OCL question so I've added that newsgroup to the
>> "to" list of the reply. You might want to show the OCL expression
>> you used.
>>
>> Or maybe it's a question more appropriate for the m2m newsgroup which
>> I've also added to the "to" list of the reply.
>>
>> I don't see EMF on the stack trace at all, so I don't have a clue.
>>
>>
>> Jose E. Rivera wrote:
>>> 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...Is it the correct way
>>> to to access to it?
>>>
>>> I'm working with ATL (ATLAS trasnformation language) instead of
>>> directly with Java code, but these operations are supported as well.
>>> I get 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)...
>>>
>>>
>>>
>>> Thanks in advance,
>>> Jose E. Rivera


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Getting tha value of an enumeration attribute (eGet()) [message #419596 is a reply to message #419594] Wed, 28 May 2008 13:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-tZ3NPTf/Uh7NADtUgKW2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi, Jose,

As far as I know, ATL does not use the MDT OCL implementation. I'm
afraid I won't be of much help.

Cheers,

Christian

On Wed, 2008-05-28 at 14:40 +0200, Jose E. Rivera wrote:

> Sorry,
>=20
> I saw other questions regarding this operation in this newsgroup and I=20
> though that was the proper one. I though that implemented operations for=20
> the Ecore metamodel were handled here,
>=20
> sorry again and thank you
>=20
> Ed Merks escribi=C3=B3:
> > Jose,
> >=20
> > This seems to be an OCL question so I've added that newsgroup to the=20
> > "to" list of the reply. You might want to show the OCL expression you=20
> > used.
> >=20
> > Or maybe it's a question more appropriate for the m2m newsgroup which=20
> > I've also added to the "to" list of the reply.
> >=20
> > I don't see EMF on the stack trace at all, so I don't have a clue.
> >=20
> >=20
> > Jose E. Rivera wrote:
> >> Hi all,
> >>
> >> I'm using (EObject) eGet(EStructuralFeature) operation to get the=20
> >> value of Objects' attributes and references. In all cases it works=20
> >> properly, but I get an error when trying to get the value of an=20
> >> attribute that has a EEnumLiteral as value...Is it the correct way to=20
> >> to access to it?
> >>
> >> I'm working with ATL (ATLAS trasnformation language) instead of=20
> >> directly with Java code, but these operations are supported as well. I=
=20
> >> get the following error:
> >>
> >> GRAVE: ERROR: get unsupported on OclAny.
> >> java.lang.RuntimeException: ERROR: get unsupported on OclAny.
> >> at=20
> >> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java=
:185)=20
> >>
> >> at=20
> >> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.ja=
va:85)=20
> >>
> >> at=20
> >> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.ja=
va:81)=20
> >>
> >> at=20
> >> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.get(ASMOcl Any.java:1=
40)
> >> at=20
> >> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:=
288)=20
> >>
> >> at=20
> >> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)=
....
> >>
> >>
> >> Thanks in advance,
> >> Jose E. Rivera

--=-tZ3NPTf/Uh7NADtUgKW2
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Jose,<BR>
<BR>
As far as I know, ATL does not use the MDT OCL implementation.&nbsp; I'm afraid I won't be of much help.<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
On Wed, 2008-05-28 at 14:40 +0200, Jose E. Rivera wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Sorry,</FONT>

<FONT COLOR="#000000">I saw other questions regarding this operation in this newsgroup and I </FONT>
<FONT COLOR="#000000">though that was the proper one. I though that implemented operations for </FONT>
<FONT COLOR="#000000">the Ecore metamodel were handled here,</FONT>

<FONT COLOR="#000000">sorry again and thank you</FONT>

<FONT COLOR="#000000">Ed Merks escribi&#243;:</FONT>
<FONT COLOR="#000000">&gt; Jose,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; This seems to be an OCL question so I've added that newsgroup to the </FONT>
<FONT COLOR="#000000">&gt; &quot;to&quot; list of the reply. You might want to show the OCL expression you </FONT>
<FONT COLOR="#000000">&gt; used.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Or maybe it's a question more appropriate for the m2m newsgroup which </FONT>
<FONT COLOR="#000000">&gt; I've also added to the &quot;to&quot; list of the reply.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; I don't see EMF on the stack trace at all, so I don't have a clue.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Jose E. Rivera wrote:</FONT>
<FONT COLOR="#000000">&gt;&gt; Hi all,</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; I'm using (EObject) eGet(EStructuralFeature) operation to get the </FONT>
<FONT COLOR="#000000">&gt;&gt; value of Objects' attributes and references. In all cases it works </FONT>
<FONT COLOR="#000000">&gt;&gt; properly, but I get an error when trying to get the value of an </FONT>
<FONT COLOR="#000000">&gt;&gt; attribute that has a EEnumLiteral as value...Is it the correct way to </FONT>
<FONT COLOR="#000000">&gt;&gt; to access to it?</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; I'm working with ATL (ATLAS trasnformation language) instead of </FONT>
<FONT COLOR="#000000">&gt;&gt; directly with Java code, but these operations are supported as well. I </FONT>
<FONT COLOR="#000000">&gt;&gt; get the following error:</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; GRAVE: ERROR: get unsupported on OclAny.</FONT>
<FONT COLOR="#000000">&gt;&gt; java.lang.RuntimeException: ERROR: get unsupported on OclAny.</FONT>
<FONT COLOR="#000000">&gt;&gt; at </FONT>
<FONT COLOR="#000000">&gt;&gt; org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:185) </FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; at </FONT>
<FONT COLOR="#000000">&gt;&gt; org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85) </FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; at </FONT>
<FONT COLOR="#000000">&gt;&gt; org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:81) </FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; at </FONT>
<FONT COLOR="#000000">&gt;&gt; org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.get(ASMOcl Any.java:140) </FONT>
<FONT COLOR="#000000">&gt;&gt; at </FONT>
<FONT COLOR="#000000">&gt;&gt; org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:288) </FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; at </FONT>
<FONT COLOR="#000000">&gt;&gt; org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)... </FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; Thanks in advance,</FONT>
<FONT COLOR="#000000">&gt;&gt; Jose E. Rivera</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-tZ3NPTf/Uh7NADtUgKW2--
Re: Getting tha value of an enumeration attribute (eGet()) [message #419598 is a reply to message #419596] Wed, 28 May 2008 14:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rivera.lcc.uma.es

Hi Christian and Ed,

Thank you very much, I will try in the m2m group :)

Cheers,
Jose E.

Christian W. Damus escribió:
> Hi, Jose,
>
> As far as I know, ATL does not use the MDT OCL implementation. I'm
> afraid I won't be of much help.
>
> Cheers,
>
> Christian
>
> On Wed, 2008-05-28 at 14:40 +0200, Jose E. Rivera wrote:
>> Sorry,
>>
>> I saw other questions regarding this operation in this newsgroup and I
>> though that was the proper one. I though that implemented operations for
>> the Ecore metamodel were handled here,
>>
>> sorry again and thank you
>>
>> Ed Merks escribió:
>> > Jose,
>> >
>> > This seems to be an OCL question so I've added that newsgroup to the
>> > "to" list of the reply. You might want to show the OCL expression you
>> > used.
>> >
>> > Or maybe it's a question more appropriate for the m2m newsgroup which
>> > I've also added to the "to" list of the reply.
>> >
>> > I don't see EMF on the stack trace at all, so I don't have a clue.
>> >
>> >
>> > Jose E. Rivera wrote:
>> >> 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...Is it the correct way to
>> >> to access to it?
>> >>
>> >> I'm working with ATL (ATLAS trasnformation language) instead of
>> >> directly with Java code, but these operations are supported as well. I
>> >> get 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)...
>> >>
>> >>
>> >> Thanks in advance,
>> >> Jose E. Rivera
Re: [ATL] Getting tha value of an enumeration attribute (eGet()) [message #419599 is a reply to message #419595] Wed, 28 May 2008 14:23 Go to previous message
Eclipse UserFriend
Originally posted by: rivera.lcc.uma.es

Thank you again Ed..

Then, 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.
is obtained. (In the example, i=1)

If 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

Ed Merks escribió:
> Jose,
>
> Well eGet is definitely implemented by the generated EMF code or by the
> dynamic instance, but I know they work correctly for enums and I don't
> see anything directly EMF related on the stack, so the issue must lie
> elsewhere, or in your own code, which you've not shown at all. I expect
> folks will need more details from you...
>
>
> Jose E. Rivera wrote:
>> Sorry,
>>
>> I saw other questions regarding this operation in this newsgroup and I
>> though that was the proper one. I though that implemented operations
>> for the Ecore metamodel were handled here,
>>
>> sorry again and thank you
>>
>> Ed Merks escribió:
>>> Jose,
>>>
>>> This seems to be an OCL question so I've added that newsgroup to the
>>> "to" list of the reply. You might want to show the OCL expression
>>> you used.
>>>
>>> Or maybe it's a question more appropriate for the m2m newsgroup which
>>> I've also added to the "to" list of the reply.
>>>
>>> I don't see EMF on the stack trace at all, so I don't have a clue.
>>>
>>>
>>> Jose E. Rivera wrote:
>>>> 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...Is it the correct way
>>>> to to access to it?
>>>>
>>>> I'm working with ATL (ATLAS trasnformation language) instead of
>>>> directly with Java code, but these operations are supported as well.
>>>> I get 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)...
>>>>
>>>>
>>>>
>>>> Thanks in advance,
>>>> Jose E. Rivera
Previous Topic:Creation Wizard only for root package
Next Topic:DnD image missing on OS X.
Goto Forum:
  


Current Time: Thu Apr 18 16:02:06 GMT 2024

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

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

Back to the top