Later versions of the GELLO editor improve the writability of code when getting a casted value from an observation, and also when as part of that process applying an existence test.
Methods like .asCD() replace .value.oclAsType(CD); and .oclIfUndefined() replaces extra lines of code. The .oclIfUndefined() is an example of null coalescing. and is particularly useful when using GELLO within archetypes.
For example this:
Let tumourSite: String= If template.Examples.Tumour_site
.value.oclAsType(CD).oclIsDefined()
then
template.Examples.Tumour_site
.value.oclAsType(CD).displayName.value
else '' endif
can be rewritten as this:
Let tumourSite: String= template.Examples.Tumour_site.asCD().displayName.value.oclIfUndefined('')
Most types have these methods now, ie asBoolean(), asString() ..