I am a beginner in ocl so there are things that I don't know how to handle yet.
I am building a dynamic constraint which does a coherence check based on a "user_level" profile property (Profiling/System Design/Element).
The check is basically the "user_level" of an element has to be higher than the "user_level" of it's parent.
Context: sysml::SysMLElement
inv:
let
level:Integer = self.getProfilePropertyValue('user_level'),
parentLevel:Interger = self.mediniGetContainer().oclAsType(sysml::SysMLElement).getProfilePropertyValue('user_level'),
in
parentLevel < level
The principal issue I have is that mediniGetContainer() can return something that does not have the "user_level" property (e.g. System Model). OCL has strict access rules during the coding so I though I was being clever with "oclAsType(sysml::SysMLElement)" but it obviously does not work. I don't know what's the cleanest way to handle this.
The other issue I have is that sysml::SysMLElement seems to contain ports and defining user_level in Profiling/System Design/Element does not impact ports. Can you tell me which context in dynamic constraints is strictly equivalent to Profiling/System Design/Element ?
Have a nice day,
Adrien Gerard