7.2. aas.util.traversal - Functions for Traversing AAS Object structures

A module with helper functions for traversing AAS object structures.

basyx.aas.util.traversal.walk_semantic_ids_recursive(root: basyx.aas.model.base.Referable) Iterator[basyx.aas.model.base.Reference]

Traverse an AAS object hierarchy (e.g. a Submodel with all recursively contained SubmodelElements) recursively and return all non-empty (!= None) semanticIds.

This is a generator function, yielding all the semanticIds. No Referable objects should be added, removed or moved to/from/in the AAS object hierarchy while iterating, as this could result in undefined behaviour.

basyx.aas.util.traversal.walk_submodel(collection: Union[basyx.aas.model.submodel.Submodel, basyx.aas.model.submodel.SubmodelElementCollection, basyx.aas.model.submodel.SubmodelElementList]) Iterator[basyx.aas.model.submodel.SubmodelElement]

Traverse the SubmodelElements in a Submodel, SubmodelElementCollection or a SubmodelElementList recursively in post-order tree-traversal.

This is a generator function, yielding all the SubmodelElements. No SubmodelElements should be added, removed or moved while iterating, as this could result in undefined behaviour.