|
Re: set the aliases of metamodel in standalone [message #1771554 is a reply to message #1771552] |
Sun, 27 August 2017 18:59 |
Athanasios Zolotas Messages: 52 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 #1771592 is a reply to message #1771572] |
Mon, 28 August 2017 12:10 |
Banafsheh Azizi Messages: 328 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
Member of MDSE Research Group
http://mdse.ui.ac.ir
[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 |
Athanasios Zolotas Messages: 52 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.05623 seconds