LockedModel

class LockedModel[T]

Description

A SysML v2 model represented using abstract syntax.

Inheritance:

Members defined in LockedModel (14 members)

diagnostics

R

Diagnostics emitted while building this model.

documents

R

Documents as part of this model.

environment

R

The environment this model was built in.

index

R

Index of exported symbols.

lib

R

Standard library cache.

paths

R

Paths extracted from URIs of available documents in this model.

result

R

The model build result.

uris

R

URIs of available documents in this model.

elements

An alias for nodes.

indexed_member

Find an owned member at path defined by segments starting with top-level elements in index. This excludes imported and inherited members.

new_empty_document

Create a new empty document with url in this model.

nodes

Iterate over all nodes of the given kind.

to_environment

Convert this model to Environment for building other dependent models.

unlock

Unlocks the model, freeing it up for others to lock.

Attributes

property diagnostics: syside.Diagnostics

Diagnostics emitted while building this model.

property documents: list[T]

Documents as part of this model.

property environment: syside.Environment

The environment this model was built in.

property index: syside.StaticIndex

Index of exported symbols.

property lib: syside.Stdlib

Standard library cache.

property paths: Iterable[pathlib.Path]

Paths extracted from URIs of available documents in this model.

property result: syside.ExecutionResult | None

The model build result.

property uris: Iterable[syside.Url]

URIs of available documents in this model.

Methods

elements(node_kind: type[syside.TElement], include_subtypes: bool = False) → Iterable[syside.TElement]

An alias for nodes.

indexed_member(*segments: str) → syside.Element

Find an owned member at path defined by segments starting with top-level elements in index. This excludes imported and inherited members.

Note that modifications to top-level elements will not be reflected here.

Raises KeyError if any chain segment is not found.

new_empty_document(url: syside.UrlLike, language: syside.ModelLanguage | None = None, tier: syside.DocumentTier = syside.DocumentTier.Project) → T

Create a new empty document with url in this model.

Language may be explicitly provided with language, otherwise it will be inferred from url. tier may be used to override the created document tier, and defaults to Project. Here, tier primarily controls whether the document is validated or not if it is ever passed through the Pipeline.

Note that elements from new documents will not appear in index.

nodes(node_kind: type[syside.TElement], include_subtypes: bool = False) → Iterable[syside.TElement]

Iterate over all nodes of the given kind.

Parameters:
  • node_kind – What kind of nodes to return.

  • include_subtypes – Whether to consider subtypes.

to_environment() → syside.Environment

Convert this model to Environment for building other dependent models.

Using environment to build models requires that documents in it are not modified while build is in progress as no explicit dependency locking is performed otherwise.

Documents in the returned environment are guaranteed to be after documents in this model.

unlock() → T

Unlocks the model, freeing it up for others to lock.

Raises:

RuntimeError – if used after unlocking