Abstract Class UML 2.3::NamedElement

Description:

A named element supports using a string expression to specify its name.
This allows names of model elements to involve template parameters. The
actual name is evaluated from the string expression only when it is sensible
to do so (e.g., when a template is bound).

Constraints:

Signature: CMOF_14_3_7a() : Boolean;Description: 14.3 [7] CMOF does not support visibilities. All property visibilities must be explicitly set to
public where applicable, that is for all NamedElements, ElementImports and PackageImports.
Furthermore, no alias is allowed for any ElementImport.
see also: https://sites.google.com/site/metamodelingantipatterns/catalog/mof/named-element-is-not-publicExpression: visibility = VisibilityKind::public

Signature: visibility_needs_ownership() : Boolean;Description: If a NamedElement is not owned by a Namespace, it does not have a visibility.The OCL used here is not normative.Editor's notes: visibility has default value #public, making this fail whenever namespace is
not specified.Expression: trueOriginal: namespace->isEmpty() implies visibility->isEmpty()

Signature: has_qualified_name() : Boolean;Description: When there is a name, and all of the containing namespaces have a name,
the qualified name is constructed from the names of the containing namespaces.The OCL used here is not normative.Editor's notes: qualifiedName is a derived attribute where the derivation is the same as this (and both wrong).Expression: trueOriginal: (self.name->notEmpty() and
self.allNamespaces()->select(ns | ns.name->isEmpty())->isEmpty()) implies
self.qualifiedName = self.allNamespaces()->iterate( ns : Namespace;
result: String = self.name | ns.name->union(self.separator())->union(result))

Signature: has_no_qualified_name() : Boolean;Description: If there is no name, or one of the containing namespaces has no name, there
is no qualified name.Expression: (self.name->isEmpty() or self.allNamespaces()->select(ns | ns.name->isEmpty())->notEmpty())
implies self.qualifiedName->isEmpty()

Operations:

Signature: separator() : String;Description: The query separator() gives the string that is used to separate names when constructing a qualified name.Expression: result = '::'

Signature: qualifiedName.1() : String;Description: When there is a name, and all of the containing namespaces have a name,
the qualified name is constructed from the names of the containing namespaces.The OCL used here is not normative.Editor's notes: Use OCL concat not union. Carried over from UML 2.1.1Expression: result = if self.name->notEmpty() and
self.allNamespaces()->select(ns | ns.name->isEmpty())->isEmpty()
then
self.allNamespaces()->iterate( ns : Namespace;
result : String = self.name | ns.name.concat(self.separator()).concat(result))
else
Set{}
endifOriginal: result = if self.name->notEmpty() and
self.allNamespaces()->select(ns | ns.name->isEmpty())->isEmpty()
then
self.allNamespaces()->iterate( ns : Namespace;
result : String = self.name | ns.name->union(self.separator())->union(result))
else
Set{}
endif

Signature: isDistinguishableFrom(n : NamedElement; ns : Namespace; ) : Boolean;Description: The query isDistinguishableFrom() determines whether two NamedElements may logically co-exist within a Namespace. By default, two named elements are distinguishable if (a) they have unrelated types or (b) they have related types but different names.Expression: result = if self.oclIsKindOf(n.oclType()) or n.oclIsKindOf(self.oclType())
then ns.getNamesOfMember(self)->intersection(ns.getNamesOfMember(n))->isEmpty()
else true
endif

Signature: allNamespaces() : Namespace;Description: The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards.Expression: result = if self.namespace->isEmpty()
then Sequence{}
else self.namespace.allNamespaces()->prepend(self.namespace)
endif