Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Framework Validation
EMF Framework Validation [message #879730] Thu, 31 May 2012 18:28 Go to next message
Pablo Silva is currently offline Pablo SilvaFriend
Messages: 28
Registered: May 2012
Location: Brazil
Junior Member

Hi guys.

I need put a validation in the my Ecore Model.
This validation is related with a name of a NODE.
This name can't have a caracteres kind of (#%*&($%_) and no spaces.

I would like a some help with this. I'm a new user in this area and
I tryed to do that with OCL Validation, but I can't do that.

I just could do for the first letter of the name.
Look my expression in OCL:

((self.name.substring(1,1)<='@' or self.name.substring(1,1)>='[') and (self.name.substring(1,1)<='`' or self.name.substring(1,1)>='{')) implies self.name.oclIsInvalid()



How I can't do, I need other way for to do.
If you can help me I appreciate.
Re: EMF Framework Validation [message #879762 is a reply to message #879730] Thu, 31 May 2012 19:45 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7670
Registered: July 2009
Senior Member
Hi

There is no Character type in OCL and no codePoint() operation so you
must work with String.

Something like this can be extended

package Pablo : pfx = 'platform:/resource/Activity%20QVTd/Pablo.ecore' {
class Named
{
property name : String;

invariant NoBadCharacters: name.characters()->forAll(c : String
| c <> '<' and c <> '>');
}
}

Regards

Ed Willink

On 31/05/2012 19:28, Pablo Silva wrote:
> Hi guys.
>
> I need put a validation in the my Ecore Model.
> This validation is related with a name of a NODE.
> This name can't have a caracteres kind of (#%*&($%_) and no spaces.
>
> I would like a some help with this. I'm a new user in this area and
> I tryed to do that with OCL Validation, but I can't do that.
>
> I just could do for the first letter of the name.
> Look my expression in OCL:
>
> ((self.name.substring(1,1)<='@' or self.name.substring(1,1)>='[') and
> (self.name.substring(1,1)<='`' or self.name.substring(1,1)>='{'))
> implies self.name.oclIsInvalid()
>
>
> How I can't do, I need other way for to do.
> If you can help me I appreciate.
Previous Topic:EMF / CDO Transaction conflict
Next Topic:[CDO] Backends and query languages
Goto Forum:
  


Current Time: Mon Sep 23 02:44:07 GMT 2024

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

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

Back to the top