Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
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 #1719385 is a reply to message #1719340] Thu, 07 January 2016 15:21 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Alireza,

Could you please provide a minimal example [1] that we can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: EGL: Setting-up an ecore model features [message #1719399 is a reply to message #1719385] Thu, 07 January 2016 16:04 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Hi Dimitris,

Thanks for your reply.
Please, see the attachment.

Kind regards,
Alireza
Re: EGL: Setting-up an ecore model features [message #1719498 is a reply to message #1719399] Fri, 08 January 2016 11:47 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Hi Dimitris,

The following code for the foo.egl resolves my minExample problem.
[% var m = Model.allInstances();%]
	[% var contextName: String; %]
	[% var i: Integer = 1; %] 
	[% while (i < m.size()) { %]
		[% contextName = m.at(i).name; %]
		context [%= contextName %] {
			...
		}		
		[% i = i + 1; %]
[%}%]


However, when I launch the foo.egl on another emf model which is complicated than Foo, my model file is corrupted (i.e., all of its contents are disappeared!) and as a result, message like the following image:

index.php/fa/24550/0/

is reported.

Please, help me to resolve this problem. Thanks a lot.

Kind regards,
Alireza

[Updated on: Fri, 08 January 2016 11:48]

Report message to a moderator

Re: EGL: Setting-up an ecore model features [message #1719500 is a reply to message #1719498] Fri, 08 January 2016 11:53 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Alireza,

It's unlikely that I'll be able to help with this in any meaningful way if I'm not able to reproduce the problem locally.

Cheers,
Dimitris
Re: EGL: Setting-up an ecore model features [message #1719502 is a reply to message #1719500] Fri, 08 January 2016 12:04 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

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: Setting-up an ecore model features [message #1719519 is a reply to message #1719502] Fri, 08 January 2016 15:27 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Hi Dimitris,

Sorry about the any incompleteness that you have observed in my previous messages. Let me explain the problem again.

When I apply the foo.egl to my real model not for the greetings minExample which its size is "3" (indeed, my actual model is a model of an ecore metamodel just like the MyDSL example language of Xtext which I have posted its plugins' JAR files). Since the size of my given model, here m,
 var m = Model.allInstances(); 

is greater than 200 (I think it is the maximum allowable size for a sequence in Epsilon, this message is displayed on the Epsilon console view). As a result, this causes my model to be corrupted by launching egl script.

Thus, do you have a suggestion to resolve this limitation? Thanks a lot.

Kind regards,
Alireza
Re: EGL: Setting-up an ecore model features [message #1719521 is a reply to message #1719519] Fri, 08 January 2016 15:38 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Alireza,

One way to debug this would be to progressively grow the size and complexity of your minimal model until the problem starts to appear.

Cheers,
Dimitris
Re: EGL: Setting-up an ecore model features [message #1719522 is a reply to message #1719521] Fri, 08 January 2016 15:45 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Hi Dimitris,

Thanks for the suggested trick.
Is it possible to read a model instances partially?
In other words, is it possible to collect a model instances in more than one step, say in three or more steps?

Kind regards,
Alireza

[Updated on: Fri, 08 January 2016 15:46]

Report message to a moderator

Re: EGL: Setting-up an ecore model features [message #1719523 is a reply to message #1719522] Fri, 08 January 2016 15:48 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Alireza,

I'm not sure I understand your question. Could you please elaborate a bit more?

Cheers,
Dimitris
Re: EGL: Setting-up an ecore model features [message #1719524 is a reply to message #1719523] Fri, 08 January 2016 15:53 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Hi Dimitris,

Thanks for your reply.
My problem was resolved by rewriting and refactoring the Xtext code of my DSL.

Kind regards,
Alireza

[Updated on: Fri, 08 January 2016 22:19]

Report message to a moderator

icon5.gif  Re: EGL: get access to an ecore model objects' properties [message #1719577 is a reply to message #1719524] Sat, 09 January 2016 07:38 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
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:
Greeting@Model.greetings

For example, there is not any property regarding the Model object!

Exeed Editor:
index.php/fa/24560/0/

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 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

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 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
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

Re: EGL: get access to an ecore model objects' properties [message #1720078 is a reply to message #1720035] Thu, 14 January 2016 09:54 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Alireza,

Off the top of my head, you could rewrite this code as follows.

[%for (m in Greeting.all)){%]
	context [%= m.name %] {
		...
	}
[%}%]


Cheers,
Dimitris
Re: EGL: get access to an ecore model objects' properties [message #1720085 is a reply to message #1720078] Thu, 14 January 2016 10:12 Go to previous message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Dear Dimitris,

This is great and works fine.
Thank you very much.

Best regards,
Alireza
Previous Topic:Create button in Eugenia
Next Topic:EGL: Sending the generated text to an output file
Goto Forum:
  


Current Time: Fri Apr 19 08:49:33 GMT 2024

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

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

Back to the top