syside

Native Syside module for Python.

Internally, Syside uses snake_case for all non-type symbols, e.g. attributes and functions, whereas the specification and the Pilot implementation both use camelCase instead. snake_case was chosen because it integrates far better into Python - the programming language that Syside uses.

Additionally, Syside does not use multiple inheritance to implement the standard model and instead uses sum-types where appropriate (typing.Union in Python). This improves performance as methods and attributes can be inlined and are not required to be accessed through interfaces (no pointer chasing), reduces memory usage as unused members need not be stored (e.g. Relationship interface for Associations), and improves usability by allowing more flexible constraints on element types.

Usability is further improved by storing child elements in separate members based on their position in the textual syntax. This is in comparison to the Pilot implementation, which only uses two such members, ownedRelationship and ownedRelatedElement. Syside implementation allows direct access to most special members without resorting to filtering every time, improving performance. Moreover, modifying and inserting such members does not require potentially expensive reshuffling of children arrays.

Lastly, because textual source files may contain syntax errors, all model elements may return optional elements, even if the corresponding attribute in the specification expects a non-null element. This also allows elements to be default constructible.

Additional Notes

  • For performance reasons, elements and their groups are stored as specific members in AST nodes based on their position in textual syntax which also makes mutation easier. Notably:

    • prefixes - group for metadata prefixes, prefixed with # in textual notation

    • heritage - type specializations and conjugations

    • type_relationships - non-specialization type relationships appearing after specialization part, including feature chaining

    • children - elements in the children block (in-between brackets { and }) in textual notation, and expression arguments

    • declared_ends, declared_messages - end features and messages before the children block. In the textual syntax they appear in the same position, hence in contrast to similar groups there are additional try_append and try_insert methods that return None without throwing if modification failed because the slot is already occupied by either ends or messages.

  • Due to parser limitations, argument member references are parsed as argument members instead. This has little effect on analysis as intermediate FeatureReferenceExpression and OwningMembership are excluded from the expression tree.

  • Elements can only be owned nodes in the same document to satisfy tree constraints, elements can be referenced by any appropriate element. Violating this constraint raises ValueError. Similarly, trying to steal ownership also raises ValueError.

  • Relationship ends cannot generally be modified unless they are member elements, and only a few allow this dependent on the textual syntax (KerML only but there are currently no checks that models constructed are actually representable in chosen textual syntax beyond some simple checks during printing).

Model Modifications

Adding new owned or referenced Elements to a model can raise:

  • TypeError:

    • if the relationship type is not allowed by the container/setter as this violates internal invariants.

    • if the element type is not allowed by the container/setter as this violates internal invariants.

    • if the element type is not allowed by the relationship as this violates internal invariants.

    • if the element is owned but the relationship instead only references related element to prevent orphan elements.

  • ValueError:

    • if taking ownership of an element from another document as this violates internal invariants.

    • if stealing ownership of the element as there is no good default behaviour on what should happen, remove the element from the model first before trying to re-parent it.

  • RuntimeError:

    • if the parent Element has been removed from the model. This can be fixed by adding the Element back into the model as an owned element.

Index

Submodules

debug

experimental

Labs

Umbrella submodule for all experimental implementations.

gc

Internal GC interface. Currently only Documents are collected by the internal garbage collector.

ide

Submodule for IDE related functions.

json

Labs

Convenience module intending to match the standard library json module.

version

preview

Labs

Module implementing various proposals for how to make the Syside API more convenient and easier to pick up.

Classes

AcceptActionUsage

SysML

Implementation of AcceptActionUsage defined in the SysML specification.

ActionDefinition

SysML

Implementation of ActionDefinition defined in the SysML specification.

ActionParameterAccessor

ActionUsage

SysML

Implementation of ActionUsage defined in the SysML specification.

ActorMembership

SysML

Implementation of ActorMembership defined in the SysML specification.

AllocationDefinition

SysML

Implementation of AllocationDefinition defined in the SysML specification.

AllocationUsage

SysML

Implementation of AllocationUsage defined in the SysML specification.

AnalysisCaseDefinition

SysML

Implementation of AnalysisCaseDefinition defined in the SysML specification.

AnalysisCaseUsage

SysML

Implementation of AnalysisCaseUsage defined in the SysML specification.

AnnotatingElement

SysML

Implementation of AnnotatingElement defined in the KerML specification.

Annotation

SysML

Implementation of Annotation defined in the KerML specification.

Annotations

ArgumentsAccessor

AssertConstraintUsage

SysML

Implementation of AssertConstraintUsage defined in the SysML specification.

AssignmentActionUsage

SysML

Implementation of AssignmentActionUsage defined in the SysML specification.

Association

SysML

Implementation of Association defined in the KerML specification.

AssociationStructure

SysML

Implementation of AssociationStructure defined in the KerML specification.

AstNode

AttributeDefinition

SysML

Implementation of AttributeDefinition defined in the SysML specification.

AttributeMap

Internal opaque type for deserialization attribute mapping

AttributeUsage

SysML

Implementation of AttributeUsage defined in the SysML specification.

BaseModel

A SysMLv2 model represented using abstract syntax.

BasicDocument

Behavior

SysML

Implementation of Behavior defined in the KerML specification.

BindingConnector

SysML

Implementation of BindingConnector defined in the KerML specification.

BindingConnectorAsUsage

SysML

Implementation of BindingConnectorAsUsage defined in the SysML specification.

BooleanExpression

SysML

Implementation of BooleanExpression defined in the KerML specification.

BoundMetaclass

CalculationDefinition

SysML

Implementation of CalculationDefinition defined in the SysML specification.

CalculationUsage

SysML

Implementation of CalculationUsage defined in the SysML specification.

CaseDefinition

SysML

Implementation of CaseDefinition defined in the SysML specification.

CaseUsage

SysML

Implementation of CaseUsage defined in the SysML specification.

ChainedChildrenNodes

Container that stores a vector of children nodes that may own feature chainings.

ChainedFeatureMemberAccessor

ChainedFeatureReference

ChainedMemberAccessor

ChainedReferenceAccessor

ChainedTypeReference

ChildrenNodes

Container that stores a vector of children nodes.

ChildrenNodesView

A view to a container of children nodes.

Class

SysML

Implementation of Class defined in the KerML specification.

Classifier

SysML

Implementation of Classifier defined in the KerML specification.

ClassifierReference

CodeDescription

CollectExpression

SysML

Implementation of CollectExpression defined in the KerML specification.

Comment

SysML

Implementation of Comment defined in the KerML specification.

CompilationReport

Compiler

ConcernDefinition

SysML

Implementation of ConcernDefinition defined in the SysML specification.

ConcernUsage

SysML

Implementation of ConcernUsage defined in the SysML specification.

ConjugatedPortDefinition

SysML

Implementation of ConjugatedPortDefinition defined in the SysML specification.

ConjugatedPortTyping

SysML

Implementation of ConjugatedPortTyping defined in the SysML specification.

Conjugation

SysML

Implementation of Conjugation defined in the KerML specification.

ConnectionDefinition

SysML

Implementation of ConnectionDefinition defined in the SysML specification.

ConnectionUsage

SysML

Implementation of ConnectionUsage defined in the SysML specification.

Connector

SysML

Implementation of Connector defined in the KerML specification.

ConnectorAsUsage

SysML

Implementation of ConnectorAsUsage defined in the SysML specification.

ConnectorAsUsageEnds

ConnectorEnds

ConnectorEndsAccessor

ConstraintDefinition

SysML

Implementation of ConstraintDefinition defined in the SysML specification.

ConstraintUsage

SysML

Implementation of ConstraintUsage defined in the SysML specification.

ConstructorExpression

SysML

Implementation of ConstructorExpression defined in the KerML specification.

ContainerView

An immutable view into a native random-access container. Implements Sequence protocol.

ControlNode

SysML

Implementation of ControlNode defined in the SysML specification.

CrossSubsetting

SysML

Implementation of CrossSubsetting defined in the KerML specification.

CstNode

DataType

SysML

Implementation of DataType defined in the KerML specification.

DecisionNode

SysML

Implementation of DecisionNode defined in the SysML specification.

Definition

SysML

Implementation of Definition defined in the SysML specification.

Dependency

SysML

Implementation of Dependency defined in the KerML specification.

DependencyEnds

DependencyPrefixes

DeserializedModel

The model as it was deserialized, with references potentially unresolved.

Deserializer

Deserializer for SysML models. The actual deserialization input depends on used Reader.

Diagnostic

DiagnosticContext

DiagnosticFormatOptions

DiagnosticMessage

A diagnostic providing information about a model.

DiagnosticRelatedInformation

DiagnosticResults

Diagnostics

All model diagnostics.

Differencing

SysML

Implementation of Differencing defined in the KerML specification.

Disjoining

SysML

Implementation of Disjoining defined in the KerML specification.

Document

DocumentID

DocumentOptions

DocumentSegment

DocumentTimes

DocumentVersion

Documentation

SysML

Implementation of Documentation defined in the KerML specification.

EffectAccessor

Element

SysML

Implementation of Element defined in the KerML specification.

ElementAccessor

ElementFilterMembership

SysML

Implementation of ElementFilterMembership defined in the KerML specification.

EncodingOpts

Percent-encoding options

EndFeatureMembership

SysML

Implementation of EndFeatureMembership defined in the KerML specification.

EnumerationDefinition

SysML

Implementation of EnumerationDefinition defined in the SysML specification.

EnumerationUsage

SysML

Implementation of EnumerationUsage defined in the SysML specification.

Environment

Standard library environment for use with user models.

EventOccurrenceUsage

SysML

Implementation of EventOccurrenceUsage defined in the SysML specification.

ExecutionResult

Executor

ExhibitStateUsage

SysML

Implementation of ExhibitStateUsage defined in the SysML specification.

Expose

SysML

Implementation of Expose defined in the SysML specification.

Expression

SysML

Implementation of Expression defined in the KerML specification.

ExpressionParameterAccessor

Feature

SysML

Implementation of Feature defined in the KerML specification.

FeatureChainExpression

SysML

Implementation of FeatureChainExpression defined in the KerML specification.

FeatureChaining

SysML

Implementation of FeatureChaining defined in the KerML specification.

FeatureInverting

SysML

Implementation of FeatureInverting defined in the KerML specification.

FeatureMembership

SysML

Implementation of FeatureMembership defined in the KerML specification.

FeatureReference

FeatureReferenceExpression

SysML

Implementation of FeatureReferenceExpression defined in the KerML specification.

FeatureTyping

SysML

Implementation of FeatureTyping defined in the KerML specification.

FeatureValue

SysML

Implementation of FeatureValue defined in the KerML specification.

FeatureValueAccessor

FieldId

Flow

SysML

Implementation of Flow defined in the KerML specification.

FlowDefinition

SysML

Implementation of FlowDefinition defined in the SysML specification.

FlowEnd

SysML

Implementation of FlowEnd defined in the KerML specification.

FlowUsage

SysML

Implementation of FlowUsage defined in the SysML specification.

ForLoopActionUsage

SysML

Implementation of ForLoopActionUsage defined in the SysML specification.

ForkNode

SysML

Implementation of ForkNode defined in the SysML specification.

FormatOptions

FormatPreserved

FramedConcernMembership

SysML

Implementation of FramedConcernMembership defined in the SysML specification.

Function

SysML

Implementation of Function defined in the KerML specification.

GuardAccessor

Heritage

IOSchedule

IPv4Address

IPv6Address

IdMap

DeserializedModel compatible mapping for elements. This will typically be used for linking pending references:

IfActionUsage

SysML

Implementation of IfActionUsage defined in the SysML specification.

Import

SysML

Implementation of Import defined in the KerML specification.

IncludeUseCaseUsage

SysML

Implementation of IncludeUseCaseUsage defined in the SysML specification.

IndexExpression

SysML

Implementation of IndexExpression defined in the KerML specification.

IndexedSymbol

Infinity

InstantiationExpression

SysML

Implementation of InstantiationExpression defined in the KerML specification.

Interaction

SysML

Implementation of Interaction defined in the KerML specification.

InterfaceDefinition

SysML

Implementation of InterfaceDefinition defined in the SysML specification.

InterfaceUsage

SysML

Implementation of InterfaceUsage defined in the SysML specification.

Intersecting

SysML

Implementation of Intersecting defined in the KerML specification.

Invariant

SysML

Implementation of Invariant defined in the KerML specification.

InvocationExpression

SysML

Implementation of InvocationExpression defined in the KerML specification.

ItemDefinition

SysML

Implementation of ItemDefinition defined in the SysML specification.

ItemUsage

SysML

Implementation of ItemUsage defined in the SysML specification.

JoinNode

SysML

Implementation of JoinNode defined in the SysML specification.

JsonReader

Unbound reader for JSON deserialization

JsonStringOptions

Options for serialization writer to JSON strings

JsonStringWriter

Serialization writer that outputs JSON string

LazyIterator

LibraryID

LibraryPackage

SysML

Implementation of LibraryPackage defined in the KerML specification.

LiteralBoolean

SysML

Implementation of LiteralBoolean defined in the KerML specification.

LiteralExpression

SysML

Implementation of LiteralExpression defined in the KerML specification.

LiteralInfinity

SysML

Implementation of LiteralInfinity defined in the KerML specification.

LiteralInteger

SysML

Implementation of LiteralInteger defined in the KerML specification.

LiteralRational

SysML

Implementation of LiteralRational defined in the KerML specification.

LiteralString

SysML

Implementation of LiteralString defined in the KerML specification.

LoopActionUsage

SysML

Implementation of LoopActionUsage defined in the SysML specification.

MemberAccessor

Membership

SysML

Implementation of Membership defined in the KerML specification.

MembershipExpose

SysML

Implementation of MembershipExpose defined in the SysML specification.

MembershipImport

SysML

Implementation of MembershipImport defined in the KerML specification.

MergeNode

SysML

Implementation of MergeNode defined in the SysML specification.

Messages

Metaclass

SysML

Implementation of Metaclass defined in the KerML specification.

MetadataAccessExpression

SysML

Implementation of MetadataAccessExpression defined in the KerML specification.

MetadataDefinition

SysML

Implementation of MetadataDefinition defined in the SysML specification.

MetadataFeature

SysML

Implementation of MetadataFeature defined in the KerML specification.

MetadataUsage

SysML

Implementation of MetadataUsage defined in the SysML specification.

Model

A SysMLv2 model represented using abstract syntax.

ModelError

An exception thrown when model contains errors.

ModelPrinter

Multiplicity

SysML

Implementation of Multiplicity defined in the KerML specification.

MultiplicityRange

SysML

Implementation of MultiplicityRange defined in the KerML specification.

Namespace

SysML

Implementation of Namespace defined in the KerML specification.

NamespaceBody

NamespaceExpose

SysML

Implementation of NamespaceExpose defined in the SysML specification.

NamespaceImport

SysML

Implementation of NamespaceImport defined in the KerML specification.

NamespacePrefixes

NullExpression

SysML

Implementation of NullExpression defined in the KerML specification.

ObjectiveMembership

SysML

Implementation of ObjectiveMembership defined in the SysML specification.

OccurrenceDefinition

SysML

Implementation of OccurrenceDefinition defined in the SysML specification.

OccurrenceUsage

SysML

Implementation of OccurrenceUsage defined in the SysML specification.

OperatorExpression

SysML

Implementation of OperatorExpression defined in the KerML specification.

OwnedChildrenNodes

Container that stores a vector of potentially owned children nodes.

OwnedExpressionAccessor

OwnedFeatureAccessor

OwnedMemberAccessor

OwnedMultiplicityAccessor

OwnedSuccessionAccessor

OwningMembership

SysML

Implementation of OwningMembership defined in the KerML specification.

Package

SysML

Implementation of Package defined in the KerML specification.

ParameterAccessor

ParameterMembership

SysML

Implementation of ParameterMembership defined in the KerML specification.

PartDefinition

SysML

Implementation of PartDefinition defined in the SysML specification.

PartUsage

SysML

Implementation of PartUsage defined in the SysML specification.

PartialTextDocumentData

Path

A sequence of path segments that stringifies with unrestricted names as needed. Similar to QualifiedName but may contain indices to unnamed elements, that are printed literally with / separator instead.

PayloadFeature

SysML

Implementation of PayloadFeature defined in the KerML specification.

PayloadFeatureAccessor

PendingReference

Reference that has yet to be linked.

PerformActionUsage

SysML

Implementation of PerformActionUsage defined in the SysML specification.

Pipeline

PipelineOptions

PortConjugation

SysML

Implementation of PortConjugation defined in the SysML specification.

PortDefinition

SysML

Implementation of PortDefinition defined in the SysML specification.

PortUsage

SysML

Implementation of PortUsage defined in the SysML specification.

PositionUtf16

PositionUtf32

PositionUtf8

Predicate

SysML

Implementation of Predicate defined in the KerML specification.

PrinterConfig

QualifiedName

A sequence of qualified name segments that stringifies with unrestricted names as needed. Unlike string, this allows querying segments in a qualified name without having to parse it again, and is cheaper to construct as string conversion is performed only when needed.

RangeUtf16

RangeUtf32

RangeUtf8

Reader

Abstract base class for all deserialization readers.

Redefinition

SysML

Implementation of Redefinition defined in the KerML specification.

ReferenceAccessor

ReferenceParameterAccessor

ReferenceSubsetting

SysML

Implementation of ReferenceSubsetting defined in the KerML specification.

ReferenceUsage

SysML

Implementation of ReferenceUsage defined in the SysML specification.

ReferenceUsageAccessor

ReferentAccessor

Relationship

SysML

Implementation of Relationship defined in the KerML specification.

RelationshipBody

Container for relationship bodies. Works similarly to ChildrenNodes except relationships are not needed and all elements are taken ownership off.

RenderingDefinition

SysML

Implementation of RenderingDefinition defined in the SysML specification.

RenderingUsage

SysML

Implementation of RenderingUsage defined in the SysML specification.

RequirementConstraintMembership

SysML

Implementation of RequirementConstraintMembership defined in the SysML specification.

RequirementDefinition

SysML

Implementation of RequirementDefinition defined in the SysML specification.

RequirementUsage

SysML

Implementation of RequirementUsage defined in the SysML specification.

RequirementVerificationMembership

SysML

Implementation of RequirementVerificationMembership defined in the SysML specification.

ResultExpressionAccessor

ResultExpressionMembership

SysML

Implementation of ResultExpressionMembership defined in the KerML specification.

ReturnParameterMembership

SysML

Implementation of ReturnParameterMembership defined in the KerML specification.

SatisfactionSubjectAccessor

SatisfyRequirementUsage

SysML

Implementation of SatisfyRequirementUsage defined in the SysML specification.

Schedule

ScheduleError

ScheduleOptions

SelectExpression

SysML

Implementation of SelectExpression defined in the KerML specification.

Sema

Semantic resolver for SysML. This is responsible for linking references and resolving semantic rules in the pipeline.

SendActionUsage

SysML

Implementation of SendActionUsage defined in the SysML specification.

SerdeMessage

Message emitted during (de)serialization

SerdeReport

(De)Serialization report containing emitted messages.

SerializationOptions

Options for SysML model serialization. Attribute options are ordered in descending precedence.

Serializer

Serializer for SysML models. The actual serialization output depends on used Writer.

SexpOptions

SharedMutex

Specialization

SysML

Implementation of Specialization defined in the KerML specification.

StageTimes

StakeholderMembership

SysML

Implementation of StakeholderMembership defined in the SysML specification.

StateDefinition

SysML

Implementation of StateDefinition defined in the SysML specification.

StateId

StateSubactionMembership

SysML

Implementation of StateSubactionMembership defined in the SysML specification.

StateUsage

SysML

Implementation of StateUsage defined in the SysML specification.

StaticIndex

Stdlib

Cache of standard library elements used by sema.

Step

SysML

Implementation of Step defined in the KerML specification.

Stream

Structure

SysML

Implementation of Structure defined in the KerML specification.

Subclassification

SysML

Implementation of Subclassification defined in the KerML specification.

SubjectMembership

SysML

Implementation of SubjectMembership defined in the SysML specification.

Subsetting

SysML

Implementation of Subsetting defined in the KerML specification.

Succession

SysML

Implementation of Succession defined in the KerML specification.

SuccessionAsUsage

SysML

Implementation of SuccessionAsUsage defined in the SysML specification.

SuccessionFlow

SysML

Implementation of SuccessionFlow defined in the KerML specification.

SuccessionFlowUsage

SysML

Implementation of SuccessionFlowUsage defined in the SysML specification.

Symbol

TargetFeatureAccessor

TerminateActionUsage

SysML

Implementation of TerminateActionUsage defined in the SysML specification.

TextDocument

TextDocumentData

TextDocumentEditUtf16

TextDocumentEditUtf32

TextDocumentEditUtf8

TextDocuments

TextEdit

TextualRepresentation

SysML

Implementation of TextualRepresentation defined in the KerML specification.

TransitionFeatureMembership

SysML

Implementation of TransitionFeatureMembership defined in the SysML specification.

TransitionSourceAccessor

TransitionUsage

SysML

Implementation of TransitionUsage defined in the SysML specification.

TriggerAccessor

TriggerInvocationExpression

SysML

Implementation of TriggerInvocationExpression defined in the SysML specification.

Type

SysML

Implementation of Type defined in the KerML specification.

TypeFeaturing

SysML

Implementation of TypeFeaturing defined in the KerML specification.

TypeGuard

The type used in a type check expression, e.g. istype, hastype. The actual expression result type is ScalarValues::Boolean.

TypeReference

TypeRelationships

UnexpectedDifferentReference

Unioning

SysML

Implementation of Unioning defined in the KerML specification.

Url

URL as described using the Uniform Resource Identifier (URI) specification (RFC3986).

Usage

SysML

Implementation of Usage defined in the SysML specification.

UseCaseDefinition

SysML

Implementation of UseCaseDefinition defined in the SysML specification.

UseCaseUsage

SysML

Implementation of UseCaseUsage defined in the SysML specification.

VariantMembership

SysML

Implementation of VariantMembership defined in the SysML specification.

VerificationCaseDefinition

SysML

Implementation of VerificationCaseDefinition defined in the SysML specification.

VerificationCaseUsage

SysML

Implementation of VerificationCaseUsage defined in the SysML specification.

ViewDefinition

SysML

Implementation of ViewDefinition defined in the SysML specification.

ViewRenderingMembership

SysML

Implementation of ViewRenderingMembership defined in the SysML specification.

ViewUsage

SysML

Implementation of ViewUsage defined in the SysML specification.

ViewpointDefinition

SysML

Implementation of ViewpointDefinition defined in the SysML specification.

ViewpointUsage

SysML

Implementation of ViewpointUsage defined in the SysML specification.

WhileLoopActionUsage

SysML

Implementation of WhileLoopActionUsage defined in the SysML specification.

WriteLocked

Writer

Abstract base class for serialization writer implementations.

Attributes
Functions

build_model

Build the AST for document from its text_document. Any existing model will be cleared, and the built model will not have its references linked. Instead, most references will use placeholder references that will be replaced by actual targets in linking stage. Only sysml and kerml languages are supported.

collect_exports

Collect and cache symbols exported by document. This must be called before the document is indexed, otherwise wrong or no symbols may be indexed. Returns the number of symbols cached.

collect_files_recursively

Recursively collect all .sysml and .kerml files in the specified directory.

decode_path

Decode a filesystem path from a Url. This correctly handles Windows and Posix paths using file:// scheme and returns other Urls as is.

deserialize

Convenience function for deserialization. Prefer using Deserializer to avoid allocations when doing repeated deserializations.

format_diagnostics

get_default_executor

Get a default initialized Executor for running schedules. Default executor will use half the logical cores that are available on the current machine. An executor is just a thread pool so there is no reason for constructing and destroying one all the time.

load_model

Load a SysMLv2 model.

make_file_url

Construct a Url for a filesystem path with the file: scheme. This correctly handles Windows and Posix paths, normalizes Windows drive letters to uppercase, and percent escapes Unicode characters.

make_pipeline

pprint

Prints model subtree starting at root to textual syntax.

sema_reset

Reset semantic state of element. This will typically remove any implied relationships, and reverse a few other changes made by sema. After this completes, element.sema_state == SemaState.None.

serialize

Convenience function for serialization. Prefer using Serializer to avoid allocations when doing repeated serializations.

sexp

Generate a minimal S-expression of owned elements rooted at root, useful for debugging.

try_load_model

Load a SysMLv2 model.

Enumerations

AlwaysNever

BuildState

Document build state

DiagnosticSeverity

DocumentKind

Is this a model-created document?

DocumentState

DocumentTier

ExplicitOperator

FailAction

Action taken when a serialization error is encountered.

FeatureDirectionKind

SysML

Implementation of FeatureDirectionKind defined in the KerML specification.

FloatFormat

HostType

ImplicitSpecializationKind

KwToken

LineEnd

ModelLanguage

MultiOrder

MultiPlacement

NameID

NullFormat

Operator

OperatorBreak

OptionalKw

OptionalKwToken

OptionalToken

PortionKind

SysML

Implementation of PortionKind defined in the SysML specification.

PrintMode

RequirementConstraintKind

SysML

Implementation of RequirementConstraintKind defined in the SysML specification.

Scheme

SemaState

Semantic resolution state of Elements. Sema will use this information to discard duplicate work, e.g. when resolving elements in a group of related documents.

StateSubactionKind

SysML

Implementation of StateSubactionKind defined in the SysML specification.

TextDocumentSaveReason

TransitionFeatureKind

SysML

Implementation of TransitionFeatureKind defined in the SysML specification.

TreeDrawing

TriggerKind

SysML

Implementation of TriggerKind defined in the SysML specification.

ValidationTiming

VisibilityKind

SysML

Implementation of VisibilityKind defined in the KerML specification.

VisitAction


Attributes

DESERIALIZE_INTERNAL: syside.AttributeMap = Ellipsis
DESERIALIZE_STANDARD: syside.AttributeMap = Ellipsis
M = TypeVar("M", bound=syside.Element)
R = TypeVar("R", bound=syside.Relationship)
T = TypeVar("T")
TElement = TypeVar("TElement", bound=syside.Element)
TNode = TypeVar("TNode", bound=syside.AstNode)
U = TypeVar("U", covariant=True)
type Value = int | float | bool | syside.Infinity | str | range | syside.Element | syside.BoundMetaclass | None | list[Value]
Used in

󰊕 Functions

build_model(document: syside.Document, language: syside.ModelLanguage | None = None) list[syside.Diagnostic]

Build the AST for document from its text_document. Any existing model will be cleared, and the built model will not have its references linked. Instead, most references will use placeholder references that will be replaced by actual targets in linking stage. Only sysml and kerml languages are supported.

This is a CST -> AST stage in the pipeline.

Raises ValueError if the document has unsupported language, or it has no associated text_document.

collect_exports(document: syside.Document) int

Collect and cache symbols exported by document. This must be called before the document is indexed, otherwise wrong or no symbols may be indexed. Returns the number of symbols cached.

collect_files_recursively(directory_path: str | os.PathLike[Any]) list[pathlib.Path]

Recursively collect all .sysml and .kerml files in the specified directory.

decode_path(arg0: syside.Url, options: syside.EncodingOpts = ...) str

Decode a filesystem path from a Url. This correctly handles Windows and Posix paths using file:// scheme and returns other Urls as is.

deserialize(document: syside.Document, reader: syside.Reader, attributes: syside.AttributeMap) tuple[syside.DeserializedModel, syside.SerdeReport[syside.DocumentSegment | str | syside.Element]]

Convenience function for deserialization. Prefer using Deserializer to avoid allocations when doing repeated deserializations.

format_diagnostics(errors: Sequence[syside.Diagnostic], context: syside.DiagnosticContext = ..., options: syside.DiagnosticFormatOptions = ...) str
get_default_executor() syside.Executor

Get a default initialized Executor for running schedules. Default executor will use half the logical cores that are available on the current machine. An executor is just a thread pool so there is no reason for constructing and destroying one all the time.

load_model(paths: Iterable[str | os.PathLike[Any]], *, environment: syside.Environment | None = None, sysml_source: str | None = None, kerml_source: str | None = None, warnings_as_errors: bool = False) tuple[syside.Model, syside.Diagnostics]
load_model(*, sysml_source: str, kerml_source: str | None = ..., environment: syside.Environment | None = None, warnings_as_errors: bool = False) tuple[syside.Model, syside.Diagnostics]
load_model(*, kerml_source: str, sysml_source: str | None = ..., environment: syside.Environment | None = None, warnings_as_errors: bool = False) tuple[syside.Model, syside.Diagnostics]

Load a SysMLv2 model.

At least one of paths, sysml_source, and kerml_source must not be none.

Parameters:
  • paths – The paths to SysMLv2 or KerML files to load. These files must have correct file extensions (.sysml or .kerml).

  • environment – The environment to be used for the model. If this parameter is left to None, uses the default environment. sysml_source: A SysMLv2 source to be loaded as an in-memory file. kerml_source: A KerML source to be loaded as an in-memory file.

Returns:

Model and Diagnostics pair.

Raises:

ModelError – If returned diagnostics contain errors, or if warnings_as_errors is True, if diagnostics contain errors or warnings.

make_file_url(arg0: str, options: syside.EncodingOpts = ...) syside.Url

Construct a Url for a filesystem path with the file: scheme. This correctly handles Windows and Posix paths, normalizes Windows drive letters to uppercase, and percent escapes Unicode characters.

make_file_url(arg0: str | os.PathLike[AnyStr], options: syside.EncodingOpts = ...) syside.Url
make_pipeline(arg: syside.PipelineOptions, /) syside.Pipeline
pprint(arg0: syside.Element, printer: syside.ModelPrinter | None = None, config: syside.PrinterConfig = ...) str

Prints model subtree starting at root to textual syntax.

NOTE This performs very little checking that the given model can be represented in textual syntax, besides checking for elements that are missing. This has no effect when used as a formatter on a model parsed without syntax errors but programmatic models are not guaranteed to be valid textual syntax. In addition, it does not check that references are reachable from their scopes so parsing the printed model can fail to find them again. Otherwise, clearly unreachable references, such as when one of their ancestors is anonymous, will raise errors.

Only the first import from any parent namespaces that would shorten the printed reference is used. This does not apply to imports themselves to prevent reference resolution errors due to multiple or cyclical imports. Additionally, references relative to left-hand side expression result types, such as those from FeatureChainExpressions, are assumed to be directly or indirectly accessible so only their short or regular name is printed.

sema_reset(element: syside.Element) None

Reset semantic state of element. This will typically remove any implied relationships, and reverse a few other changes made by sema. After this completes, element.sema_state == SemaState.None.

sema_reset(document: syside.Document, reporter: Callable[[syside.Element, syside.UnexpectedDifferentReference], None] | None = None) None

Reset semantic state of document. This will call sema_reset on all owned elements, and additionally reset all resolved references back to unresolved state. While resetting references, if the resolved reference does not match the current reference, reporter will be called with the element the reference applies to and UnexpectedDifferentReference that was found. By default, reporter will print such errors to stderr.

After this completes, document.build_state == BuildState.Indexed.

serialize(root: syside.Element, writer: syside.Writer[syside.T], options: syside.SerializationOptions = ...) syside.SerdeReport[syside.Element]

Convenience function for serialization. Prefer using Serializer to avoid allocations when doing repeated serializations.

serialize(root: syside.Element, writer: syside.Writer[syside.T], use_standard_names: bool = True, include_derived: bool = False, include_redefined: bool = False, include_default: bool = False, include_optional: bool = False, include_implied: bool = False, fail_action: syside.FailAction = FailAction.Diagnose) syside.SerdeReport[syside.Element]
sexp(root: syside.Element, options: syside.SexpOptions = ...) str

Generate a minimal S-expression of owned elements rooted at root, useful for debugging.

sexp(root: syside.Element, indent: int = 2, include_implicit: bool = True, print_references: bool = False) str
try_load_model(paths: Iterable[str | os.PathLike[Any]], *, environment: syside.Environment | None = None, sysml_source: str | None = None, kerml_source: str | None = None) tuple[syside.Model, syside.Diagnostics]
try_load_model(paths: Iterable[str | os.PathLike[Any]], environment: syside.Environment) tuple[syside.Model, syside.Diagnostics]
try_load_model(*, sysml_source: str, kerml_source: str | None = ..., environment: syside.Environment | None = None) tuple[syside.Model, syside.Diagnostics]
try_load_model(*, kerml_source: str, sysml_source: str | None = ..., environment: syside.Environment | None = None) tuple[syside.Model, syside.Diagnostics]

Load a SysMLv2 model.

At least one of paths, sysml_source, and kerml_source must not be none.

Parameters:
  • paths – The paths to SysMLv2 or KerML files to load. These files must have correct file extensions (.sysml or .kerml).

  • environment – The environment to be used for the model. If this parameter is left to None, uses the default environment.

  • sysml_source – A SysMLv2 source to be loaded as an in-memory file.

  • kerml_source – A KerML source to be loaded as an in-memory file.

Returns:

Model and Diagnostics pair. Note that models may only be partial if parsing failed, however even a partial model may be of interest for analysis.

Enumerations

class AlwaysNever
Used in
class BuildState

Document build state

= 0

Document has only been created

= 1

Document content has changed

= 2

Document content was parsed

= 3

Document global and local exports have been indexed

= 4

Model has been built and linked

= 5

Model has been validated

Used in
class DiagnosticSeverity

= 1

= 2

= 3

= 4

Used in
class DocumentKind

Is this a model-created document?

Is this a model-created document?

Is this a model-created document?

Is this a model-created document?

Is this a model-created document?

Is this a model-created document?

Used in
class DocumentState

= 0

Document has been created

= 1

Document is being built

= 2

Document was built successfully

= 3

Document building was cancelled

= 4

Document building errored

Used in
class DocumentTier

Document is a part of standard library. Assume that such documents change very rarely, or only change with new tool versions.

Document is imported from a third-party library. Assume that they do not change unless the third-party library is updated.

Document is a part of the current project and may be edited at any time.

Used in
class ExplicitOperator
Used in
class FailAction

Action taken when a serialization error is encountered.

Stop serialization on the first error.

Continue diagnosing errors but stop serialization.

Ignore errors and continue serialization.

Used in
class FeatureDirectionKind

SysML

Implementation of FeatureDirectionKind defined in the KerML specification.

Specification:

FeatureDirectionKind enumerates the possible kinds of direction that a Feature may be given as a member of a Type.

For language description, see section 7.3.4.2 of the KerML specification. For more details on the model, see section 8.3.3.1.5 of the KerML specification.

Used in
class FloatFormat
Used in
class HostType

No host is specified.

A host is specified by reg-name.

A host is specified by ipv4_address.

A host is specified by ipv6_address.

A host is specified by IPvFuture.

Used in
class ImplicitSpecializationKind

Entry

Used in
class KwToken
Used in
class LineEnd
Used in
class ModelLanguage
Used in
class MultiOrder
Used in
class MultiPlacement
Used in
class NameID

Reference element by its regular ID

Reference element by its short ID

Used in
class NullFormat
Used in
class Operator
Used in
class OperatorBreak
Used in
class OptionalKw
Used in
class OptionalKwToken
Used in
class OptionalToken
Used in
class PortionKind

SysML

Implementation of PortionKind defined in the SysML specification.

Specification:

PortionKind is an enumeration of the specific kinds of Occurrence portions that can be represented by an OccurrenceUsage.

For language description, see section 7.9.3 of the SysML specification. For more details on the model, see section 8.3.9.5 of the SysML specification.

Used in
class PrintMode
Used in
class RequirementConstraintKind

SysML

Implementation of RequirementConstraintKind defined in the SysML specification.

Specification:

A RequirementConstraintKind indicates whether a ConstraintUsage is an assumption or a requirement in a RequirementDefinition or RequirementUsage.

For language description, see section 7.21.2 of the SysML specification. For more details on the model, see section 8.3.21.6 of the SysML specification.

Used in
class Scheme

Indicates that no scheme is present

Indicates the scheme is not a well-known scheme

File Transfer Protocol (FTP)

FTP is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network.

File URI Scheme

The File URI Scheme is typically used to retrieve files from within one’s own computer.

The Hypertext Transfer Protocol URI Scheme

URLs of this type indicate a resource which is interacted with using the HTTP protocol.

The Secure Hypertext Transfer Protocol URI Scheme

URLs of this type indicate a resource which is interacted with using the Secure HTTP protocol.

The WebSocket URI Scheme

URLs of this type indicate a resource which is interacted with using the WebSocket protocol.

The Secure WebSocket URI Scheme

URLs of this type indicate a resource which is interacted with using the Secure WebSocket protocol.

Used in
class SemaState

Semantic resolution state of Elements. Sema will use this information to discard duplicate work, e.g. when resolving elements in a group of related documents.

Used in
class StateSubactionKind

SysML

Implementation of StateSubactionKind defined in the SysML specification.

Specification:

A StateSubactionKind indicates whether the action of a StateSubactionMembership is an entry, do or exit action.

For language description, see section 7.18.2 of the SysML specification. For more details on the model, see section 8.3.18.3 of the SysML specification.

Entry

Used in
class TextDocumentSaveReason
Used in
class TransitionFeatureKind

SysML

Implementation of TransitionFeatureKind defined in the SysML specification.

Specification:

A TransitionActionKind indicates whether the transition_feature of a TransitionFeatureMembership is a trigger, guard or effect.

For language description, see section 7.18.3 of the SysML specification. For more details on the model, see section 8.3.18.7 of the SysML specification.

Used in
class TreeDrawing

No tree is drawn

Use ASCII symbols for drawing

Use unicode symbols for drawing

Used in
class TriggerKind

SysML

Implementation of TriggerKind defined in the SysML specification.

Specification:

TriggerKind enumerates the kinds of triggers that can be represented by a TriggerInvocationExpression.

For language description, see section 7.18.3 of the SysML specification. For more details on the model, see section 8.3.17.18 of the SysML specification.

Used in
class ValidationTiming
Used in
class VisibilityKind

SysML

Implementation of VisibilityKind defined in the KerML specification.

Specification:

VisibilityKind is an enumeration whose literals specify the visibility of a Membership of an Element in a Namespace outside of that Namespace. Note that “visibility” specifically restricts whether an Element in a Namespace may be referenced by name from outside the Namespace and only otherwise restricts access to an Element as provided by specific constraints in the abstract syntax (e.g., preventing the import or inheritance of private Elements).

For language description, see section 7.2.5.2 of the KerML specification. For more details on the model, see section 8.3.2.4.7 of the KerML specification.

Used in
class VisitAction