Namespace

Namespace is defined in KerML specification on page 47. Excerpt from the machine readable specification:

A Namespace is an Element that contains other Elements, known as its members, via Membership Relationships with those Elements. The members of a Namespace may be owned by the Namespace, aliased in the Namespace, or imported into the Namespace via Import Relationships.

A Namespace can provide names for its members via the memberNames and memberShortNames specified by the Memberships in the Namespace. If a Membership specifies a memberName and/or memberShortName, then those are names of the corresponding memberElement relative to the Namespace. For an OwningMembership, the owningMemberName and owningMemberShortName are given by the Element name and shortName. Note that the same Element may be the memberElement of multiple Memberships in a Namespace (though it may be owned at most once), each of which may define a separate alias for the Element relative to the Namespace.

The following diagram shows the inheritance hierarchy of Namespace according to the specification:

// Class: Namespace
 digraph {
     Namespace [label="Namespace (KerML)" shape=plaintext]
     Element -> Namespace
     Element [label="Element (KerML)" shape=plaintext]
 }

The following table shows all attributes defined for Namespace according to the specification together with the documentation from the machine readable specification. Note that in SysIDE API, we use snake case for attribute names instead of Pascal case used in the specification.

Attribute

Documentation from machine readable specification

Attributes defined in Namespace:

members

The set of all member Elements of this Namespace, which are the memberElements of all memberships of the Namespace.

memberships

All Memberships in this Namespace, including (at least) the union of ownedMemberships and importedMemberships.

owned_imports

The ownedRelationships of this Namespace that are Imports, for which the Namespace is the importOwningNamespace.

owned_members

The owned members of this Namespace, which are the ownedMemberElements of the ownedMemberships of the Namespace.

owned_memberships

The ownedRelationships of this Namespace that are Memberships, for which the Namespace is the membershipOwningNamespace.

Attributes defined in Element:

declared_name

The declared name of this Element.

declared_short_name

An optional alternative name for the Element that is intended to be shorter or in some way more succinct than its primary name. It may act as a modeler-specified identifier for the Element, though it is then the responsibility of the modeler to maintain the uniqueness of this identifier within a model or relative to some other context.

documentation

The Documentation owned by this Element.

element_id

The globally unique identifier for this Element. This is intended to be set by tooling, and it must not change during the lifetime of the Element.

is_implied_included

Whether all necessary implied Relationships have been included in the ownedRelationships of this Element. This property may be true, even if there are not actually any ownedRelationships with isImplied = true, meaning that no such Relationships are actually implied for this Element. However, if it is false, then ownedRelationships may not contain any implied Relationships. That is, either all required implied Relationships must be included, or none of them.

is_library_element

Whether this Element is contained in the ownership tree of a library model.

name

The name to be used for this Element during name resolution within its owningNamespace. This is derived using the effectiveName() operation. By default, it is the same as the declaredName, but this is overridden for certain kinds of Elements to compute a name even when the declaredName is null.

owned_annotations

The ownedRelationships of this Element that are Annotations, for which this Element is the annotatedElement.

owned_elements

The Elements owned by this Element, derived as the ownedRelatedElements of the ownedRelationships of this Element.

owned_relationships

The Relationships for which this Element is the owningRelatedElement.

owner

The owner of this Element, derived as the owningRelatedElement of the owningRelationship of this Element, if any.

owning_membership

The owningRelationship of this Element, if that Relationship is a Membership.

owning_namespace

The Namespace that owns this Element, which is the membershipOwningNamespace of the owningMembership of this Element, if any.

owning_relationship

The Relationship for which this Element is an ownedRelatedElement, if any.

qualified_name

The full ownership-qualified name of this Element, represented in a form that is valid according to the KerML textual concrete syntax for qualified names (including use of unrestricted name notation and escaped characters, as necessary). The qualifiedName is null if this Element has no owningNamespace or if there is not a complete ownership chain of named Namespaces from a root Namespace to this Element.

short_name

The short name to be used for this Element during name resolution within its owningNamespace. This is derived using the effectiveShortName() operation. By default, it is the same as the declaredShortName, but this is overridden for certain kinds of Elements to compute a shortName even when the declaredName is null.

textual_representations

The TextualRepresentations that annotate this Element.

The following table lists SysIDE specific attributes available for class Namespace:

class Namespace
__cpp_name__: str = 'syside::sysml::Namespace'
STD: tuple[type[syside.Namespace], ...] = ()
property prefixes: syside.NamespacePrefixes
property children: syside.NamespaceBody
property owned_memberships: syside.LazyIterator[syside.Membership]
property owned_members: syside.LazyIterator[syside.Element]
property memberships: syside.LazyIterator[syside.Membership]
property members: syside.LazyIterator[syside.Element]
property owned_imports: syside.LazyIterator[syside.Import]
__getitem__(arg: str, /) syside.Element
get_membership(arg: str, /) syside.Membership | None
get_membership(arg0: str, arg1: syside.Membership, /) syside.Membership
get_member(arg: str, /) syside.Element | None
get_member(arg0: str, arg1: syside.Element, /) syside.Element
__str__() str
property element_id: uuid.UUID
property sema_state: syside.SemaState
property declared_name: str | None
property declared_short_name: str | None
property name: str | None
property short_name: str | None
property qualified_name: syside.QualifiedName | None
matches_qualified_name(arg: Sequence[str], /) bool
property is_implied_included: bool
property is_library_element: bool
property owning_membership: syside.OwningMembership | None
property owned_relationships: syside.LazyIterator[syside.Relationship]
property owning_relationship: syside.Relationship | None
property owning_namespace: syside.Namespace | None
property owner: syside.Element | None
property scoped_owner: syside.Element | None
property owned_elements: syside.LazyIterator[syside.Element]
property documentation: syside.LazyIterator[syside.Documentation]
property owned_annotations: syside.LazyIterator[syside.Annotation]
property comments: syside.LazyIterator[syside.Comment]
property textual_representations: syside.LazyIterator[syside.TextualRepresentation]
property metadata: syside.LazyIterator[syside.MetadataFeature | syside.MetadataUsage]
__hash__() int
isinstance(type: syside.AstNode.isinstance.type[syside.TNode]) TypeGuard[syside.TNode]
isinstance(type: tuple[syside.AstNode.isinstance.type[syside.TNode], ...]) TypeGuard[syside.TNode]
try_cast(*type: type[syside.TNode]) syside.TNode | None
try_cast(type: tuple[syside.AstNode.try_cast.type[syside.TNode], ...]) syside.TNode | None
cast(*type: type[syside.TNode]) syside.TNode
cast(type: tuple[syside.AstNode.cast.type[syside.TNode], ...]) syside.TNode
property parent: syside.Element | None
property document: syside.Document
property cst_node: syside.CstNode | None