EMF Framework Validation [message #879730] |
Thu, 31 May 2012 14:28  |
Eclipse User |
|
|
|
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 15:45  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.30149 seconds