Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Best way to realize constraints in meta model
Best way to realize constraints in meta model [message #1073455] Wed, 24 July 2013 20:53 Go to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi,

I was thinking about the best way to realize a meta model constraint with Eugenia. Imagine the following metamodel:

index.php/fa/15705/0/

I read a little bit about the Epsilon Validation Language, would this be a reasonable way for realsizing this? Or are there better ways?

Cheers,
Phil
  • Attachment: xor_emf.JPG
    (Size: 36.42KB, Downloaded 531 times)
Re: Best way to realize constraints in meta model [message #1073461 is a reply to message #1073455] Wed, 24 July 2013 21:12 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 Phil,

EVL should be fine for this. Off the top of my head, your constraint would look like this:

context Remove {
constraint PropertyXorElement {

check: self.elementToRemove.isDefined() xor self.propToRemove.isDefined()

message: self + " cannot remove both an element and a property"

}
}

Cheers,
Dimitris
Re: Best way to realize constraints in meta model [message #1073703 is a reply to message #1073461] Thu, 25 July 2013 10:40 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Thx Dimitris,

that's great so far. One of the features of EVL is "Out-of-the-box integration with the EMF validation framework and GMF"..Since I'mn using an combined EMF/GMF Editor and the meta model constraint is only part of the EMF Editor (for this classes, there are no eugenia annotations in the emf file, but I'm still using Eugenia to generate both editors). I'm wondering if EVL also works in the EMF Editor or is just applicable for the gmf editor??

Cheers,
Phil
Re: Best way to realize constraints in meta model [message #1073706 is a reply to message #1073703] Thu, 25 July 2013 10:44 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 Phil,

EVL hooks into the EMF Validation framework so it also works on tree-based EMF editors.

Cheers,
Dimitris
Re: Best way to realize constraints in meta model [message #1073803 is a reply to message #1073706] Thu, 25 July 2013 14:13 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Ok, I tried this, but the validation doesn't seems to work right. By using this metamodel (only a part)

index.php/fa/15711/0/

and this concrete Model, I get this:

index.php/fa/15712/0/


I used the constraint for the Remove class, which you mentioned earlier Dimitris. Normally the validation should be fine, cause there is no remove class yet. Am i missing something?

Cheers,
Phil

Re: Best way to realize constraints in meta model [message #1073805 is a reply to message #1073803] Thu, 25 July 2013 14:18 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 Phil,

These errors come from EMF itself as your model doesn't seem to be conforming to the cardinalities specified in its metamodel (e.g. a VariationElement is required to have a Remove, a ConcreteProperty etc as the minimum cardinality of its respective references is 1). To make these errors go away I'd suggest that you set the cardinalities of these references to 0..1 instead.

Cheers,
Dimitris
Re: Best way to realize constraints in meta model [message #1073897 is a reply to message #1073803] Thu, 25 July 2013 18:08 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
You're absolutely right Dimitris.

But the self defined constraint doesn't seems to work, no matter how I define the constraint:

index.php/fa/15714/0/

So I set a BreakingPoint to my evl file and it seems that the constraint definition isn't used.

I followed this article (http://www.eclipse.org/epsilon/doc/articles/evl-gmf-integration/) and not sure about the definition of the extension point, especially the markerType.. As I seen from the article, I think I've to refer to my diagram project, but what is the diagnostic class?

<markerResolutionGenerator
      class="org.eclipse.epsilon.evl.emf.validation.EvlMarkerResolutionGenerator"
      markerType="org.model.variability.diagram.diagnostic">
</markerResolutionGenerator>
Re: Best way to realize constraints in meta model [message #1073995 is a reply to message #1073897] Thu, 25 July 2013 22:52 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 Phil,

The class looks correct. Could you please double-check that the namespaceURI in your constraintBinding extension matches that of your root Ecore package? If it does, please send me a copy of your project at epsilon.devs@gmail.com and I'll investigate.

Cheers,
Dimitris
Re: Best way to realize constraints in meta model [message #1074275 is a reply to message #1073995] Fri, 26 July 2013 12:10 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi Dimitris,

my namespaceUri matches my package name,w hcih I've defined in my emf file:

@namespace(
	uri="/org.model.variability/model/pld.ecore",
	prefix="p")

package pld;


<constraintsBinding
            compose="true"
            constraints="validation/Variationpoint.evl"
            namespaceURI="pld">
      </constraintsBinding>


Should be right, or?

But for the markerType, Eclipse metioned the following:

Referenced identifier 'org.model.variability.diagram.diagnostic' in attribute 'markerType' cannot be found


Cheers,
Phil
Re: Best way to realize constraints in meta model [message #1074279 is a reply to message #1074275] Fri, 26 July 2013 12:17 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 Phil,

The namespaceURI should be /org.model.variability/model/pld.ecore (the same as the uri of your package). You can use the browse button next to the markerType field in plugin.xml to find the correct marker type.

Cheers,
Dimitris
Re: Best way to realize constraints in meta model [message #1074315 is a reply to message #1074279] Fri, 26 July 2013 13:42 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi Dimitris,

in this article (http://www.eclipse.org/epsilon/doc/articles/evl-gmf-integration/) and in the example code just "filesystem" was used as namespaceUri..That was a little bit confusing for me..

I used now the namespaceUri you mentioned and fixed the marker, but it still doens't work...

My project has a size of round about 40mb, so emailing will be ok for you?

Cheers,
Philipp
Re: Best way to realize constraints in meta model [message #1074627 is a reply to message #1074315] Sat, 27 July 2013 09:11 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 Phil,

Is there any way you could slim it down (e.g. delete code that I can regenerate etc.)? If not, we could try Dropbox (dskolovos@gmail.com) if that's OK.

Cheers,
Dimitris
Re: Best way to realize constraints in meta model [message #1076065 is a reply to message #1074627] Tue, 30 July 2013 16:37 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi Dimitris,

I've send you an email with the link to the dropbox folder..Maybe youc an have a look what's wrong there...


Another Question: Is EVL supporting Live Validation? I've read about this feature in this blog post: http://ed-merks.blogspot.de/2013/01/decorating-with-emf.html

The only thing I could figure out is a receipe (http://www.eclipse.org/epsilon/doc/articles/evl-gmf-integration/) where validation is performed whenever a diagram is saved.


Cheers,
Phil
Re: Best way to realize constraints in meta model [message #1076144 is a reply to message #1076065] Tue, 30 July 2013 19:56 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 Phil,

Your plugin.xml looks fine but unfortunately I'm not able to run the editor as I'm missing a couple of plugins (de.itemis.xtext.utils.gmf, de.itemis.xtext.utils.jface). Could you please try with a clean GMF editor to see whether it's the interplay with Xtext that's causing this problem?

Cheers,
Dimitris
Re: Best way to realize constraints in meta model [message #1076456 is a reply to message #1076144] Wed, 31 July 2013 12:23 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi Dimitris,

the interplay with xtext wasn't causing any problems. I had a small misstake in my check sentence, which I didn't noticed all the time. Now it's working as you can see:

index.php/fa/15787/0/

But I observed an unexpected (for me) behaviour.
It's necessary to validate from the top of the tree in order to get a correct validation message. After this it doesn't matter in which part of the tree you click on validate, it's working then like expected.
But if you didn't start validating from the top of the tree, you always get a "Validation compledted succesfully" message:

index.php/fa/15788/0/

Is this the desired behaviour?

Cheers,
Phil

Re: Best way to realize constraints in meta model [message #1076482 is a reply to message #1076456] Wed, 31 July 2013 13:09 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Phil,

I'm glad this works now. I'll have a look at the non-root validation issue and get back to you.

Cheers,
Dimitris
Previous Topic:Run configurations
Next Topic:Property view error: Exeed?
Goto Forum:
  


Current Time: Thu Apr 18 23:36:50 GMT 2024

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

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

Back to the top