| Home » Modeling » OCL » Re: Getting tha value of an enumeration attribute (eGet())
 Goto Forum:| 
| Re: Getting tha value of an enumeration attribute (eGet()) [message #57005] | Wed, 28 May 2008 08:19  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: merks.ca.ibm.com 
 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 #57059 is a reply to message #57032] | Wed, 28 May 2008 08:59   |  | 
| Eclipse User  |  |  |  |  | Originally posted by: merks.ca.ibm.com 
 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
 |  |  |  |  | 
| Re: [ATL] Getting tha value of an enumeration attribute (eGet()) [message #57110 is a reply to message #57059] | Wed, 28 May 2008 10:23  |  | 
| Eclipse User  |  |  |  |  | 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
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 02:32:32 EDT 2025 
 Powered by FUDForum . Page generated in 0.04761 seconds |