Skip to main content


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 20:49 Go to next message
Jeni Martin is currently offline Jeni MartinFriend
Messages: 42
Registered: November 2012
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 21:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
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 21:32 Go to previous messageGo to next message
Jeni Martin is currently offline Jeni MartinFriend
Messages: 42
Registered: November 2012
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 22:12 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
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 21:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
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 352 times)
Re: Writing ocl for Metaclass association [message #1430776 is a reply to message #1006337] Wed, 24 September 2014 20:10 Go to previous messageGo to next message
Mahin Abbasipour is currently offline Mahin AbbasipourFriend
Messages: 24
Registered: June 2013
Junior Member
Dear Ed,

I also have a similar metamodel and want to specify the member ends for an association metaclass. I am using Papyrus to create my profile. I have used these two constraints:
1- self.base_association.memberEnd->exists(getStereotypeApplication(FR) <> null)
in this case, it gives an error for getSetreotypeApplication as an unresolved operation.

2- I also tried the one in the attached file:
self.base_Association.memberEnd.class->exists(extionsion_NFR <> null)
this one does not check when if one of the member ends is not NFR.

I have another question. In the Papyrus, I noticed that there, I can createassociations between the stereotypes. just like the metamodel of UML that between the metaclass Association and metaclass Property there is an association which specify propery as member end.
I was thinking in this case, we may do the similar thing to specify member ends. we can create association between metaclass Association "HasNFR" and metaclass Class "NFR", and also another association between "HasNFR" and "FR".
I am not sure if this is a correct idea. However, In this case, It didn't check the violation too.

Thanks,
Mahin
Re: Writing ocl for Metaclass association [message #1431165 is a reply to message #1430776] Thu, 25 September 2014 09:36 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

See comments and debugged example in

https://bugs.eclipse.org/bugs/show_bug.cgi?id=398333

Regards

Ed Willink




On 24/09/2014 21:10, Mahin Abbasipour wrote:
> Dear Ed,
>
> I also have a similar metamodel and want to specify the member ends for
> an association metaclass. I am using Papyrus to create my profile. I
> have used these two constraints:
> 1- self.base_association.memberEnd->exists(getStereotypeApplication(FR)
> <> null)
> in this case, it gives an error for getSetreotypeApplication as an
> unresolved operation.
>
> 2- I also tried the one in the attached file:
> self.base_Association.memberEnd.class->exists(extionsion_NFR <> null)
> this one does not check when if one of the member ends is not NFR.
>
> I have another question. In the Papyrus, I noticed that there, I can
> createassociations between the stereotypes. just like the metamodel of
> UML that between the metaclass Association and metaclass Property there
> is an association which specify propery as member end. I was thinking in
> this case, we may do the similar thing to specify member ends. we can
> create association between metaclass Association "HasNFR" and metaclass
> Class "NFR", and also another association between "HasNFR" and "FR". I
> am not sure if this is a correct idea. However, In this case, It didn't
> check the violation too.
>
> Thanks,
> Mahin
Previous Topic:OCL closure() ends in OclInvalid
Next Topic:Announcing Eclipse OCL 5.0.2 for Luna
Goto Forum:
  


Current Time: Tue Mar 19 03:42:42 GMT 2024

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

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

Back to the top