Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Writing ocl for Metaclass association
Writing ocl for Metaclass association [message #1001501] Wed, 16 January 2013 15:49 Go to next message
Jeni Martin is currently offline Jeni Martin
Messages: 28
Registered: November 2012
Junior Member
Hi,

I am creating a profile, and my profile has three stereotypes. FR, NFR and Relation. FR and NFR are the extension of metaclass Class and Relation is the extension of metaclass Association. How can i define OCL constraints that says the Relation must be between FR and NFR? (each instance of FR is in relation with 0..* instance(s)of NFR.

Thanks
Re: Writing ocl for Metaclass association [message #1001511 is a reply to message #1001501] Wed, 16 January 2013 16:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
Hi

Seem like you want a Relation constraint that its base Association has
FR applied at one end and NFR applied at the other.

NB. UML requires automated definition of base_Association and
extension_Relation to facilitate stereotype navigation.

You will find that this is ropey at best in the Juno release of the OCL
editors and Papyrus. OCL should be fixed in Kepler M4. Papyrus and OCL
should work together for Kepler.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=398333 raised so that this
is tested for Kepler.

Regards

Ed Willink

On 16/01/2013 20:49, Jeni Martin wrote:
> Hi,
>
> I am creating a profile, and my profile has three stereotypes. FR, NFR
> and Relation. FR and NFR are the extension of metaclass Class and
> Relation is the extension of metaclass Association. How can i define
> OCL constraints that says the Relation must be between FR and NFR?
> (each instance of FR is in relation with 0..* instance(s)of NFR.
>
> Thanks
Re: Writing ocl for Metaclass association [message #1001521 is a reply to message #1001511] Wed, 16 January 2013 16:32 Go to previous messageGo to next message
Jeni Martin is currently offline Jeni Martin
Messages: 28
Registered: November 2012
Junior Member
Thank you so much for reply. But how can I even write the ocl for this specific constraint(it's syntax)?
I know that the baseclass has endtype property., but I don't know how I can write it.
Re: Writing ocl for Metaclass association [message #1001536 is a reply to message #1001521] Wed, 16 January 2013 17:12 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
Hi

Something like

context Relation
inv HasFR:
base_Association.memberEnd->exists(getStereotypeApplication(FR) <> null)
inv HasNFR:
base_Association.memberEnd->exists(getStereotypeApplication(NFR) <> null)

Element.getStereotypeApplication(Stereotype) is part of the MDT/UML2 API.

Regards

Ed Willink

On 16/01/2013 21:32, Jeni Martin wrote:
> Thank you so much for reply. But how can I even write the ocl for this
> specific constraint(it's syntax)? I know that the baseclass has
> endtype property., but I don't know how I can write it.
>
Re: Writing ocl for Metaclass association [message #1006337 is a reply to message #1001536] Wed, 30 January 2013 16:38 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi<br>
<br>
The following should be possible in Kepler M5. It was created using
the latest Papyrus development code using the EssentialOCL editor
integration. The OCL text has therefore been semantically checked
(at M2). Actual functionality at M1 is still work in progress.<br>
<br>
<img src="http://www.eclipse.org/forums/index.php?t=getfile&amp;id=13164" alt=""><br>
<br>
No need to lose type safety with getAppliedStereotypes.<br>
<br>
    Regards<br>
<br>
        Ed Willink<br>
<br>
<br>
<br>
On 16/01/2013 22:12, Ed Willink wrote:
<blockquote cite="mid:kd78la$ji3$1@xxxxxxxxe.org" type="cite">Hi
<br>
<br>
Something like
<br>
<br>
context Relation
<br>
inv HasFR:
base_Association.memberEnd-&gt;exists(getStereotypeApplication(FR)
&lt;&gt; null)
<br>
inv HasNFR:
base_Association.memberEnd-&gt;exists(getStereotypeApplication(NFR)
&lt;&gt; null)
<br>
<br>
Element.getStereotypeApplication(Stereotype) is part of the
MDT/UML2 API.
<br>
<br>
    Regards
<br>
<br>
        Ed Willink
<br>
<br>
On 16/01/2013 21:32, Jeni Martin wrote:
<br>
<blockquote type="cite">Thank you so much for reply. But how can I
even write the ocl for this specific constraint(it's syntax)? I
know that the baseclass has endtype property., but I don't know
how I can write it.
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>
  • Attachment: bhhgdhjd.png
    (Size: 8.70KB, Downloaded 58 times)
Previous Topic:[Announce] Eclipse OCL 4.0.2 (Juno) SR2 RC2 is now available
Next Topic:[Announce] Eclipse OCL 4.1.0 (Kepler) M5 is now available
Goto Forum:
  


Current Time: Fri Aug 29 22:22:34 EDT 2014

Powered by FUDForum. Page generated in 0.02087 seconds