Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [TCS] KM3 unique attribute
[TCS] KM3 unique attribute [message #2670] Mon, 25 February 2008 12:44 Go to next message
Eclipse UserFriend
Hi,

i just tried to introduce a unique attribute, to have some class of a
metamodel have a unique ID. Strangely, it seems that KM3 does not accept
the unique keyword. I.e. when I try modifying KM3.km3 adding "unique" to
some attribute:

package KM3 {

abstract class ModelElement {
unique attribute name : String;
}
...


I get an error "mismatched input 'unique' expected lcurly".
However, KM3.tcs states:
template Attribute
: (isUnique ? "unique")
"attribute" name
$multiplicity
(isOrdered ? "ordered")
":" type{refersTo = name, autoCreate = never}
";"
;

so what am I doing wrong? How can I specify some attribute to be unique?
Re: [TCS] KM3 unique attribute [message #2699 is a reply to message #2670] Tue, 26 February 2008 11:00 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

The TCS builder plugin uses KM3 2005, which places "unique" after
"ordered". You KM3.tcs excerpt comes from KM3 2007. We plan to correct
this inconsistency, and to make KM3 2007 compatible with KM3 2005 wrt.
the "unique" keyword.

Note that "unique" does not correspond to what you are looking for. It
has the same meaning in KM3 and Ecore. Multivalued attributes (upper > 0
or upper = -1) can be unique and correspond to a set, or non-unique and
correspond to a multiset.

What you are looking for is the equivalent of EAttribute.iD. However,
there is no equivalent in KM3, because this is not strictly a metamodel
concern.

If you use TCS symbol table handling (i.e., context, addToContext,
refersTo) then you are defining ids (what refersTo point to). The TCS
injector will tell you (i.e., report an error) when you refer to an id
for which there are (incorrectly) several elements.


Regards,

Frédéric Jouault

Thibault a écrit :
> Hi,
>
> i just tried to introduce a unique attribute, to have some class of a
> metamodel have a unique ID. Strangely, it seems that KM3 does not accept
> the unique keyword. I.e. when I try modifying KM3.km3 adding "unique" to
> some attribute:
>
> package KM3 {
>
> abstract class ModelElement {
> unique attribute name : String;
> }
> ..
>
>
> I get an error "mismatched input 'unique' expected lcurly".
> However, KM3.tcs states:
> template Attribute
> : (isUnique ? "unique")
> "attribute" name
> $multiplicity
> (isOrdered ? "ordered")
> ":" type{refersTo = name, autoCreate = never} ";"
> ;
>
> so what am I doing wrong? How can I specify some attribute to be unique?
>
Re: [TCS] KM3 unique attribute [message #4094 is a reply to message #2699] Tue, 26 February 2008 11:12 Go to previous message
Eclipse UserFriend
That was very helpful, thank you.
Previous Topic:[TCS] Injector ATL dependency
Next Topic:Availability?
Goto Forum:
  


Current Time: Mon Jun 02 19:05:42 EDT 2025

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

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

Back to the top