OCL Inheritance [message #1470827] |
Wed, 12 November 2014 17:11 |
Rishi Kanth Messages: 18 Registered: October 2014 |
Junior Member |
|
|
Hi,
I have created a UML Profile with the following structure :- two stereotypes A1 and A2, where A1 is extension of UML::Assocication and A2 is derived from A1(or A1 is a generalization of A2).
I have defined two OCL constraints OC1 (applied to A1) as
self.base_Association.endType.getAppliedStereotypes()->asBag().name = Bag{'ST1','ST1'}
or
self.base_Association.endType.getAppliedStereotypes()->asBag().name = Bag{'ST1','ST3'}
and OC2 (applied to A2) as
self.base_Association.endType.getAppliedStereotypes()->asBag().name = Bag{'ST2','ST3'}
(ST1, ST2 and St3 are stereotypes from another profile that extend UML:Class)
As A2 is derived from A1, how do the OCL constraints behave. From my experimenting and observation, A2 inherits the OCL from A1 and combines them as OC2 AND OC1.
Please correct me if I am wrong and also, if any other information on this topic.
Thanks,
Rishi
|
|
|
Re: OCL Inheritance [message #1470966 is a reply to message #1470827] |
Wed, 12 November 2014 19:33 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
Constraints should apply to derived classs.
You can regard the composition as a conjunction, if you like.
[Efficient tooling should realize them as a conjunction to exploit CSE
and avoid duplicate/premature evaluation.]
Regards
Ed Willink
On 12/11/2014 17:11, Rishi Kanth wrote:
> Hi,
>
> I have created a UML Profile with the following structure :- two
> stereotypes A1 and A2, where A1 is extension of UML::Assocication and A2
> is derived from A1(or A1 is a generalization of A2).
> I have defined two OCL constraints OC1 (applied to A1) as
> self.base_Association.endType.getAppliedStereotypes()->asBag().name =
> Bag{'ST1','ST1'}
> or
> self.base_Association.endType.getAppliedStereotypes()->asBag().name =
> Bag{'ST1','ST3'}
> and OC2 (applied to A2) as
> self.base_Association.endType.getAppliedStereotypes()->asBag().name =
> Bag{'ST2','ST3'}
>
> (ST1, ST2 and St3 are stereotypes from another profile that extend
> UML:Class)
>
> As A2 is derived from A1, how do the OCL constraints behave. From my
> experimenting and observation, A2 inherits the OCL from A1 and combines
> them as OC2 AND OC1.
> Please correct me if I am wrong and also, if any other information on
> this topic.
>
> Thanks,
> Rishi
>
>
>
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04095 seconds