UnlockedModel
- class UnlockedModel
Description
A SysML v2 and KerML model that needs to be locked before access.
Note that
UnlockedModelis generally not intended to be instantiated directly. Ideally, useload_model_unlockedorLockedModel.unlockon a previously acquiredLockedModel.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)RDocuments as part of this model including the environment.
RDiagnostics emitted while building this model.
RDocuments as part of this model.
RThe environment this model was built in.
RIndex of exported symbols.
RStandard library cache.
RThe model build result.
Locks the model, allowing access to the contained documents.
Create a new empty document with
urlin this model.Convert this model to
Environmentfor 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
unlockon the returned model once done, or use awithstatement: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
Modelthat 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
urlin this model.Language may be explicitly provided with
language, otherwise it will be inferred fromurl.tiermay be used to override the created document tier, and defaults toProject. Here,tierprimarily controls whether the document is validated or not if it is ever passed through thePipeline.Note that elements from new documents will not appear in
index.
- to_environment() syside.Environment
Convert this model to
Environmentfor building other dependent models.The returned environment contains the union of documents from this model and its environment, in this order.