Software Disclaimer

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).

Direct Superclasses: Element

Direct Subclasses: Vertex, TypedElement, Trigger, RedefinableElement, ParameterSet, PackageableElement, Namespace, MessageEnd, Message, Lifeline, InteractionFragment, Include, GeneralOrdering, Extend, DeploymentTarget, DeployedArtifact, CollaborationUse, ActivityGroup

Class Precedence List: NamedElement, Element

Properties:

clientDependency : Dependency (0 *); -- source NamedElement
name : String (0 1); -- source NamedElement
nameExpression : StringExpression (0 1); -- source NamedElement
namespace : Namespace (0 1); -- source NamedElement
qualifiedName : String (0 1); -- source NamedElement
visibility : VisibilityKind (0 1); -- source NamedElement
ownedComment : Comment (0 *); -- source Element
ownedElement : Element (0 *); -- source Element
owner : Element (0 1); -- source Element

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-public
Expression: visibility = VisibilityKind::public

Signature: CMOF_14_3_6() : Boolean;
Description: 14.3 [6] Names are required for all NamedElements except for ValueSpecifications. see also: https://sites.google.com/site/metamodelingantipatterns/catalog/mof/named-element-has-no-name
Expression: not oclIsKindOf(ValueSpecification) implies (name <> null and name->notEmpty())

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: true
Original: 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: true
Original: (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.1
Expression: 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{} endif
Original: 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: allOwningPackages() : Package;
Description: The query allOwningPackages() returns all the directly or indirectly owning packages.
The OCL used here is not normative.
Editor's notes: Needs examination.
Expression: Set{}
Original: result = self.namespace->select(p | p.oclIsKindOf(Package))->union(p.allOwningPackages())

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



Send questions or comments to [email protected].