Page 1 of 1

How to validate correct specialization from Library Classes

PostPosted: Mon Feb 18, 2019 9:26 am
by axel.scheithauer@oose.de
I created a Library and a Profile. Each Class in my user model, that has my Stereotype applied must also specialize my Library Class. I tried to specify a validation rule with OCL that checks this, but was not able to get it running. Do you have any recommendations? Attached is the example model.

My Validation Constraint:
Code: Select all
self.allParents()->includes(LibraryClass1)


There seem to be many problems:
- allParents() is not supported. I probably can replace this with
Code: Select all
generalization.general->asSet()
and some closure operation.
- LibraryClass1 is not recognized, even though I imported the Library into the validation suite. I had to use the qualified name.
- This compiles
Code: Select all
self.general->includes(Library1::LibraryClass1)
but is always false
- This works
Code: Select all
self.general.name->includes('LibraryClass1')
, but I would consider it a work around.

The next rule that I would like to check is, whether all Specializations of LibraryClass1 have the stereotype applied.