Parsed/Derivation expressions
This page was created by PageReplicator on 2025-09-01. Last edited by PageReplicator on 2025-09-01.
You can derive both attributes and association ends.
When it comes to sub-classes that inherit classes that have anything derived, you may want to override the existing derivations.
You can do this in the Derivation Expressions tool:
<a href="/File:2020-08-25_15h10_03.png" class="image" data-bs-title="File:2020-08-25_15h10_03.png" data-bs-filetimestamp="20200825131128"><img alt="2020-08-25 15h10 03.png" src="/images/a/a1/2020-08-25_15h10_03.png" decoding="async" width="1045" height="488" class="thumbimage" /></a>
<a href="/File:2020-08-25_15h10_03.png" class="internal" title="Enlarge"></a>
Consider this model:
<a href="/File:2020-08-25_15h13_44.png" class="image" data-bs-title="File:2020-08-25_15h13_44.png" data-bs-filetimestamp="20200825131408"><img alt="2020-08-25 15h13 44.png" src="/images/a/a8/2020-08-25_15h13_44.png" decoding="async" width="615" height="524" class="thumbimage" /></a>
<a href="/File:2020-08-25_15h13_44.png" class="internal" title="Enlarge"></a>
The Green-side subclasses 2,3
match the pink-side subclasses 5,6
. It would be good to have a derived association that matches 1
and 4
whatever the subclass is.
- Implement the derived link and set the OCL implementation to Class4.nullvalue - it will not be used if your Class1 is abstract.
- On class3, click on DerivationExpressions - find the Class4Derived expression - replace it with ocl: self.Class5 (valid since Class5 is a Class4)
- On class2, click on DerivationExpressions - find the Class4Derived expression - replace it with ocl: self.Class6 (valid since Class5 is a Class4)
You have now overridden the dummy default implementation ( Class4.nullvalue) to something valid in the context of the subclass.