Home » Modeling » Epsilon » EGL: Setting-up an ecore model features
EGL: Setting-up an ecore model features [message #1719340] |
Thu, 07 January 2016 10:53 |
Alireza Rouhi Messages: 148 Registered: December 2015 |
Senior Member |
|
|
Hi,
I want to read some features from an ecore model file and then generate an output based on the captured values. But launching the EGL file, here FOO, is encountered the following problems:
An internal error occurred during: "Launching Foo".
These errors need to be fixed before the model can be serialized.
Model: Feature Model.name must be set.
Model: Feature Model. ... must be set.
...
Of course, I have generated the ecore metamodel from the Xtext. And, I want to read the features of a model which conforms to the mentioned ecore metamodel.
How can I resolve the mentioned problems?
Kind regards,
Alireza
[Updated on: Wed, 13 January 2016 21:26] Report message to a moderator
|
|
| | | | |
Re: EGL: Setting-up an ecore model features [message #1719502 is a reply to message #1719500] |
Fri, 08 January 2016 12:04 |
|
Hi Alireza,
A couple of comments on your minimal example:
- Source code projects are preferable to plugin JARs
- Please try to leave out anything that is not absolutely necessary to reproduce the problem (e.g. the pattern language UML profile doesn't seem to be related to this problem)
- When you are including projects for two workspaces, it'd be nice if you could put them in separate folders so that I don't have to guess what goes where
Cheers,
Dimitris
|
|
| | | | | |
Re: EGL: get access to an ecore model objects' properties [message #1719577 is a reply to message #1719524] |
Sat, 09 January 2016 07:38 |
Alireza Rouhi Messages: 148 Registered: December 2015 |
Senior Member |
|
|
Hi Dimitris,
I have another problem with working on an ecore model. The statement,
var m = Model.allInstances();
returns all of the given model elements as a single serialized sequence. So, I cannot explore the model classifiers at all. I want to be able to write statements similar to,
m.eClass.select(c | c.name = "Greeting");
to filter-out special classifiers and get access to their properties.
As the following screenshot displays, when I open the ecore model file in the Exeed Editor, I don't see any relationships between the classifiers of model in the properties view, I mean any classifier hierarchy like owned elements, owner properties to name a few, as we can see in a UML model. Of course, this relationships are reflected near each object in the form of:
For example, there is not any property regarding the Model object!
Exeed Editor:
Is there any way or trick to load an ecore model still keep its model structure (not serialized) in an egl file to get access the objects' properties?
Thanks a lot.
Kind regards,
Alireza
[Updated on: Tue, 12 January 2016 14:41] Report message to a moderator
|
|
|
Re: EGL: get access to an ecore model objects' properties [message #1720031 is a reply to message #1719577] |
Wed, 13 January 2016 20:51 |
|
Hi Alireza,
> Is there any way or trick to load an ecore model still keep its model structure (not serialized) in an egl file to get access the objects' properties?
(I'm not sure I understand the question so apologies if the answer below is not helpful.)
If you need to navigate an EMF models through its containment structure, you can use EObject's eContents() operation as follows:
var root = M.resource.contents.first();
root.visit();
operation Any visit() {
self.println();
for (child in self.eContents()) {
child.visit();
}
}
Cheers,
Dimitris
|
|
|
Re: EGL: get access to an ecore model objects' properties [message #1720035 is a reply to message #1720031] |
Wed, 13 January 2016 21:15 |
Alireza Rouhi Messages: 148 Registered: December 2015 |
Senior Member |
|
|
Dear Dimitris,
Hi,
Thanks a lot for your solution.
I used the following code for my minExample, but in circumstances that the model is complex, it seems that my solution will not be extensible and flexible. What do you think about this solution?
[% var m = Model.allInstances();
var seq = Sequence{0..m.size()-1};
var index = seq.select(i: Integer | (i >= 0 and i < m.size() and m.at(i).eClass.name = "Greeting"));
var contextName: String; %]
[% var i: Integer = 0; %]
[% while (i < index.size()) { %]
[% contextName = m.at(index.at(i)).name; %]
context [%= contextName %] {
...
}
[% i = i + 1; %]
[%}%]
Kind regards,
Alireza
[Updated on: Wed, 13 January 2016 21:16] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Fri Apr 19 08:49:33 GMT 2024
Powered by FUDForum. Page generated in 0.02593 seconds
|