Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » OCL Constraints on Profile
OCL Constraints on Profile [message #1123850] Thu, 03 October 2013 00:47 Go to next message
Eclipse Modeling is currently offline Eclipse ModelingFriend
Messages: 2
Registered: October 2013
Junior Member
Hi,

I have recently be working on developing a UML profile for a research project using Eclipse Kepler and Papyrus 0.10.0.v201306121352. I have updated the OCL SDK editor V4.1.1.

I have 3 main profiles (2 in one papyrus model and 1 another) and they have several nested profiles. So lets say the top level profiles are A, B, C. In profile C, I have defined several stereotypes that extend the UML associations and in here I would like to constraint them on what stereotypes are acceptable on the ends of the association profile. So I what I do:

1. I first drag and drop the constraint from the palette into the profile.
2. Set the context to the profile association (say C::a1)
3. write the following OCL in the OCL editor (right click on the constrain):
self.associationEnd->at(0).oclisTypeOf(A::A1::A2::p1) {nested profiles}

But the editor would not parse the OCL. As you can see from the attached screen shot, the editor doesnt recognize the OCL .

Please let me know where I am making mistake.

  • Attachment: ocl.png
    (Size: 65.51KB, Downloaded 149 times)
Re: OCL Constraints on Profile [message #1123927 is a reply to message #1123850] Thu, 03 October 2013 02:50 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Try hovering on the marker or squiggle to see what your error is.

Regards

Ed Willink

On 02/10/2013 22:41, Eclipse Modeling wrote:
> Hi,
>
> I have recently be working on developing a UML profile for a research project using Eclipse Kepler and Papyrus 0.10.0.v201306121352. I have updated the OCL SDK editor V4.1.1.
>
> I have 3 main profiles (2 in one papyrus model and 1 another) and they have several nested profiles. So lets say the top level profiles are A, B, C. In profile C, I have defined several stereotypes that extend the UML associations and in here I would like to constraint them on what stereotypes are acceptable on the ends of the association profile. So I what I do:
>
> 1. I first drag and drop the constraint from the palette into the profile.
> 2. Set the context to the profile association (say C::a1)
> 3. write the following OCL in the OCL editor (right click on the constrain):
> self.associationEnd->at(0).oclisTypeOf(A::A1::A2::p1) {nested profiles}
>
> But the editor would not parse the OCL. As you can see from the attached screen shot, the editor doesnt recognize the OCL .
>
> Please let me know where I am making mistake.
>
>
Re: OCL Constraints on Profile [message #1123967 is a reply to message #1123927] Thu, 03 October 2013 03:57 Go to previous messageGo to next message
Eclipse Modeling is currently offline Eclipse ModelingFriend
Messages: 2
Registered: October 2013
Junior Member
Hi,

Thank you for the quick reply. I was able to solve it by studying a tutorial in developing Geoprofile using Papyrus 7 Eclipse ( could not paste the link). I found it after posting this message.

Now, the constraints (on associated_with) look like

self.base_Association.memberEnd ->at(0).oclIsTypeOf(Behavior::Behavior)
and
self.base_Association.memberEnd->at(1).oclIsTypeOf(Entity::Entity)

But, however, when I try to apply the profile onto a model and validate the model based on these profile constraints I dont see any validation messages or errors. For example, as I have attached, I have two classes assigned two different profile stereotypes and have association and assigned associated_with stereotype association. When I validate the model, I dont see any errors. Is there something I need to change to make sure the validation takes into consideration the profile constraints also.
  • Attachment: ocl.png
    (Size: 30.15KB, Downloaded 159 times)
Re: OCL Constraints on Profile [message #1124296 is a reply to message #1123967] Thu, 03 October 2013 11:43 Go to previous messageGo to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 165
Registered: July 2009
Senior Member
Eclipse Modeling wrote on Wed, 02 October 2013 23:57
Hi,

But, however, when I try to apply the profile onto a model and validate the model based on these profile constraints I dont see any validation messages or errors. For example, as I have attached, I have two classes assigned two different profile stereotypes and have association and assigned associated_with stereotype association. When I validate the model, I dont see any errors. Is there something I need to change to make sure the validation takes into consideration the profile constraints also.


Did you select the option to include the constraints into the profile when saving?
See <https://bugs.eclipse.org/bugs/show_bug.cgi?id=411256>
Re: OCL Constraints on Profile [message #1124297 is a reply to message #1123967] Thu, 03 October 2013 11:44 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You are obviously not validating since "->at(0)" will always give
invalid when executed.

I have no idea why Behavior::Behavior is not an error.

*.png attachments are almost always useless.

If you want someone to look at your code, you need to provide a small
zipped project with clear repro instructions.

Regards

Ed Willink

On 02/10/2013 23:57, Eclipse Modeling wrote:
> Hi,
>
> Thank you for the quick reply. I was able to solve it by studying a tutorial in developing Geoprofile using Papyrus 7 Eclipse ( could not paste the link). I found it after posting this message.
>
> Now, the constraints (on associated_with) look like
>
> self.base_Association.memberEnd ->at(0).oclIsTypeOf(Behavior::Behavior)
> and
> self.base_Association.memberEnd->at(1).oclIsTypeOf(Entity::Entity)
>
> But, however, when I try to apply the profile onto a model and validate the model based on these profile constraints I dont see any validation messages or errors. For example, as I have attached, I have two classes assigned two different profile stereotypes and have association and assigned associated_with stereotype association. When I validate the model, I dont see any errors. Is there something I need to change to make sure the validation takes into consideration the profile constraints also.
Previous Topic:Simple OCL question
Next Topic:Creating class diagram based on java code
Goto Forum:
  


Current Time: Fri Apr 26 00:21:05 GMT 2024

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

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

Back to the top