Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » "unique" handling problem
"unique" handling problem [message #1085036] Mon, 12 August 2013 11:11 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 424
Registered: September 2009
Senior Member
Hi,

in model I have a common EClass (Identifiable) that's the ancestor of almost all other EClasses.

Identifiable has an EAttribute (id) marked as "unique".
Intention was to have a id unique NOT between all Identifier's in the world, but within the derived class.
i.e: if I have Station->Identifier and Machine->Identifier these two CAN have the same id, while two Machine's CANNOT.

What is the right way to define this?

Default behavior seems to be to require uniqueness between every id regardless of inclusion in other EClasses, at least Diagnostician complains.

Note: in the model I NEVER instantiate Identifiable, only EClasses derived (extends) from it.
Note2: the "id" should be akin to an auto-increment primary-key field in a database table. Obviously different tables should be permitted to have the same key.

TiA
Mauro
Re: "unique" handling problem [message #1085046 is a reply to message #1085036] Mon, 12 August 2013 11:26 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26226
Registered: July 2009
Senior Member
Mauro,

Comments below.

On 12/08/2013 1:11 PM, Mauro Candarelli wrote:
> Hi,
>
> in model I have a common EClass (Identifiable) that's the ancestor of
> almost all other EClasses.
>
> Identifiable has an EAttribute (id) marked as "unique".
Unique is only meaningful for multi-valued features, where it dictates
that there may be no duplicate values in the list...
> Intention was to have a id unique NOT between all Identifier's in the
> world, but within the derived class.
> i.e: if I have Station->Identifier and Machine->Identifier these two
> CAN have the same id, while two Machine's CANNOT.
Attributes that are id must be unique across all types of instances in
the resource.
>
> What is the right way to define this?
No.
>
> Default behavior seems to be to require uniqueness between every id
> regardless of inclusion in other EClasses, at least Diagnostician
> complains.
Yes.
>
> Note: in the model I NEVER instantiate Identifiable, only EClasses
> derived (extends) from it.
> Note2: the "id" should be akin to an auto-increment primary-key field
> in a database table. Obviously different tables should be permitted to
> have the same key.
There's no direct way to model that in Ecore.
>
> TiA
> Mauro
Previous Topic:[Teneo] How to order containment reference?
Next Topic:How to make a class a singleton
Goto Forum:
  


Current Time: Wed Nov 26 18:54:50 GMT 2014

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

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