Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Attribute with derived value(Calculate value of derived attribute )
Attribute with derived value [message #690867] Thu, 30 June 2011 10:49 Go to next message
emna  is currently offline emna Friend
Messages: 11
Registered: February 2011
Junior Member
Hello,

I have a derived attribute to calculate, the solution that I have found is to add ocl constraint to my model,

The derived value is specified by an EStructuralFeature EAnnotation with:
Source = "http://www.eclipse.org/emf/2002/Ecore/OCL"
Key = "derivation"
Value = ...the OCL expression..

But when on runtime workbench when I validate, the value of attribute wouldn't be calculate,

Is there a way to calculate the value of my derived attribute.
thanks,
regards.
Re: Attribute with derived value [message #690957 is a reply to message #690867] Thu, 30 June 2011 13:15 Go to previous messageGo to next message
Axel Uhl is currently offline Axel UhlFriend
Messages: 41
Registered: July 2009
Member
Hi Emna,

have you added an annotation to the enclosing EPackage that activates the OCL setting delegate? It's explained, e.g., here: http://www.slideshare.net/EdWillink/enriching-withocl (see slide #36). You may also use the OCLInEcore editor to textually edit your Ecore models. In this case, the delegate annotations will, as far as I know, be added automatically for you. Ed may have more details.

Anyway, the annotation source URI to be used on the EPackage is http://www.eclipse.org/emf/2002/Ecore, the key is "invocationDelegates" and the value is "http://www.eclipse.org/emf/2002/Ecore/OCL".

Cheers,
-- Axel
Re: Attribute with derived value [message #690974 is a reply to message #690867] Thu, 30 June 2011 13:15 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Emna

You have only provided one of the declarations required. See
http://wiki.eclipse.org/MDT/OCLinEcore or the Indigo OCL Documentation.

Specifying these annotations by hand is unchecked and very fragile. You
will find it much easier if you use the OCLinEcore editor. The Helios
version provides syntactic OCL validation. The Indigo version provides
semantic validatuion too.

Regards

Ed Willink

On 30/06/2011 12:49, emna wrote:
> Hello,
>
> I have a derived attribute to calculate, the solution that I have
> found is to add ocl constraint to my model,
> The derived value is specified by an EStructuralFeature EAnnotation with:
> Source = "http://www.eclipse.org/emf/2002/Ecore/OCL"
> Key = "derivation"
> Value = ...the OCL expression..
>
> But when on runtime workbench when I validate, the value of attribute
> wouldn't be calculate,
>
> Is there a way to calculate the value of my derived attribute.
> thanks,
> regards.
Re: Attribute with derived value [message #691356 is a reply to message #690957] Fri, 01 July 2011 09:41 Go to previous message
emna  is currently offline emna Friend
Messages: 11
Registered: February 2011
Junior Member

Hello,

Thank you very much Edward Willink and Axel Uhl, now I use Helios version with OCLInEcore editor, the delegate annotations are added automatically, and I have try the word derivation as describe an http://wiki.eclipse.org/MDT/OCLinEcore
The value of my derived attribute is calculated

regards.
Previous Topic: Constraints with eCore and OCL
Next Topic:Create Influence Diagram from OCL Statement
Goto Forum:
  


Current Time: Tue Apr 16 19:08:15 GMT 2024

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

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

Back to the top