Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-papyrus.dev] About OCL for specifying and calculating derivation rules in a UML profile

Hi Sebastien

It certainly should be possible.

(I'm slightly baffled by your example syntax preceding the "derive:"; I would expect to see some kind of context.)

In practice there are rules/invariants and values/initializers.

You could therefore express your requirement as a class invariant that checks that what you want is true. A derived property rule is really just a class invariant where the constrained functionality is all about a single property.

The above is declarative rather than constructive. So potentially better for tooling is a derived initializer that enables the required value to be computed rather than just checked. Unfortunately this enters the area where the OCL specification is too vague and the UML specification is missing. My suggestions that the Property default value can also be a derived value _expression_ has not met with a great deal of enthusiasm. I think it is what the PIvot OCL tries to do. I'm not sure how friendly the Papyrus UI is. I doubt that another UML implementation would support it.

    Regards

        Ed Willink


On 01/12/2017 11:12, GERARD Sebastien wrote:

Hi,

 

Does someone know if it possible to use (as explained here ), OCL in Papyrus profile definition to specify a derivation rule of a derived property of a stereotype ? And in that case, when applyng the profile embedding the OCL rules, will the derived property value calculated automatically ?

 

Here is an example of profile :

 

 

Here is the derivation rule specification for the commonMeaning property:

 

The commonMeaning attribute is a derived property subetting the meanings attribute. The derivation rule shall be the following: the value of the commonMeaning attribute is calculated as being the Definition model element (i.e., owned comments stereotyped with <<Definition>> and annotating the owner element, in that case the Term itself). 

 

And here is an OCL rule, I tried to write to implement the derivation rule of the commonMeaning property:

 

self.commonMeaning: Definition derive:

self.base_Class.ownedComment-> select ( oc | oc.isStereotypeApplied(Definition) and oc.isCommon = true)

 

Thanks for helping,

Best,

Sébastien.

 

 

cid:image001.png@01D1C880.5C951BE0

 

 

Sébastien Gérard

Head of the LISE labs

CEA Research Director

Papyrus project Leader (www.eclipse.org/papyrus)

cid:image002.jpg@01D1C880.5C951BE0

Commissariat à l’énergie atomique et aux énergies alternatives

Institut List | CEA Saclay Nano-INNOV | Bât. 862- PC174

F-91191 Gif-sur-Yvette Cedex

M. +33 6 88 20 00 47

T. +33 1 69 08 58 24

sebastien.gerard@xxxxxx  www-list.cea.fr

 

 

 

icone_youtube

  cid:image004.png@01D1C880.5C951BE0  cid:image005.jpg@01D1C880.5C951BE0   







 

 



_______________________________________________
mdt-papyrus.dev mailing list
mdt-papyrus.dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mdt-papyrus.dev


Virus-free. www.avast.com

Back to the top