syside.Deserializer

class Deserializer(document: syside.Document)

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

Note that unlike Serializer deserialization cannot be completed in a single pass in general because documents may form reference cycles with each other. The typical deserialization pattern will be

des = Deserializer(document)
model, report = des.accept(reader, DESERIALIZE_STANDARD)
# ... collect all valid element ids for linking
link_report, all_linked = model.link(my_reference_resolve)

Initialization

Construct a new deserializer that will deserialize models into the provided document.

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

Accept a reader for deserialization into currently bound document. Returns the deserialized model, or raises a RuntimeError. document without a Url with scheme will emit a warning that relative URIs will not be resolvable.

Note that cross-references may not be resolved, and instead replaced by placeholder element references due to potential reference cycles between documents. Call link on the returned model when dependent documents have been loaded.

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

Accept reader for deserialization into document. Equivalent to

deserializer.reset(document)
return deserializer.accept(reader, attributes)

Returns the deserialized model, or raises RuntimeError.

property document: syside.Document

The document bound to this deserializer

reset(document: syside.Document) None

Reset the deserializer. Rebinds to the document and resets this Deserializer for new deserialization.