UML Integer and SysML Integer are different types and they are incompatible. You can't convert SysML Integer to UML Integer.
Integer from UML profile has the comparison operations. Other profiles can have a classifier named Integer but this does not mean that it will be treated as an Integer from UML profile. At the moment MD supports primitive types from other profiles only. A PrimitiveType with a name Integer in a custom profile will be treated as an Integer from the UML profile. In this case OCL expression self.rangeBegin <= self.rangeEnd would be valid (types of rangeBegin and rangeEnd should be myProfile::Integer).
However, the Integer from the SysML profile is not a primitive type. It is a DataType with the stereotype ValueType and it has no support from MD OCL engine. So in order to compare Integers from the SysML profile you have to use the following OCL expression:
- Code: Select all
self.appliedStereotypeInstance.slot -> select(definingFeature.name='rangeBegin') -> asSequence() -> first().value -> first().oclAsType(LiteralInteger).value <=
self.appliedStereotypeInstance.slot -> select(definingFeature.name='rangeEnd') -> asSequence() -> first().value -> first().oclAsType(LiteralInteger).value