[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.mdt.uml2.ocl] Re: How to validate a element name for using only a certain character set

Hi, Andy,

Not with OCL, I'm afraid.  The Sequence{} literal syntax for ranges only
works for integers, and there isn't a conversion from UNICODE codes to
strings.  (OCL has no 'character' data type)

You would actually have to define either
  - a string containing every valid character, and iterate through it
    char by char comparing the characters in the target string, OR
  - a Set containing every valid character, and iterate through the
    target string char by char checking that the set contains each

This looks like another case for RSA's Java constraints.

Sorry,

Christian


Andreas Maier wrote:

> In CIM, the name of a CIM element must consist of only the following
> characters:
> "_", "A", ... , "Z", "a", ... , "z", "0", ... , "9", U+0080, ... , U+FFEF
> and the first character must not be "0", ... , "9".
> 
> Is there a way to validate the name of an UML element efficiently
> against this rule ?
> 
> Andy