Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » distinguish between EClasses
distinguish between EClasses [message #1766525] Thu, 22 June 2017 15:36 Go to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi,

I create two Ecore EClasses with the same name in my code. Since EClass [name=Column, instanceClassName=null, instanceClass=null, defaultValue=null, instanceTypeName=null, abstract=false, interface=false, ] cannot specifies the difference of these classes, how can I distinguish between these classes?


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: distinguish between EClasses [message #1766527 is a reply to message #1766525] Thu, 22 June 2017 16:16 Go to previous messageGo to next message
Ricardo \\\"CaWal\\\" Cacheta Waldemarin is currently offline Ricardo \\\"CaWal\\\" Cacheta WaldemarinFriend
Messages: 29
Registered: January 2013
Junior Member
In Java, you can use the qualified name when you want to use classes with same name in some code. Something like...

com.packageA.Class packageAClass = new com.packageA.Class();
com.packageB.Class packageBClass = new com.packageB.Class();
Re: distinguish between EClasses [message #1766528 is a reply to message #1766525] Thu, 22 June 2017 16:16 Go to previous messageGo to next message
Ricardo \\\"CaWal\\\" Cacheta Waldemarin is currently offline Ricardo \\\"CaWal\\\" Cacheta WaldemarinFriend
Messages: 29
Registered: January 2013
Junior Member
No Message Body

[Updated on: Thu, 22 June 2017 16:18]

Report message to a moderator

Re: distinguish between EClasses [message #1766530 is a reply to message #1766527] Thu, 22 June 2017 16:46 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Thanks for your reply.
I want to use it in EOL.


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: distinguish between EClasses [message #1766536 is a reply to message #1766530] Thu, 22 June 2017 18:31 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

If the two EClasses are different, they are different and there should be no problem. How do you fail to distinguish?

Of course if they are not different you are in deep trouble and need to rethink.

Regards

Ed Willink
Re: distinguish between EClasses [message #1766565 is a reply to message #1766536] Fri, 23 June 2017 06:37 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
They are different but with the same name. It seems they don't have an id.
EClass [name=Column, instanceClassName=null, instanceClass=null, defaultValue=null, instanceTypeName=null, abstract=false, interface=false, ]


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Fri, 23 June 2017 06:39]

Report message to a moderator

Re: distinguish between EClasses [message #1766568 is a reply to message #1766565] Fri, 23 June 2017 08:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

If you try validating your Ecore model, you should see a validation error.

Two classes with the same name (in the same package) is an absolute no-no in EMF (and in UML). Just about as stupid as the parents of twins giving both twins the same name.

Regards

Ed Willink
Re: distinguish between EClasses [message #1766603 is a reply to message #1766568] Fri, 23 June 2017 12:11 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Thanks.
However, in transformations we have such things. e.g., in the code below 4 instances of columns is created and we need to distinguish between them.
rule Class2Table
  transform c : OO!Class 
  to t : DB!Table, pk : DB!Column {
  
   if (c.`extends`.isDefined()){
   
    var childFkCol : new DB!Column;
    var parentFkCol : DB!Column;

  }

}

rule SingleValuedAttribute2Column
  transform a : OO!Attribute
  to c : DB!Column {
....
}


But my question is about EClass, Isn't there any such an id that we can distinguish between them?


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: distinguish between EClasses [message #1766616 is a reply to message #1766603] Fri, 23 June 2017 13:43 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You can contrive all sorts of things, but until you motivate identical names, you're not going to get much help. EClasses MUST have different names wrt their EPackage. You can have duplicates, but expect to have to produce a modified version of every tool that you use thereafter.

A common approach used in graphical tools is to auto-name as NewClass1, NewClass2, NewClass3, ...

A necessary approach for transformations that must comply with WFRs is to have a name supervisor that fixes duplicates and embarrassing names such as a Java class named "class" or "1£$%".

Regards

Ed Willink
Previous Topic:EMF to USE
Next Topic:Distinguishing "logical" Ecore elements from additional "technical" ones
Goto Forum:
  


Current Time: Fri Mar 29 00:00:51 GMT 2024

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

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

Back to the top