Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Importing/referring model of different emf metamodal in default tree base editor
Importing/referring model of different emf metamodal in default tree base editor [message #1862493] Thu, 07 December 2023 12:29 Go to next message
Ehsan Ahmad is currently offline Ehsan AhmadFriend
Messages: 37
Registered: April 2018
Member
Hi,
I have created an EMF metamodel for datatype so that the models (datatypes) of this metamodel can be referred/used in other models of different EMF metamodels.

Is it possible to make these datatypes available in default tree based editor?

How can I call them in my EOL programs?

Thank you.
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862495 is a reply to message #1862493] Thu, 07 December 2023 12:56 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Ehsan,

I'm not sure I understand the question. Could you please elaborate a bit more with references to specific files/artefacts?

Thanks,
Dimitris
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862498 is a reply to message #1862495] Thu, 07 December 2023 13:57 Go to previous messageGo to next message
Ehsan Ahmad is currently offline Ehsan AhmadFriend
Messages: 37
Registered: April 2018
Member
Hi Dimitris,
For example, I have an EMF model datatypes.emf
package datamodel;
class DataType{
val DataType1[*] dt1;
val DataType2 [*] dt2;
}

class DataType1{

} 

class DataType2{

}

I have created a model TimePeriod.model of datatypes.emf and a DataType Period in it.

Then, I have another EMF for my state transition modeling theory, statemachine.emf, in which I can import datatypes.emf. In this EMF attr sigma refers to datamodel.DataType.
package statemachine;
 import ".......datatypes.emf";

class StateMachine {
    val State[*] states;
    val  Transition[*] transitions;
}

class State{
  attr String name;
  ref  datamodel.DataType sigma;
} 

class Transition{
}


Now, in MySM.model of statemachine.emf, when creating a state I am expecting Period of TimePeriod.model to be available for selection. But the list is empty and nothing appears.
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862499 is a reply to message #1862498] Thu, 07 December 2023 14:09 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
Senior Member

Did you load your TimePeriod.model form your MySM.model editor?

You need to right click on a node in the MySM.model editor tree and select "Load resource...", which will let you select the TimePeriod.model.

Since EMF does not have the concept of "import", the "Load resource" action is intended to provide the funcionality.


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862504 is a reply to message #1862499] Thu, 07 December 2023 16:10 Go to previous messageGo to next message
Ehsan Ahmad is currently offline Ehsan AhmadFriend
Messages: 37
Registered: April 2018
Member
Dear Horacio,
Yes. It worked.
I was trying to load the metamodel resource (datatypes.emf in this case) instead of the model resource.

Thanks very much.

Ehsan
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862517 is a reply to message #1862498] Fri, 08 December 2023 14:39 Go to previous messageGo to next message
Ehsan Ahmad is currently offline Ehsan AhmadFriend
Messages: 37
Registered: April 2018
Member
Hi Horacio,
A followup question. The Load Resource does not work sometimes. Although, the referred object entry is there in the XML file <primitiveType href="Iso_Types/Iso_Types.model#_GJvm4JVAEe62ZNGb2OJB2Q"/> but it does not show up in the Tree editor.

I am using Eclipse 2023, 06 with macOS Sonoma 14.1.2 (23B92) on MacBook Air M1.

Any Hint?

Thanks,

Ehsan
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862518 is a reply to message #1862517] Fri, 08 December 2023 14:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Ehsan,

Does clicking on the Exeed -> Show Additional Resources menu do the trick?

Thanks,
Dimitris
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862519 is a reply to message #1862518] Fri, 08 December 2023 15:30 Go to previous messageGo to next message
Ehsan Ahmad is currently offline Ehsan AhmadFriend
Messages: 37
Registered: April 2018
Member
Hi Dimitris,
It shows the additional resources in Tree Editor but still does not show any referred object in the Properties view.

Please see the attached screenshot.

Thanks
Ehsan
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862520 is a reply to message #1862519] Fri, 08 December 2023 15:38 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Could you please share a minimal example we can use to reproduce this?

Thanks,
Dimitris
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862523 is a reply to message #1862520] Fri, 08 December 2023 16:24 Go to previous messageGo to next message
Ehsan Ahmad is currently offline Ehsan AhmadFriend
Messages: 37
Registered: April 2018
Member
Dimitris,
Please find the attached minimal example. Please note that;

- Folder metamodels has EMF and ECORE metamodels for both DataType and StateMachine

- Folder models has two models MyDataType.model and MyStateMachine.model.

- The aim is to use data types defined in MyDataType.model in MyStateMachine.model.

- I am using Eclipse IDE for Java Developers. Version: 2023-06 (4.28.0), Build id: 20230608-1333


Thanks,

Ehsan
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862526 is a reply to message #1862523] Fri, 08 December 2023 20:14 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Ehsan,

My advice would be to give your metamodels URI-like namespace URIs (e.g. http://dev.datatype) and then import the datatype metamodel from the statemachine metamodel using its namespace URI (as opposed to its Ecore file). To do this you will first need to right-click on DataType.ecore and select "Register EPackages". Once you have also registered StateMachine.ecore in the same way, you should be able to open MyStateMachine model with no issues (see attached).

Thanks,
Dimitris
Re: Importing/referring model of different emf metamodal in default tree base editor [message #1862539 is a reply to message #1862526] Sun, 10 December 2023 15:40 Go to previous message
Ehsan Ahmad is currently offline Ehsan AhmadFriend
Messages: 37
Registered: April 2018
Member
Thank you the advise Dimitris. The resources are loaded appropriately now.
Btw, why importing namespace URI works fine as opposed to its Ecore file.


Thanks,
Ehsan
Previous Topic:Detect User Inactivity and Logout (Eclipse RCP)
Next Topic:Why is the difference of program execution time between console time and profiling time
Goto Forum:
  


Current Time: Sat Apr 27 08:47:39 GMT 2024

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

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

Back to the top