UnlockedModel

class UnlockedModel

Description

A SysML v2 and KerML model that needs to be locked before access.

Note that UnlockedModel is generally not intended to be instantiated directly. Ideally, use load_model_unlocked or LockedModel.unlock on a previously acquired LockedModel.

model : UnlockedModel = load_model_unlocked("file.sysml")

# Alternatively
locked_model : LockedModel = load_model("file.sysml")
...
model = locked_model.unlock()

Inheritance:

Members defined in UnlockedModel (10 members)

all_documents

R

Documents as part of this model including the environment.

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.

result

R

The model build result.

lock

Locks the model, allowing access to the contained documents.

new_empty_document

Create a new empty document with url in this model.

to_environment

Convert this model to Environment for building other dependent models.

Attributes

property all_documents: Generator[syside.SharedMutex[syside.Document], None, None]

Documents as part of this model including the environment.

Environment documents are guaranteed to be after documents in this model.

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 result: syside.ExecutionResult | None

The model build result.

Methods

lock(with_environment: bool = False) → syside.Model

Locks the model, allowing access to the contained documents.

Order of documents is preserved. Call unlock on the returned model once done, or use a with statement:

with unlocked_model.lock() as model:
    ...
Parameters:

with_environment – If true, the returned model will additionally lock all documents from the environment. Environment documents are guaranteed to be after documents in this model. The exception to this is any new empty document added to the locked model which will be placed after instead. After relocking again they will be placed before the environment documents as if they were always a part of this model.

Returns:

A Model that gives access to all model documents and elements.

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.

to_environment() → syside.Environment

Convert this model to Environment for building other dependent models.

The returned environment contains the union of documents from this model and its environment, in this order.