Re: Enumerations in Tefkat

3 views
Skip to first unread message

Michael Lawley

unread,
Oct 19, 2004, 9:30:36 PM10/19/04
to Damian Burger, Tef...@googlegroups.com
Damian Burger wrote:

> Does Tefkat support accessing and setting values of attributes that have
> ecore enumerations (defined in the source or target metamodel) as
their type?
> I notice there are none used in the examples and I can't seem to find a
> way to reference the enumeration literals in order access or set the
attribute.

Hi Damian,

There's no specific syntax for enums yet (suggestions are welcome), but
it is possible to use the ObjRef syntax. Unfortunately this won't help
you with the current releases since ObjRefs are not yet supported (they
will be in the next release).

Anyway, the syntax is simply <uri>. So, if you have a metamodel with
URI http:///com/example/metamode.ecore that defines the Enumeration
MyEnum with an enum literals MyLiteral, then you would write:

<http:///com/example/metamode.ecore#//MyEnum/MyLiteral>

So in future versions of Tefkat you can write rules like:

RULE MyRule
FORALL MyClass c
WHERE c.kind = <http:///com/example/metamode.ecore#//MyEnum/MyLiteral>
MAKE MyOtherClass oc;

michael

michael lawley

unread,
Feb 24, 2005, 7:36:50 AM2/24/05
to Tef...@googlegroups.com, Damian Burger
BTW, due to a "quirk" of EMF, if you're not using dynamic models (that
is, if you've generated classes for your model and have them loaded
into Eclipse such as with UML2), then you will need to refer to enums
as:

<URI_for_model#//enum/enum_literal>.instance()

Once we have a suitable syntax for enums this quirkiness will be dealt
with by the engine.

michael

Jim Steel

unread,
Jun 29, 2011, 11:25:14 AM6/29/11
to Tef...@googlegroups.com
Hi,

How do I check against an Enum value?

Jim.

michael lawley

unread,
Jul 1, 2011, 11:45:05 PM7/1/11
to tef...@googlegroups.com
Perhaps:

<URI_for_model#//enum/enum_literal>.value()

this would/should invoke getValue on the EEnumLiteral which, from
distant memory, is what you get from the ref
<URI_for_model#//enum/enum_literal>

michael

> --
> You received this message because you are subscribed to the Google Groups "Tefkat" group.
> To post to this group, send an email to tef...@googlegroups.com.
> To unsubscribe from this group, send email to tefkat+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/tefkat?hl=en-GB.
>
>

Reply all
Reply to author
Forward
0 new messages