[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.modeling.mdt.uml2.ocl] meaning of OCL getAppliedSubstereotype() ?
|
Hi,
I am trying to understand what the OCL function
getAppliedSubstereotype() does, because it looks like I can make use of
it in some scenario.
The Eclipse UML2 description of the corresponding Java function reads:
-------------------------
getAppliedSubstereotype
public Stereotype getAppliedSubstereotype( Stereotype stereotype,
String qualifiedName)
Retrieves the substereotype of the specified stereotype with the
specified qualified name that is applied to this element, or null if no
such stereotype is applied.
-------------------------
Here are my questions:
1. What is a "substereotype" ? A stereotype that is a specialization of
another stereotype ?
2. I was trying to use the OCL function in a scenario where I am in a
Class (OCL Context-wise), and want to go to a "substereotype" (using the
assumption from above on what it is) of a stereotype that extends Class:
- Stereotype "CIM_Class" extends Class, and inherits from Stereotype
"CIM_Qualifier_Abstract"
- The OCL constraint is owned by Stereotype "CIM_Class", and I tried
(using some extra "let" expressions in order to test any intermediate
results, due to lack of an OCL debugger ;-)
-------------------
let mes : Stereotype =
self.base_Class.getAppliedStereotype('CIM::CIM_Class')
in
let qts : Stereotype =
self.base_Class.getAppliedSubstereotype( mes,
'CIM::CIM_Qualifier_Abstract')
in
mes <> null and mes.name = 'CIM_Class' /* (1) */
and qts <> null and qts.name = 'CIM_Qualifier_Abstract' /* (2) */
-------------------
The expression in line (1) succeeds, but the one in line (2) fails, so
it seems I am either using this function in a wrong way, or it does not
work as expected.
I am aware that the generalization direction in my example is just the
other way around, i.e. the OCL attempts to go to the super-stereotype,
and that may already be the answer why it does not work. However I am
having trouble to imagine a scenario where one would use the function to
go to the sub-stereotype of one that was applied. Would the properties
of such a sub-stereotype also be on the element that is extended by the
super-stereotype ?
Andy