Previous | UML Classes | Table of Contents | UML Packages | Next |
A named element is an element in a model that may have a name.
•
Element (from Kernel ) on page 63
Description
A named element represents elements that may have a name. The name is used for identification of the named element within
the namespace in which it is defined. A named element also has a qualified name that allows it to be unambiguously identified
within a hierarchy of nested namespaces. NamedElement is an abstract metaclass.
• name: String [0..1] The name of the NamedElement .
• / qualifiedName: String [0..1] A name that allows the NamedElement to be identified within a hierarchy of nested Namespace s. It is constructed from the names of the containing namespaces starting at the root of the hierarchy and ending with the name of the NamedElement itself. This is a derived attribute.
Issue 4448 -Visibility constrains the actionsof methods of the class. Creation and destruction of links should be allowed
by methods that have access to at least one end of the association.
• |
visibility: VisibilityKind [0..1] Determines where the NamedElement appears within different Namespace s within |
||||
the overall model, and its accessibility.. | |||||
Package Dependencies |
Issue 6630 - It does not make sense for the supplier of a dependency to know about its dependencies. Removing supplierDependency
(and its navigability in Figure).
• clientDependency : Dependency [*] Indicates the dependencies that reference the client.
Associations
• / namespace: Namespace [0..1] Specifies the namespace that owns the NamedElement . Subsets Element::owner. This is a derived
union.
Constraints
[1] If there is no name, or one of the containing namespaces has no name, there is no qualified name. (self.name->isEmpty()
or self.allNamespace s()->select(ns | ns.name->isEmpty())->notEmpty()) implies self.qualifiedName->isEmpty()
[2] 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. (self.name->notEmpty() and self.allNamespace s()->select(ns | ns.name->isEmpty())->isEmpty())
implies self.qualifiedName = self.allNamespace s()->iterate( ns : Namespace ; result: String = self.name | ns.name->union(self.separator())->union(result))
[3] If a NamedElement is not owned by a Namespace , it does not have a visibility.
namespace->isEmpty() implies visibility->isEmpty()
Additional Operations
[1] The query allNamespace s() gives the sequence of namespaces in which the NamedElement is nested, working outwards.
NamedElement ::allNamespace s(): Sequence(Namespace );
allNamespace s =if self.namespace->isEmpty()then Sequence{}
else self.namespace.allNamespace s()->prepend(self.namespace)endif
[2] The query isDistinguishableFrom() determines whether two NamedElement s 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.
NamedElement ::isDistinguishableFrom(n:NamedElement , ns: Namespace ): Boolean;
isDistinguishable =if self.oclIsKindOf(n.oclType) or n.oclIsKindOf(self.oclType)then ns.getNamesOfMember(self)->intersection(ns.getNamesOfMember(n))->isEmpty()else true
endif
[3] The query separator() gives the string that is used to separate names when constructing a qualified name.
NamedElement ::separator(): String; separator = ‘::’
Semantics
The name attribute is used for identification of the named element within namespaces where its name is accessible. Note that
the attribute has a multiplicity of [0..1] that provides for the possibility of the absence of a name (which is different
from the empty name).
Issue 4448 - Visibility constrains the actionsof methods of the class. Creation and destruction of links should be allowed
by methods that have access to at least one end of the association.
The visibility attribute provides the means to constrain the usage of a named element, either in namespaces or in access to
the element.It is intended for use in conjunction with import, generalization, and access mechanisms.
Notation
No additional notation