Re: OCL constraint problems with data types [message #43441] |
Fri, 16 November 2007 13:58 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Joachim,
Which versions of EMF Validation and MDT OCL are you using?
The OCL parser's Ecore metamodel binding should be mapping data types to OCL
types as follows:
- EInt, EIntegerObject ==> Integer
- EShort, EShortObject ==> Integer
- ELong, ELongObject ==> Integer
- EFloat, EFloatObject ==> Real
- EDouble, EDoubleObject ==> Real
Moreover, any EDataType whose instance-class is a Java numeric type should
have an appropriate mapping. If this isn't the case, then you likely have
a bug for the MDT OCL component.
Cheers,
Christian
Joachim Rietz wrote:
> Hi!
>
> We're using EMF Validation Framework to write OCL constraints for our EMF
> models through the "org.eclipse.emf.validation.constraintProviders"
> extension point.
> However, we have problems with this when using different data types.
> If we have an attribute "vNVSHUNT" of type 'int' or 'EInt' an OCL
> constraint defined in plugin.xml as below works fine:
>
> <constraint
> lang="OCL"
> severity="ERROR"
> mode="Batch"
> name="Valid value range for vNVSHUNT"
> id="vNVSHUNT.validValue"
> statusCode="1">
> <description>vNVSHUNT set to value >= 5.</description>
> <message>"{0}". Invalid value.</message>
> <target class="Pct3Def"/>
> <![CDATA[
> self.vNVSHUNT >= 5
> ]]>
> </constraint>
>
> BUT, for other types such as 'short', 'float', 'EShort' etc there's
> problem.
> No matter what the value of vNVSHUNT is set to, the constraint always
> evaluates that the value is not valid!
>
> Any idea what the problem could be?
> Is it only possible to have these OCL constraints for a certain range of
> data types (e.g. int, string)?
> Are there any drawbacks of not using only the 'EXxxx' data types? I.e.
> what's the functional difference of using e.g. 'EInt' vs. 'int'?
>
>
> Really appreciate a quick answer on above issues.
>
> Regards,
> Joachim
|
|
|
Powered by
FUDForum. Page generated in 0.03201 seconds