Skip to main content



      Home
Home » Modeling » OCL » Attribute with derived value(Calculate value of derived attribute )
Attribute with derived value [message #690867] Thu, 30 June 2011 06:49 Go to next message
Eclipse UserFriend
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 09:15 Go to previous messageGo to next message
Eclipse UserFriend
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 09:15 Go to previous messageGo to next message
Eclipse UserFriend
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 05:41 Go to previous message
Eclipse UserFriend

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: Mon Jul 07 01:22:19 EDT 2025

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

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

Back to the top