Using Derived Layer (OCL Expression)

This tutorial show how to use a Derived Layer.

A derived layer is a leaf Layer where the views are automatically attached to the layer, according to an expression. Actually, the expression is expressed in OCL.

Tutorial Video

A tutorial is available here: http://youtu.be/x6lnWwD47ZI

Creating a derived Layer

Derived Layer are actually called 'RegExp Layer'.

To create a derived layer:

The new Layer appears under the Layer Stack. You can add Properties to the layer.

Writing an expression

A derived layer is a Layer where views are automatically attached to the layer. The expression is used for this purpose.

Actually, the expression can only be written in OCL.

The expression is a boolean expression returning true or false. The expression is applied on each view (ie Shapes and Links) in the diagram. If the expression return true, the corresponding element is attached to the layer. If the expression return false, the element is not attached to the layer.

The OCL expression has a predefined variable called 'self'. It is the 'view' that must be checked. This variable is of type notation::View . It can be subclassed in notation::Shape and notation::Link .

A view in a uml diagram is always associated to a UML element. This element can be accessed with the expression self.element .

The expression is written in the Layer property->Expr

Expressions Examples

All Shapes

All Classes/Interface/ ...

All Classes/NamedElement/... starting with a particular string

and / or

All classes that are abstract

All classes containing an operation named 'op1'

Also: