|
|
|
|
|
|
|
Re: OCL constraints on stereotypes [message #1047741 is a reply to message #1047725] |
Tue, 23 April 2013 15:34 |
Camille Letavernier Messages: 952 Registered: February 2011 |
Senior Member |
|
|
Hi,
A lead:
- a.memberEnds is a UML feature. This means that it returns instances of UML Elements (Which might be stereotyped with ServiceInteraction). It *won't* return instances of ServiceInteraction (Or any other stereotype). a is an Association, memberEnd contains Properties, r is a Property, and r.type is a UML Type. So you should type something like: not r.type.getAppliedStereotype(yourProfile::ServiceInteraction).oclIsUndefined()
However, this constraint should fail during validation.
> But when i validate the model that apply my profile (open *.uml-->right click on the model-->validate), the validation is successful!
You should use Papyrus to validate profiled models defined in Papyrus. Or, at least, use the latest UML integration build.
Regards,
Camille
Camille Letavernier
|
|
|
|
|
|
|
|
Re: OCL constraints on stereotypes [message #1434804 is a reply to message #1434577] |
Tue, 30 September 2014 16:19 |
|
Hi, Walid,
The Lifeline metaclass has no 'connectorEnds' property. It has a
'represents' property of type ConnectableElement that has an 'end'
property (note the singular).
The ConnectorEnd metaclass has no 'ConnectorEnd' property nor
'Connector'. Unfortunately, the UML metamodel completely forgot to
define an opposite of the Connector::end property, so you have to
navigate awkwardly through the end's owner.
How does the following work for you?
self.base_Lifeline.represents.end->forAll(end |
end.owner.oclAsType(Connector)->exists(type.extension_ObjectBase->notEmpty())
and
end.owner.oclAsType(Connector)->exists(type.extension_ObjectMultiviews->notEmpty()))
This says that, if the lifeline's represented connectable element is
associated with any connector ends, then the connector owning every
associated end must be typed by an association that has both the
<<ObjectBase>> and <<ObjectMultiviews>> stereotype applied. Is that
the constraint that you want to express?
HTH,
Christian
On 2014-09-30 09:25:06 +0000, Walid Ban said:
> Hi Camille,
> I moved to Eclipse Luna, Papyrus v1.0.0 20140611 and OCL 5.0.2
> I put this constraint but the parser didn't accept it:
>
> self.base_Lifeline.connectorEnds->forAll(o |
> o.ConnectorEnd.Connector
> ->exists(type.extension_ObjectBase <> null)
> and o.ConnectorEnd.Connector
> ->exists(type.extension_ObjectMultiviews <> null))
>
> I Still don't know what is the right syntax :(
> Could you help me please...
> Regards
>
> <image>
> <image>
|
|
|
|
Re: OCL constraints on stereotypes [message #1435583 is a reply to message #1434818] |
Wed, 01 October 2014 18:13 |
|
Hi, Walid,
It looked like your constraint was trying to
On 2014-09-30 16:45:03 +0000, Walid Ban said:
> Hi Christian,
> Thank you for reply...
> I have a profile that contains stereotypes which extend the meta-class
> "Lifeline". These stereotypes are "ObjectBase", "ObjectMultiviews",
> "ObjectProviderView" and "ObjectHumanConsumer".
>
> The constraint (which must be created in my profile) tells that :an
> "ObjectMultiviews" Lifeline could only send messages to another
> "ObjectMultiviews" Lifeline or to an "ObjectBase" Lifeline.
>
> So, if for example, an "ObjectMultiviews" Lifeline sends a message to
> an "ObjectProviderView" Lifeline, an errors must be occured when I
> validate a model (on which my profile is applied).
> Any solution please?
> Thank you for your collaboration...
> Regards
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05240 seconds