Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » set the aliases of metamodel in standalone
set the aliases of metamodel in standalone [message #1771552] Sun, 27 August 2017 18:05 Go to next message
Banafsheh A is currently offline Banafsheh AFriend
Messages: 273
Registered: July 2016
Senior Member
Hi,

I use Java standalone to run my EOL program [1]. How can I set aliases of used metamodels?

[1]. https://eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.standalone
Re: set the aliases of metamodel in standalone [message #1771554 is a reply to message #1771552] Sun, 27 August 2017 18:59 Go to previous messageGo to next message
Thanos Zolotas is currently offline Thanos ZolotasFriend
Messages: 49
Registered: November 2016
Location: York
Member
Hi,

In Epsilon, aliases are a List<String> datatype. You can get the aliases of each model by calling the getAliases() method. Thus, you can add a new String to the List<String> collection returned by the getAliases() method to add a new alias to the model.

For example, if you have created the following two emf models
EmfModel myEmfModel1 = new EmfModel();
EmfModel myEmfModel2 = new EmfModel();


You can do the following to add a new alias named "IN_MM":

myEmfModel1.getAliases().add("IN_MM");
myEmfModel2.getAliases().add("IN_MM");


You can now query both models by executing your command on the alias (i.e., IN_MM! ... ) in your EOL program.

Hope that helps,
Thanos

[Updated on: Sun, 27 August 2017 19:00]

Report message to a moderator

Re: set the aliases of metamodel in standalone [message #1771566 is a reply to message #1771554] Mon, 28 August 2017 07:44 Go to previous messageGo to next message
Banafsheh A is currently offline Banafsheh AFriend
Messages: 273
Registered: July 2016
Senior Member
I want to specify metamodels and their aliases not aliases of models. In my EOL program, I navigated the Input and output "metamodels".

[Updated on: Mon, 28 August 2017 07:45]

Report message to a moderator

Re: set the aliases of metamodel in standalone [message #1771572 is a reply to message #1771566] Mon, 28 August 2017 08:36 Go to previous messageGo to next message
Thanos Zolotas is currently offline Thanos ZolotasFriend
Messages: 49
Registered: November 2016
Location: York
Member
Hi,

You can then use the EmfMetaModel class instead, located in the org.eclipse.epsilon.emc.emf package as well. As with EmfModel, EmfMetaModel also inherits the getAlias() method from the IModel interface so you can use it as suggested in my previous message.

Regards,
Thanos
Re: set the aliases of metamodel in standalone [message #1771592 is a reply to message #1771572] Mon, 28 August 2017 12:10 Go to previous messageGo to next message
Banafsheh A is currently offline Banafsheh AFriend
Messages: 273
Registered: July 2016
Senior Member
Thanks a million.

As another questions,
1. I want to create a model via code and pass the "workspace path" of that to createEmfModelByURI, such as bellow. How can I do it?
models.add(createEmfModelByURI("Ecore", "output.model", "http://www.eclipse.org/emf/2002/Ecore", true, true));

The code has an "Internal error: java.io.FileNotFoundException: output.model [No such file or directory]" since the output.model file does not created at all.

2. I have the path of ecore metamodel such as "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore" in the metamodel variable. How can I set the METAMODEL_URI ?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EmfMetaModel emfMetaModel = new EmfMetaModel();
StringProperties properties = new StringProperties();
properties.put(EmfMetaModel.PROPERTY_METAMODEL_URI,
				?);

And also how can I register it?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EPackage.Registry.INSTANCE.put(?, ?);


Thanks for your time

[Updated on: Mon, 28 August 2017 18:12]

Report message to a moderator

Re: set the aliases of metamodel in standalone [message #1771658 is a reply to message #1771592] Tue, 29 August 2017 08:08 Go to previous messageGo to next message
Thanos Zolotas is currently offline Thanos ZolotasFriend
Messages: 49
Registered: November 2016
Location: York
Member
Hi,

Quote:

1. I want to create a model via code and pass the "workspace path" of that to createEmfModelByURI, such as bellow. How can I do it?
models.add(createEmfModelByURI("Ecore", "output.model", "http://www.eclipse.org/emf/2002/Ecore", true, true));



The model does not exist so, you should set the "read on load" argument to false. As a result Epsilon will not try to locate it when loading it. Setting the "store on disposal" argument to true (as you do) will dictate Epsilon to create the file (if it doesn't exist) and write the result to it. So, I believe that this should work:

models.add(createEmfModelByURI("Ecore", "output.model", "http://www.eclipse.org/emf/2002/Ecore", false, true));


Quote:

I have the path of ecore metamodel such as "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore" in the metamodel variable. How can I set the METAMODEL_URI ?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EmfMetaModel emfMetaModel = new EmfMetaModel();
StringProperties properties = new StringProperties();
properties.put(EmfMetaModel.PROPERTY_METAMODEL_URI,
				?);



If you open your .ecore metamodel with the ECore tree editor and navigate to the root node of it you will find the URI of the metamodel in the properties view of Eclipse (property: Ns URI).

Quote:
And also how can I register it?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EPackage.Registry.INSTANCE.put(?, ?);


This SO post expalins how to do it.

Hope that helps,
Thanos
Re: set the aliases of metamodel in standalone [message #1771892 is a reply to message #1771658] Thu, 31 August 2017 18:36 Go to previous message
Banafsheh A is currently offline Banafsheh AFriend
Messages: 273
Registered: July 2016
Senior Member
Thank you very much indeed.
My problem was solved.
Previous Topic:EMG
Next Topic:eol standalone failed to run native types
Goto Forum:
  


Current Time: Thu Nov 15 00:02:52 GMT 2018

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

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

Back to the top