Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » how the gmf editor supports a constraint in the ecore model
how the gmf editor supports a constraint in the ecore model [message #756326] Sat, 12 November 2011 02:31 Go to next message
Patricia Espada is currently offline Patricia EspadaFriend
Messages: 47
Registered: November 2011
Member
Hi

I am trying simply to understand how the gmf editor respond to a ecore class constraint. For example, in the gmf editor (result of a new eclipse instance) how can I know if a mandatory class attribute has been set? For what I understand, when an new eclipse instance is created it can not display that information. But will the plugin display it? If not, what are the possible and "simple" solutions that I should look for.

I am doing this for my MSc thesis, changing an existing dsl from a college to validate a single attribute so I can parse the resulting file and proceed with my real MSc work.

Thanks
Re: how the gmf editor supports a constraint in the ecore model [message #756337 is a reply to message #756326] Sat, 12 November 2011 08:24 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi,

Would this perhaps help?
http://www.eclipse.org/gmt/epsilon/doc/articles/evl-gmf-integration/

Cheers,
Dimitris

On 12/11/2011 02:31, Patr wrote:
> Hi
>
> I am trying simply to understand how the gmf editor respond to a ecore
> class constraint. For example, in the gmf editor (result of a new
> eclipse instance) how can I know if a mandatory class attribute has been
> set? For what I understand, when an new eclipse instance is created it
> can not display that information. But will the plugin display it? If
> not, what are the possible and "simple" solutions that I should look for.
>
> I am doing this for my MSc thesis, changing an existing dsl from a
> college to validate a single attribute so I can parse the resulting file
> and proceed with my real MSc work.
>
> Thanks
Re: how the gmf editor supports a constraint in the ecore model [message #756397 is a reply to message #756337] Sat, 12 November 2011 17:35 Go to previous messageGo to next message
Patricia Espada is currently offline Patricia EspadaFriend
Messages: 47
Registered: November 2011
Member
First of all, thanks for the quick response Dimitris.

Second, I actually have already try that tutorial, but with no positive results.
What I have done was creating a simple evl file in the main emf project. After that I enable the validation flags in the .gmfgen, and proceed to step 2 and step 4. When a run a new eclipse instance, it stays all the same. I have force the validation in the Edit->Validate but nothing happens.

my evl file
context KAOS {
	constraint UniqueRoot {
		check: self.hasNodes->select(g: Goal | g.isRoot = true)->size() = 1
		message: 'More then one goal is the root'
	}
}


KAOS is the root of my model. And what I need from this constraint is that the model need to have exactly one goal root, and if otherwise present some kind of error. In fact I don't know if I have to introduce this same constraint in the OCLInEcore?!

Thank you, Patricia
Re: how the gmf editor supports a constraint in the ecore model [message #756400 is a reply to message #756397] Sat, 12 November 2011 18:14 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Patricia,

Could you please zip the relevant Eclipse projects and send me a copy at epsilondevs gmail com so that I can have a look?

Cheers,
Dimitris
Re: how the gmf editor supports a constraint in the ecore model [message #756401 is a reply to message #756400] Sat, 12 November 2011 18:23 Go to previous messageGo to next message
Patricia Espada is currently offline Patricia EspadaFriend
Messages: 47
Registered: November 2011
Member
Thank you for your support, I've already send you my project.
Re: how the gmf editor supports a constraint in the ecore model [message #756447 is a reply to message #756401] Sun, 13 November 2011 12:20 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Patricia,

Using the latest version of GMF Tooling (2.1.0.v20110607-2359) / Epsilon 0.9.1 I'm not able to generate a GMF editor from KAOS.emf as I'm getting a long list of validation errors on the produced .gmfgen. I can generate editors from other .emf files so there seems to be some issue specific to this one - which I need to investigate further. Could you please let me know which versions of Epsilon/GMF you're using?

In the mean time I'd suggest removing all OCL-related bits from your .emf file and regenerating the editor.

Cheers,
Dimitris
Re: how the gmf editor supports a constraint in the ecore model [message #756477 is a reply to message #756447] Sun, 13 November 2011 20:47 Go to previous messageGo to next message
Patricia Espada is currently offline Patricia EspadaFriend
Messages: 47
Registered: November 2011
Member
Hello Dimitris,

I'm using eclipse Indigo, the same Epsilon version and the GMF Tooling version is 2.4.0.v20110520-2359.

The process I use to create the GMF editor, is first of all generating the .emf file (usually with no problems), then generate the EMF Gen Model. Open the .genmodel file and right click over the root and Generate All (this generated the Kaos.edit, Kaos.editor and Kaos.tests). Then generate the GMF tool, graph and map models (not automatically the GMF editor). After that right click over the .gmfmap file and generate the .gmfgen file. To finish this right click over the .gmfgen file to generate the diagram code. This way I don't get any validation errors.

I will remove all OCL from my .emf file.

Thank you,
Patrícia
Re: how the gmf editor supports a constraint in the ecore model [message #759476 is a reply to message #756326] Mon, 28 November 2011 19:14 Go to previous message
Paulo Alexandre is currently offline Paulo AlexandreFriend
Messages: 17
Registered: November 2011
Junior Member
Hi, Patricia

I think I can help you. Please, see this simple emf meta model.

@namespace(uri="family", prefix="family")
package family;

@gmf.diagram(foo="bar")
class Parents
{
val Father[*] fathers;
val Mother[*] mothers;

}

@gmf.node(label="name")
class Father{
attr String name;
}

@gmf.node(label="name")
class Mother{
attr String name;
}

If you create a gmf Editor (a new eclipse instance) and Click Edit->Validate nothing will show up. But if you change the property 'name' in this way

attr String name; --> attr String[1] name;

the property 'name' will be automatically mandatory. So, in gmf editor (new eclipse instance) if the property 'name' is not set and if you click Edit->Validate you'll get an error like this: <<The required feature 'name' of '<Parents>::<Father>' must be set>>

Anyway, I followed the tutorial Dimitrius has talked about. Actually, I didn't need to perform all the actions described there. All I needed to do was:

Having written the constraints, the next step is to bind them to the GMF editor. To do this, we switch to the Extensions tab of MANIFEST.MF and add the org.eclipse.epsilon.evl.emf.validation extension. Then we right-click it and add a new constraintBinding. In thenamespaceURI field of the extension we set the value to <<name of your package>> and in the constraints field we select the <<file .evl which contains the constraints>> EVL file we created in Step 3.

In any case, just let us know if you were successfull, ok ?
Previous Topic:[Eugenia] Negation
Next Topic:[Eugenia] Change node's image after a changing of an attribute
Goto Forum:
  


Current Time: Thu Mar 28 16:27:49 GMT 2024

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

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

Back to the top