ocl

OCLinEcore and Regex to create valid IPv4 string

北城余情 提交于 2019-12-11 01:11:31
问题 I have an Ecore model, where I'm trying to add some OCL constraints. My problem comes when I try to make a property (a string) that is in valid IPv4 form. I guess I should use a regular expression, but I have no idea at all about how to use regex on OCLinEcore. 回答1: As of Eclipse Juno, you can use regular expressions in OCL. The function to call on it is matches(regex), just like in Java. context Packet inv ValidIPv4 : ip.matches('\b([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\b')

OCL constraints checking on Eclipse Papyrus

∥☆過路亽.° 提交于 2019-12-06 01:37:38
Does anyone manage to check OCL constraints on a class diagram modeled in Eclipse Papyrus ? I have definied a simple test profile with only one constraint on a stereotype attribute : {OCL} self.property > 0 The stereotype extends the Property metaclass so I applied it on a class attribute and I set the property of the stereotype to 0. But I never got an error with the Validation > Validate Model command from the context menu. Any help would be much appreciate. Thanks by advance. I answer to myself for other people who might have the same problem. OCL constraints checking doesn't work for