Issue 19349: NamedElement::allNamespaces is invalida at model root (uml2-rtf) Source: Model Driven Solutions (Dr. Edward Willink, ed(at)willink.me.uk) Nature: Clarification Severity: Significant Summary: The specified OCL body for NamedElement::allNamespaces has its tests in the wrong order and consequently fails at the root since in: if owner.oclIsKindOf(TemplateParameter) and owner.oclAsType(TemplateParameter).signature.template.oclIsKindOf(Namespace) then ... else if namespace->isEmpty() then ... At the root owner is null and the navigation results in invalid for both arms of the conjunction and consequently the if condition and if result. Suggest the more readable, less redundant and more correct: if owner = null then OrderedSet{} else let enclosingNamespace : Namespace = if owner.oclIsKindOf(TemplateParameter) and owner.oclAsType(TemplateParameter).signature.template.oclIsKindOf(Namespace) then owner.oclAsType(TemplateParameter).signature.template.oclAsType(Namespace) else namespace endif in enclosingNamespace.allNamespaces()->prepend(enclosingNamespace) endif Resolution: Revised Text: Actions taken: April 20, 2014: received issue Discussion: End of Annotations:===== m: webmaster@omg.org Date: 20 Apr 2014 12:56:58 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Ed Willink Employer: mailFrom: ed@willink.me.uk Terms_Agreement: Specification: UML Section: 9.9 FormalNumber: 2.5 Version: 2.5 Doc_Year: Year Doc_Month: Month Doc_Day: Day Page: 43 Title: NamedElement::allNamespaces is invalida at model root Nature: Clarification Severity: Significant CODE: 3TMw8 B1: Report Issue Remote Name: edwillink.plus.com Remote User: HTTP User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0 Time: 12:56 PM Description: The specified OCL body for NamedElement::allNamespaces has its tests in the wrong order and consequently fails at the root since in: if owner.oclIsKindOf(TemplateParameter) and owner.oclAsType(TemplateParameter).signature.template.oclIsKindOf(Namespace) then ... else if namespace->isEmpty() then ... At the root owner is null and the navigation results in invalid for both arms of the conjunction and consequently the if condition and if result. Suggest the more readable, less redundant and more correct: if owner = null then OrderedSet{} else let enclosingNamespace : Namespace = if owner.oclIsKindOf(TemplateParameter) and owner.oclAsType(TemplateParameter).signature.template.oclIsKindOf(Namespace) then owner.oclAsType(TemplateParameter).signature.template.oclAsType(Namespace) else namespace endif in enclosingNamespace.allNamespaces()->prepend(enclosingNamespace) endif