Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Create relations between different model
Create relations between different model [message #1821993] Tue, 25 February 2020 09:43 Go to next message
Avi Shaked is currently offline Avi ShakedFriend
Messages: 116
Registered: October 2019
Senior Member
Hi!

Is there a way to create references between two different models? If so, what is the proper way to do so?

Here is the case I am trying to implement: I have an existing model called ModelX1 of type ModelX. It can, for example, hold various entities (ModelX1.components). I want to create a different model - ModelY1 (of type ModelY) - which has an element componentToBeAnalyzed that references ModelX1 and/or ModelX1.components.

I want to be able to do this by creating a new metamodel for ModelY class, which shows ModelY that is composed of ModelY.componentToBeAnalyzed (another class). ModelY.component has a reference to the external ModelX class or to the specific ModelX.components class. The reference is obviously one-directional, as I do not change anything in the ModelX metamodel.

Is this possible?

Thanks,
Avi
Re: Create relations between different model [message #1822131 is a reply to message #1821993] Thu, 27 February 2020 16:48 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 173
Registered: October 2014
Senior Member
Hello

Your question is not related to Sirius but to to EMF.
Nevertheless, yes, it is possible to define a metamodel that has dependencies on another meta model, that is class1 in mettamodel1 may refer (inheritance for example) to a class2 in metamodel 2.
In your Ecore Model Editor, right click and select "Load resource" to load metamodel2 and then to be able to select class2.

Regards
Laurent




Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Create relations between different model [message #1822211 is a reply to message #1822131] Sun, 01 March 2020 08:54 Go to previous messageGo to next message
Avi Shaked is currently offline Avi ShakedFriend
Messages: 116
Registered: October 2019
Senior Member
Thank you Laurent.

There's something I still don't get. I added the resource but I cannot add the external classes to my ecore class diagram.

I was only able to add such classes once I add the ecore model via Project Dependencies. However, "Add model" to Project Dependencies only allows adding resources from Files System or Workspace (like in this image: https://www.eclipse.org/ecoretools/doc/pasted-images/02b4636be8ad44ff5e8f0f699eea4e80.png).

What am I doing wrong?
Re: Create relations between different model [message #1822212 is a reply to message #1822211] Sun, 01 March 2020 10:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6874
Registered: July 2009
Senior Member
Hi

You do not add external classes to an Ecore Model. After Load Resource, you may reference those classes as supertypes, or reference types. IIRC in an Ecore Diagram you may add a link to an external class.

Regards

Ed Willink
Re: Create relations between different model [message #1822213 is a reply to message #1822212] Sun, 01 March 2020 12:09 Go to previous messageGo to next message
Avi Shaked is currently offline Avi ShakedFriend
Messages: 116
Registered: October 2019
Senior Member
Thanks Ed.

I understand that you are not supposed to add external classes to an ECORE model. Actually, what I meant was to add a reference to an external class, and not the actual external class.

You can add external class to an ECORE diagram (so that it can be referenced by new classes in another model), but only if it was added using "Add model" as I mentioned earlier (at least that's how it worked for me).
I am trying to find a more general way to do it (for example, connect with installed pakcages without having their ecore definition).




Re: Create relations between different model [message #1822215 is a reply to message #1822213] Sun, 01 March 2020 14:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6874
Registered: July 2009
Senior Member
Hi

I suggest that you experiment with the Sample Ecore Model Editor that is very tried and trusted and there are many answers on the EMF newsgroup.

Once you understand what happens behind the scenes you can see whether your actions with the Ecore Diagram Editor behave consistently and if not raise a Bugzilla.

Regards

Ed Willink
Re: Create relations between different model [message #1822286 is a reply to message #1822215] Tue, 03 March 2020 08:55 Go to previous message
Avi Shaked is currently offline Avi ShakedFriend
Messages: 116
Registered: October 2019
Senior Member
Thank you Ed.

If you were referring to this tutorial: https://eclipsesource.com/blogs/tutorials/emf-tutorial/
then, I am already familiar with it. If not, I will appreciate a link.


Thanks,
Avi

[Updated on: Tue, 03 March 2020 08:58]

Report message to a moderator

Previous Topic:Layout changes: need to change origin
Next Topic:How to open Table representation programmatically
Goto Forum:
  


Current Time: Tue Oct 20 12:40:45 GMT 2020

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

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

Back to the top