Skip to main content


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: 428
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: 33137
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Teneo] How to order containment reference?
Next Topic:How to make a class a singleton
Goto Forum:
  


Current Time: Fri Apr 19 20:57:46 GMT 2024

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

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

Back to the top