Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Need help for OCL Syntax
Need help for OCL Syntax [message #1434118] Mon, 29 September 2014 17:48 Go to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi
I'm using Papyrus 0.10.2 with Eclipse Kepler Release2. I put an OCL constraint in my profile which is attached to the stereotype "ObjectMultiviews" (that extends Lifeline Class). It means that the stereotype "ObjectMultiviews" is the context.
I want that the Lifeline stereotyped "ObjectMultiviews" could send messages only for Lifelines stereotyped "ObjectBase" and "ObjectMultiviews".

Here's the constraint I proposed:
self.base_Lifeline.getConnectorEnds()-> forAll (o | o.ConnectorEnd.Connector->exists (r|not r.type.getAppliedStereotype('AWSProfile::ObjectBase').oclIsUndefined() )and
o.ConnectorEnd.Connector ->exists (r|not r.type.getAppliedStereotype('AWSProfile::ObjectMultiviews').oclIsUndefined()))

The parser tell me that the operation "getConnectorEnds()" is unresolved.
Any ideas? Help me please...
Thank you
Regards
Re: Need help for OCL Syntax [message #1434155 is a reply to message #1434118] Mon, 29 September 2014 19:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I think that most of the EObject use cases are addressed without the
cast. So oclContainer() for eContainer(), oclType() for eClass().
Stereotype navigation now has a type safe syntax.

The Pivot OCL supports OMG OCL not EOCL, so UML::Package is not an
EObject specification wise.

Regards

Ed Willink

On 29/09/2014 19:48, Walid Ban wrote:
> Hi
> I'm using Papyrus 0.10.2 with Eclipse Kepler Release2. I put an OCL
> constraint in my profile which is attached to the stereotype
> "ObjectMultiviews" (that extends Lifeline Class). It means that the
> stereotype "ObjectMultiviews" is the context.
> I want that the Lifeline stereotyped "ObjectMultiviews" could send
> messages only for Lifelines stereotyped "ObjectBase" and
> "ObjectMultiviews".
> Here's the constraint I proposed:
> self.base_Lifeline.getConnectorEnds()-> forAll (o |
> o.ConnectorEnd.Connector->exists (r|not
> r.type.getAppliedStereotype('AWSProfile::ObjectBase').oclIsUndefined()
> )and o.ConnectorEnd.Connector ->exists (r|not
> r.type.getAppliedStereotype('AWSProfile::ObjectMultiviews').oclIsUndefined()))
>
>
> The parser tell me that the operation "getConnectorEnds()" is unresolved.
> Any ideas? Help me please...
> Thank you
> Regards
Re: Need help for OCL Syntax [message #1434156 is a reply to message #1434118] Mon, 29 September 2014 19:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
[Apologies got my Thunderbird to list resends confused.]

Hi

The Luna release of Payrus 1.0.0 with OCL 5.0.1 is the first that
realistically suppports OCL in UML. You should not need to use the
type-unsafe getAppliedStereotype.

getConnectorEnds looks like the newbie mistake of using the Java
navigation API for model navigation.

Something more like:

self.base_Lifeline.connectorEnds->forAll(o |
o.ConnectorEnd.Connector
->exists(type.extension_ObjectBase <> null)
and o.ConnectorEnd.Connector
->exists(type.extension_ObjectMultiviews <> null))

may be better.

Regards

Ed Willink

On 29/09/2014 19:48, Walid Ban wrote:
> Hi
> I'm using Papyrus 0.10.2 with Eclipse Kepler Release2. I put an OCL
> constraint in my profile which is attached to the stereotype
> "ObjectMultiviews" (that extends Lifeline Class). It means that the
> stereotype "ObjectMultiviews" is the context.
> I want that the Lifeline stereotyped "ObjectMultiviews" could send
> messages only for Lifelines stereotyped "ObjectBase" and
> "ObjectMultiviews".
> Here's the constraint I proposed:
> self.base_Lifeline.getConnectorEnds()-> forAll (o |
> o.ConnectorEnd.Connector->exists (r|not
> r.type.getAppliedStereotype('AWSProfile::ObjectBase').oclIsUndefined()
> )and o.ConnectorEnd.Connector ->exists (r|not
> r.type.getAppliedStereotype('AWSProfile::ObjectMultiviews').oclIsUndefined()))
>
>
> The parser tell me that the operation "getConnectorEnds()" is unresolved.
> Any ideas? Help me please...
> Thank you
> Regards
Re: Need help for OCL Syntax [message #1434246 is a reply to message #1434156] Mon, 29 September 2014 21:47 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi
Thank you Ed
Well I used the constraint that you proposed but the parser didn't accept it.
I did another constraint:

self.base_Lifeline.message->forAll(o |
o.messageEnd->exists(r|not r.getAppliedStereotype('ObjectBase').oclIsUndefined())
and o.messageEnd->exists(r|not r.getAppliedStereotype('ObjectMultiviews').oclIsUndefined()))

The parser indicates no errors, but when I validate my model, an error message appears:
"An exception occurred while delegating evaluation of the 'Constraint6' invariant on 'Object Multiviews -> <<ObjectMultiviews>> <Lifeline> ObjectMultiviews1': Unrecognized variable: (message) <<ObjectMultiviews>> <Lifeline> ObjectMultiviews1 model::Interaction1 EMF Problem"

I don't know what is the correct syntax to let the lifeline stereotyped "Multiviews" sends messages only to "ObjectBase" lifeline or another "Multiviews" lifeline.
I need help please...
regards

Re: Need help for OCL Syntax [message #1434450 is a reply to message #1434246] Tue, 30 September 2014 05:20 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I wrote:

"The Luna release of Payrus 1.0.0 with OCL 5.0.1 is the first that
realistically suppports OCL in UML. You should not need to use the
type-unsafe getAppliedStereotype."

and "Something more like:"

Regards

Ed Willink


On 29/09/2014 23:47, Walid Ban wrote:
> Hi
> Thank you Ed
> Well I used the constraint that you proposed but the parser didn't
> accept it.
> I did another constraint:
>
> self.base_Lifeline.message->forAll(o |
> o.messageEnd->exists(r|not
> r.getAppliedStereotype('ObjectBase').oclIsUndefined())
> and o.messageEnd->exists(r|not
> r.getAppliedStereotype('ObjectMultiviews').oclIsUndefined()))
>
> The parser indicates no errors, but when I validate my model, an error
> message appears: "An exception occurred while delegating evaluation of
> the 'Constraint6' invariant on 'Object Multiviews ->
> <<ObjectMultiviews>> <Lifeline> ObjectMultiviews1': Unrecognized
> variable: (message) <<ObjectMultiviews>> <Lifeline>
> ObjectMultiviews1 model::Interaction1 EMF Problem"
>
> I don't know what is the correct syntax to let the lifeline stereotyped
> "Multiviews" sends messages only to "ObjectBase" lifeline or another
> "Multiviews" lifeline.
> I need help please...
> regards
>
Re: Need help for OCL Syntax [message #1434574 is a reply to message #1434450] Tue, 30 September 2014 09:15 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi
I used Papyrus v 1.0.0 20140611 build and OCL Classic SDK: Ecore/UML Parsers,Evaluator,Edit 5.0.2.v20140819-1612.

I put the constraint that you proposed in the OCL editor:

self.base_Lifeline.connectorEnds->forAll(o |
o.ConnectorEnd.Connector
->exists(type.extension_ObjectBase <> null)
and o.ConnectorEnd.Connector
->exists(type.extension_ObjectMultiviews <> null))

But the parser didn't accept it...
I don't know why?
I put some screenshots
Regards
  • Attachment: error1.png
    (Size: 71.68KB, Downloaded 172 times)
  • Attachment: error2.png
    (Size: 80.98KB, Downloaded 212 times)
Re: Need help for OCL Syntax [message #1434841 is a reply to message #1434574] Tue, 30 September 2014 17:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Red squiggles denote errors which need fixing.

o.ConnectorEnd looks smelly but ...

http://wiki.eclipse.org/OCL/ForumNetiquette

Regards

Ed Willink

On 30/09/2014 11:15, Walid Ban wrote:
> Hi
> I used Papyrus v 1.0.0 20140611 build and OCL Classic SDK: Ecore/UML Parsers,Evaluator,Edit 5.0.2.v20140819-1612.
>
> I put the constraint that you proposed in the OCL editor:
>
> self.base_Lifeline.connectorEnds->forAll(o |
> o.ConnectorEnd.Connector
> ->exists(type.extension_ObjectBase <> null)
> and o.ConnectorEnd.Connector
> ->exists(type.extension_ObjectMultiviews <> null))
>
> But the parser didn't accept it...
> I don't know why?
> I put some screenshots
> Regards
>
Re: Need help for OCL Syntax [message #1434853 is a reply to message #1434841] Tue, 30 September 2014 17:54 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi Ed,
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).

I uploaded the plug-in that contains my profile to see clearer. I use Kepler SR2, Papyrus v0.10.2 (note that I work at the same time with Eclipse Luna, Papyrus 1.0.0)
Any solution please?
Thank you
Re: Need help for OCL Syntax [message #1435518 is a reply to message #1434853] Wed, 01 October 2014 16:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your example contains a profile and many GIFs but no model.

What am I expected to do.

See: https://wiki.eclipse.org/OCL/ForumNetiquette

Every time you provide an unclear repro you waste my time and yours.

Regards

Ed Willink

On 30/09/2014 19:54, Walid Ban wrote:
> Hi Ed,
> 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).
>
> I uploaded the plug-in that contains my profile to see clearer. I use Kepler SR2, Papyrus v0.10.2 (note that I work at the same time with Eclipse Luna, Papyrus 1.0.0)
> Any solution please?
> Thank you
>
Re: Need help for OCL Syntax [message #1435628 is a reply to message #1435518] Wed, 01 October 2014 19:28 Go to previous message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
I'm sorry for wasting your time Ed...I didn't mean that..
May be you didn't understand what I want exactely..
I have a profile and I defined constraints in it.
The goal of creating a model and applying the profile on it, is just to check if the constraint defined in the profile works or not.

For the constraint:
self.base_Lifeline.connectorEnds->forAll(o |
o.ConnectorEnd.Connector
->exists(type.extension_ObjectBase <> null)
and o.ConnectorEnd.Connector
->exists(type.extension_ObjectMultiviews <> null))

The parser didn't accept "connectorEnds" (unresolved property UML::Lifeline::connectorEnds)
Also, it didn't accept "extension_ObjectBase" (unresolved property UML::Association::extension_ObjectBase). Well I think because "ObjectBase" is a stereotype that extends Lifeline Meta-class not Association Meta-Class
Any suggestion?
Previous Topic: validating OCL Complete File on models in papyrus
Next Topic:Sorting a sequence of Integers
Goto Forum:
  


Current Time: Fri Apr 19 14:52:57 GMT 2024

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

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

Back to the top