Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Using OCL in Profiles in Papyrus in 10 Steps(Simple guide to creating OCL constraints in Papyrus)
Using OCL in Profiles in Papyrus in 10 Steps [message #1072271] Mon, 22 July 2013 12:34 Go to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
Seeing as it is a little bit tricky to create OCL constraints on profiles in Papyrus, I have prepared a quick howto. The steps are compiled based on bugzilla issues/newsgroup messages and testing I have done.

1. Use at least Papyrus 0.10.0v201306121352 on Kepler 4.3.0
2. Create a Profile with a diagram
3. Create a Stereotype
4. Drag a UML MetaModel element from the UML 2.4.1 Metamodel <Package Import> and place on diagram
5. Draw and connect a "UML Extension" between your stereotype and the element selected in #4
6. Create a new constraint by dropping a "UML Constraint" on your diagarm. Ignore the ititial editor that pops up. It is no use as you must select a context first.
7. Select your constraint and then change the "Context" in the Properties editor. Set the context to your stereotype.
8. Now click your UML Constraint on the diagram and the OCL editor should pop up. This time it has a context.
9. Write your OCL constraint using the excellent editor.
10. Save the profile and define. Note: YOU MUST SELECT "Save OCL constraints into the definition". If you don't the OCL will not run. See issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=411256

Regards,
Ronan
Re: Using OCL in Profiles in Papyrus in 10 Steps [message #1072276 is a reply to message #1072271] Mon, 22 July 2013 12:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6798
Registered: July 2009
Senior Member
Hi

If you're using serious OCL constraints in profiles, I strongly
recommend installing the latest OCL I-build; currently

http://www.eclipse.org/modeling/download.php?file=/modeling/mdt/ocl/downloads/drops/4.2.0/I201307170419/mdt-ocl-Update-tools-I201307170419.zip

I've fixed some embarrassing bugs in the Kepler release where
- profile defined operations with OCL bodies fail to execute usefully
- profile defined enumerations fail to participate in evaluations usefully

Regards

Ed Willink

On 22/07/2013 13:34, Ronan B wrote:
> Hi,
> Seeing as it is a little bit tricky to create OCL constraints on
> profiles in Papyrus, I have prepared a quick howto. The steps are
> compiled based on bugzilla issues/newsgroup messages and testing I
> have done.
>
> 1. Use at least Papyrus 0.10.0v201306121352 on Kepler 4.3.0
> 2. Create a Profile with a diagram
> 3. Create a Stereotype
> 4. Drag a UML MetaModel element from the UML 2.4.1 Metamodel <Package
> Import> and place on diagram
> 5. Draw and connect a "UML Extension" between your stereotype and the
> element selected in #4
> 6. Create a new constraint by dropping a "UML Constraint" on your
> diagarm. Ignore the ititial editor that pops up. It is no use as you
> must select a context first.
> 7. Select your constraint and then change the "Context" in the
> Properties editor. Set the context to your stereotype.
> 8. Now click your UML Constraint on the diagram and the OCL editor
> should pop up. This time it has a context.
> 9. Write your OCL constraint using the excellent editor.
> 10. Save the profile and define. Note: YOU MUST SELECT "Save OCL
> constraints into the definition". If you don't the OCL will not run.
> See issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=411256
>
> Regards,
> Ronan
Re: Using OCL in Profiles in Papyrus in 10 Steps [message #1072343 is a reply to message #1072276] Mon, 22 July 2013 15:03 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 926
Registered: February 2011
Senior Member
A few other notes:

- In the OCL preferences, set the executor to Pivot (Instead of the default LPG). Go to Window > Preferences > OCL > Change the value of "Executor targeted by the default OCL delegate"

This will fix some validation issues; see Bug 411603: [Evaluation exceptions] For specific constructs such as Let... In

It has been reported as an OCL bug, but it will most likely need to be fixed in Papyrus.

- For 4), you can also use the "Import Metaclass" tool from the palette
- For 7), to set the context of your constraint, you can also use the "Context link" tool from the palette.


Regards,
Camille


Camille Letavernier
Previous Topic:requirements diagram problems in papyrus
Next Topic:I cannot install Papyrus Extra Feature in Kepler
Goto Forum:
  


Current Time: Thu Aug 13 17:41:47 GMT 2020

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

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

Back to the top