OCL Unknown Type

Other topics that do not fit in any of categories.

Moderator: Moderators

OCL Unknown Type

Postby Calvin.Perine@insitu.com » Tue Nov 24, 2020 10:24 pm

Hello! I am hoping you can help.

I am using Cameo Systems Modeler 19.0 SP3.
I am trying to use OCL to validate that a tag value of a block is not set to a particular enumeration literal, but I keep getting and Unknown type error:

OCLExample.mdzip

The example model has a profile that defines a stereotype named “Core”.
The Core stereotype redefines an inherited property named “eD” having multiplicity 1 and a type “EXDE”.
Core has a <<validationRule>> constraint named “Core Constraint” applied which specifies:
Code: Select all
Context Core inv Core Constraint
self.eD <> EXDE::I

EXDE is a SysML enumeration ( <<valueType>>) with enumeration literals “I” and “E”.
The model has a BDD with a block named “My Core” having the <<Core>> stereotype applied.
When I validate the BDD I get the error:

Expression has errors:Semantic error at [0:11]: Unknown type ([EXDE,I])

I’m not sure why my enumeration is not understood as a valid Type in OCL, but works fine as a Type in the model.
What would be the OCL to ensure that a Core instance does not have its eD tag set to a value of “I”?
Thanks!

Here are some images from the example:
My Profile.png

Containment.PNG

BDD.png
You do not have the required permissions to view the files attached to this post.
Calvin.Perine@insitu.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Thu Nov 12, 2020 1:11 pm
Full name: Calvin P

Re: OCL Unknown Type

Postby Calvin.Perine@insitu.com » Thu Dec 10, 2020 8:33 pm

I solved my own problem and wanted to post the reply here so others could learn.
I had to explicitly use the fully qualified path to the enumeration literal (that is My_Profile::Data_Types::EXDE::I), and the OCL syntax needed some slight adjustment. Use of the <> operator did not work.

The OCL that worked was:

Code: Select all
Context Core inv Core Constraint
not (self.eD = My_Profile::Data_Types::EXDE::I)
Calvin.Perine@insitu.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Thu Nov 12, 2020 1:11 pm
Full name: Calvin P


Return to Other

Who is online

Users browsing this forum: No registered users and 0 guests

cron