Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » OCL constraints on stereotypes
OCL constraints on stereotypes [message #1046896] Mon, 22 April 2013 14:08 Go to next message
Vincent Verdier is currently offline Vincent VerdierFriend
Messages: 12
Registered: April 2013
Junior Member
Hi everyone,

I'm using Papyrus on Eclipse Juno and I have definied an OCL constraint on a stereoptype. Unfortunately, Papyrus doesn't seem to check this kind of constraints. I also tried on Eclipse Kelpler.

What can I do in order to check the OCL constraints that I have defined in a profile ?

Any help would be much appreciate.
Thanks.
Re: OCL constraints on stereotypes [message #1046925 is a reply to message #1046896] Mon, 22 April 2013 14:53 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Vincent,

It's currently work in progress in Kepler. Most of the features should work on the latest nightly builds (Define constraints in the profile, validate models on which the profile is applied). You need the latest Papyrus and OCL builds.

Regards,
Camille


Camille Letavernier
Re: OCL constraints on stereotypes [message #1046949 is a reply to message #1046925] Mon, 22 April 2013 15:33 Go to previous messageGo to next message
Vincent Verdier is currently offline Vincent VerdierFriend
Messages: 12
Registered: April 2013
Junior Member
Thanks for your answer.

So I downloaded the latest nightybuild of Papyrus from :
http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/kepler

Then I have tried to validate a very simple test. I got this exception :

Error	An exception occurred while delegating evaluation of the 'Constraint1' invariant on 'Test 0 -> <<test>> <Class> Class1': null	Test 0 -> <<test>> <Class> Class1	null	EMF Problem


Did I do something wrong or is this due to the nightybuild ?
Re: OCL constraints on stereotypes [message #1046982 is a reply to message #1046949] Mon, 22 April 2013 16:30 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi,

Do you have a more precise message? e.g. the message from the root exception? (An OCL exception, probably)

What did you write on your OCL constraint?


Camille


Camille Letavernier
Re: OCL constraints on stereotypes [message #1047027 is a reply to message #1046949] Mon, 22 April 2013 17:37 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Camille wrote to use the latest OCL and Papyrus. Your message suggests
that you used only Papyrus nightly.

You should also use the latest Xtext ... all of which are available from
http://download.eclipse.org/releases/staging.

Regards

Ed Willink



On 22/04/2013 16:33, Vincent Verdier wrote:
> Thanks for your answer.
>
> So I downloaded the latest nightybuild of Papyrus from :
> http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/kepler
>
> Then I have tried to validate a very simple test. I got this exception :
>
> Error An exception occurred while delegating evaluation of the
> 'Constraint1' invariant on 'Test 0 -> <<test>> <Class> Class1':
> null Test 0 -> <<test>> <Class> Class1 null EMF Problem
>
>
> Did I do something wrong or is this due to the nightybuild ?
Re: OCL constraints on stereotypes [message #1047437 is a reply to message #1046896] Tue, 23 April 2013 07:48 Go to previous messageGo to next message
Vincent Verdier is currently offline Vincent VerdierFriend
Messages: 12
Registered: April 2013
Junior Member
The problem is resolved. You were right, I forgot to update OCL to the latest nightlybuild...
Thank you both of you.
Re: OCL constraints on stereotypes [message #1047725 is a reply to message #1046982] Tue, 23 April 2013 15:09 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi,
I installed Papyrus latest nightly build (0.10.0.v201304222226) and OCL last nightly build (4.1.0.v20130423-0101) and Xtext SDK (2.4.1.v201304180855).
I added the following constraint attached to the stereotype "Provider" that extend "Actor" (it means that the context is Provider):

self.base_Actor.getAssociations()-> forAll (a | a.memberEnd->exists (r|r.type.oclIsKindOf (ServiceInteraction)) and
a.memberEnd ->exists (r|r.type.oclIsKindOf (ServicePublication)) and
a.memberEnd->exists (r|r.type.oclIsKindOf (ServiceSearch)))

Note that "ServiceInteraction","ServicePublication" and "ServiceSearch" are stereotypes that extend "Use Case"


It doesn't contain errors. I tried to verify the constraint, i made an assocaition between an Actor stereotyped "Provider" and a Use Case stereotyped "ServiceComposition".But when i validate the model that apply my profile (open *.uml-->right click on the model-->validate), the validation is successful!
I'm confused between 2 things:
- The constraint is badly described and so it doesn't work or
- Something wrong with the validation Task in Papyrus.

Could you help me please..Thank you
Regards


Re: OCL constraints on stereotypes [message #1047741 is a reply to message #1047725] Tue, 23 April 2013 15:34 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
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 #1047823 is a reply to message #1047741] Tue, 23 April 2013 17:51 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Thank you a lot Camille...really!
It worked!
Best regards
Re: OCL constraints on stereotypes [message #1433994 is a reply to message #1047823] Mon, 29 September 2014 14:20 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi
I put an OCL constraint in my profile which is related to the stereotype"ObjectMultiviews" (that extends Lifeline Class).
I want that the Lifeline stereotyped "ObjectMultiviews" could send messages only for Lifelines stereotyped "ObjectBase" and "ObjectMultiviews".
Unfortunately, many errors in my constraint that I couldn't understand Sad
Here's the constraint:
self.getConnectorEnds()-> forAll (o | o.connectorEnd->Exists(r|not r.element.getAppliedStereotype('AWSProfile::ObjectBase').oclIsUndefined()) and o.connectorEnd->exists(r|not r.element.getAppliedStereotype('AWSProfile::ObjectMultiviews').oclIsUndefined()))

Please Help me...what's wrong in it?
Thank you
Regards
Re: OCL constraints on stereotypes [message #1434030 is a reply to message #1433994] Mon, 29 September 2014 15:12 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi,

If the context of the constraint is the stereotype "ObjectMultiviews", then the constraint should start with:

self.base_Lifeline.getConnectorEnds() (Or probably, self.base_Lifeline.connectorEnds)

"self" refers to the stereotype application (ObjectMultiview); not the stereotyped element (Lifeline)

Regards,
Camille


Camille Letavernier
Re: OCL constraints on stereotypes [message #1434060 is a reply to message #1434030] Mon, 29 September 2014 15:55 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Thank you Camille..
But unfortunately, nothing changed..
I don't know if the operation getConnectorEnds() and the property connectorEnd work with Lifelines and messages (Sequence diagram).

self.base_Lifeline.getConnectorEnds()-> forAll (o | o.connectorEnd->exists (r|not r.element.getAppliedStereotype('AWSProfile::ObjectBase').oclIsUndefined() )and
o.connectorEnd ->exists (r|not r.element.getAppliedStereotype('AWSProfile::ObjectMultiviews').oclIsUndefined()))

I saw in a paper "self.send.sendMessageEnd", but I don't know if it's the correct syntax or not.
  • Attachment: 2.png
    (Size: 6.56KB, Downloaded 205 times)
  • Attachment: 1.png
    (Size: 19.92KB, Downloaded 162 times)
Re: OCL constraints on stereotypes [message #1434577 is a reply to message #1434060] Tue, 30 September 2014 09:25 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
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 Sad
Could you help me please...
Regards
  • Attachment: error1.png
    (Size: 71.68KB, Downloaded 200 times)
  • Attachment: error2.png
    (Size: 80.98KB, Downloaded 160 times)
Re: OCL constraints on stereotypes [message #1434804 is a reply to message #1434577] Tue, 30 September 2014 16:19 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

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 #1434818 is a reply to message #1434804] Tue, 30 September 2014 16:45 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
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
Re: OCL constraints on stereotypes [message #1435583 is a reply to message #1434818] Wed, 01 October 2014 18:13 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

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
Re: OCL constraints on stereotypes [message #1435614 is a reply to message #1435583] Wed, 01 October 2014 19:03 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi
All right, thank you Christian
Well, the parser didn't accept "extension_ObjectBase" and "extension_ObjectMultiviews" ! (Unresolved Property 'UML::Association::extension_ObjectBase')

I think because the stereotype "ObjectBase" extends Lifeline Meta-Class not Association Meta-Class. (I hope that you understand what I mean)
Any suggestion??
Regards


  • Attachment: error.png
    (Size: 99.30KB, Downloaded 152 times)
  • Attachment: workspace_Luna.rar
    (Size: 5.60MB, Downloaded 144 times)
  • Attachment: error2.png
    (Size: 78.34KB, Downloaded 152 times)
Re: OCL constraints on stereotypes [message #1436796 is a reply to message #1435583] Fri, 03 October 2014 12:21 Go to previous message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi again,
This constraint is always violated Confused
self.base_Lifeline.represents->exists(r| r.getAppliedStereotype('AWSProfile::ObjectMutiviews')<>null xor
r.getAppliedStereotype('AWSProfile::ObjectBase')<>null )

(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, the constraint must be violated when I validate the model .
Any suggestion please?


Previous Topic:Requirement table (and others), Rationale column appears truncated
Next Topic:Project explorer frame
Goto Forum:
  


Current Time: Fri Mar 29 01:31:49 GMT 2024

Powered by FUDForum. Page generated in 0.04637 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top