Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Extending Ecore models
Extending Ecore models [message #1792336] Mon, 16 July 2018 08:47 Go to next message
Ran Wei is currently offline Ran WeiFriend
Messages: 85
Registered: September 2012
Location: York, UK
Member
Hi there,

This may be a silly question but I hope that I can get some answers here.

I have a metamodel A which acts as an overall packaging metamodel, its root element R contains root element R' in an other metamodel B.

I then extend elements in metamodel B and create a new metamodel C, where its root element R'' extends R' in metamodel B.

Here comes the question:
When creating an instance of A, I create an instance of R. What I want to do is to create an instance of R'' and put it under R. The problem is, by simply looking at metamodel A, EMF knows about metamodel B because they are directly related, but not metamodel C.

Please tell me that I did something wrong, if not, please let me know how to proceed.

Cheers,
Ran


Research Associate
Department of Computer Science
University of York
Re: Extending Ecore models [message #1792347 is a reply to message #1792336] Mon, 16 July 2018 11:34 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
Hi

Your use of instance for both metamodels and classes is very confusing and I am fairly sure that one of your many R's has a missing ' typo, but anyway...

Suppose someone else comes along with a D metamodel and an RD class that also extends an R' too.

How should 'EMF' know whether it should be creating something from the D or C metamodel? As you observe, it can't. A possible solution is that you have a createRootOfC and a createRootOfD method to construct the relevant root and its corresponding parent.

Regards

Ed Willink
Re: Extending Ecore models [message #1792349 is a reply to message #1792347] Mon, 16 July 2018 11:35 Go to previous messageGo to next message
Ran Wei is currently offline Ran WeiFriend
Messages: 85
Registered: September 2012
Location: York, UK
Member
Found solution at: http://ed-merks.blogspot.com/2008/01/creating-children-you-didnt-know.html

Cheers,
Ran


Research Associate
Department of Computer Science
University of York
Re: Extending Ecore models [message #1792361 is a reply to message #1792349] Mon, 16 July 2018 13:06 Go to previous message
Ran Wei is currently offline Ran WeiFriend
Messages: 85
Registered: September 2012
Location: York, UK
Member
OK, so the solution provided at [1] works for simple scenarios.

My use case is slightly complicated, I realise it needs a bit more hacking. In my case I need to create another sub-class of IChildCreationExtender to extend the XXX_Switch class in Metamodel A, in the edit plugin generated for Metamodel B.

Problem is now solved.

Cheers,
Ran

[1]. http://ed-merks.blogspot.com/2008/01/creating-children-you-didnt-know.html


Research Associate
Department of Computer Science
University of York

[Updated on: Mon, 16 July 2018 13:40]

Report message to a moderator

Previous Topic:[xcore][xtend]
Next Topic:Rollback to a previous state of the model
Goto Forum:
  


Current Time: Tue Sep 25 13:17:03 GMT 2018

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

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

Back to the top