Skip to content

Commit

Permalink
fix incorrect Submodel -> SubmodelElement replacements
Browse files Browse the repository at this point in the history
See commit 63b3d7c.
  • Loading branch information
jkhsjdhjs committed Dec 22, 2023
1 parent 63b3d7c commit 4567870
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions basyx/aas/adapter/aasx.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def read_into(self, object_store: model.AbstractObjectStore,
This function does the main job of reading the AASX file's contents. It traverses the relationships within the
package to find AAS JSON or XML parts, parses them and adds the contained AAS objects into the provided
`object_store`. While doing so, it searches all parsed :class:`Submodels <basyx.aas.model.submodel.SubmodelElement>` for
`object_store`. While doing so, it searches all parsed :class:`Submodels <basyx.aas.model.submodel.Submodel>` for
:class:`~basyx.aas.model.submodel.File` objects to extract the supplementary
files. The referenced supplementary files are added to the given `file_store` and the
:class:`~basyx.aas.model.submodel.File` objects' values are updated with the absolute name of the supplementary file
Expand Down Expand Up @@ -328,13 +328,13 @@ def write_aas(self,
This method takes the AASs' :class:`Identifiers <basyx.aas.model.base.Identifier>` (as `aas_ids`) to retrieve the
AASs from the given object_store.
:class:`References <basyx.aas.model.base.Reference>` to :class:`Submodels <basyx.aas.model.submodel.SubmodelElement>` and
:class:`References <basyx.aas.model.base.Reference>` to :class:`Submodels <basyx.aas.model.submodel.Submodel>` and
:class:`ConceptDescriptions <basyx.aas.model.concept.ConceptDescription>` (via semanticId attributes) are also
resolved using the
`object_store`. All of these objects are written to an aas-spec part `/aasx/data.xml` or `/aasx/data.json` in
the AASX package, compliant to the convention presented in "Details of the Asset Administration Shell".
Supplementary files which are referenced by a :class:`~basyx.aas.model.submodel.File` object in any of the
:class:`Submodels <basyx.aas.model.submodel.SubmodelElement>` are also added to the AASX
:class:`Submodels <basyx.aas.model.submodel.Submodel>` are also added to the AASX
package.
This method uses `write_all_aas_objects()` to write the AASX part.
Expand All @@ -352,13 +352,13 @@ def write_aas(self,
:class:`Identifiers <basyx.aas.model.base.Identifier>` of the AAS(s) to be written to the AASX file
:param object_store: :class:`ObjectStore <aas.model.provider.AbstractObjectStore>` to retrieve the
:class:`~basyx.aas.model.base.Identifiable` AAS objects (:class:`~basyx.aas.model.aas.AssetAdministrationShell`,
:class:`~basyx.aas.model.concept.ConceptDescription` and :class:`~basyx.aas.model.submodel.SubmodelElement`) from
:class:`~basyx.aas.model.concept.ConceptDescription` and :class:`~basyx.aas.model.submodel.Submodel`) from
:param file_store: :class:`SupplementaryFileContainer <~.AbstractSupplementaryFileContainer>` to retrieve
supplementary files from, which are referenced by :class:`~basyx.aas.model.submodel.File` objects
:param write_json: If `True`, JSON parts are created for the AAS and each :class:`~basyx.aas.model.submodel.SubmodelElement`
:param write_json: If `True`, JSON parts are created for the AAS and each :class:`~basyx.aas.model.submodel.Submodel`
in the AASX package file instead of XML parts. Defaults to `False`.
:raises KeyError: If one of the AAS could not be retrieved from the object store (unresolvable
:class:`Submodels <basyx.aas.model.submodel.SubmodelElement>` and
:class:`Submodels <basyx.aas.model.submodel.Submodel>` and
:class:`ConceptDescriptions <basyx.aas.model.concept.ConceptDescription>` are skipped, logging a warning/info
message)
:raises TypeError: If one of the given AAS ids does not resolve to an AAS (but another
Expand Down
4 changes: 2 additions & 2 deletions basyx/aas/adapter/xml/xml_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ def submodel_element_to_xml(obj: model.SubmodelElement) -> etree.Element:
def submodel_to_xml(obj: model.Submodel,
tag: str = NS_AAS+"submodel") -> etree.Element:
"""
Serialization of objects of class :class:`~basyx.aas.model.submodel.SubmodelElement` to XML
Serialization of objects of class :class:`~basyx.aas.model.submodel.Submodel` to XML
:param obj: Object of class :class:`~basyx.aas.model.submodel.SubmodelElement`
:param obj: Object of class :class:`~basyx.aas.model.submodel.Submodel`
:param tag: Namespace+Tag of the serialized element (optional). Default is "aas:submodel"
:return: Serialized ElementTree object
"""
Expand Down
8 changes: 4 additions & 4 deletions basyx/aas/examples/data/example_aas.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

def create_full_example() -> model.DictObjectStore:
"""
Creates an object store which is filled with an example :class:`~basyx.aas.model.submodel.SubmodelElement`,
Creates an object store which is filled with an example :class:`~basyx.aas.model.submodel.Submodel`,
:class:`~basyx.aas.model.concept.ConceptDescription` and :class:`~basyx.aas.model.aas.AssetAdministrationShell`
using the functions of this module
Expand All @@ -66,7 +66,7 @@ def create_full_example() -> model.DictObjectStore:

def create_example_asset_identification_submodel() -> model.Submodel:
"""
Creates a :class:`~basyx.aas.model.submodel.SubmodelElement` containing two :class:`~basyx.aas.model.submodel.Property` elements
Creates a :class:`~basyx.aas.model.submodel.Submodel` containing two :class:`~basyx.aas.model.submodel.Property` elements
according to 'Verwaltungssschale in der Praxis'
https://www.plattform-i40.de/PI40/Redaktion/DE/Downloads/Publikation/2019-verwaltungsschale-in-der-praxis.html
Expand Down Expand Up @@ -198,7 +198,7 @@ def create_example_asset_identification_submodel() -> model.Submodel:

def create_example_bill_of_material_submodel() -> model.Submodel:
"""
creates a :class:`~basyx.aas.model.submodel.SubmodelElement` for the bill of material containing two entities one
creates a :class:`~basyx.aas.model.submodel.Submodel` for the bill of material containing two entities one
co-managed and one self-managed
:return: example bill of material submodel
Expand Down Expand Up @@ -329,7 +329,7 @@ def create_example_bill_of_material_submodel() -> model.Submodel:

def create_example_submodel() -> model.Submodel:
"""
Creates an example :class:`~basyx.aas.model.submodel.SubmodelElement` containing all kind of
Creates an example :class:`~basyx.aas.model.submodel.Submodel` containing all kind of
:class:`~basyx.aas.model.submodel.SubmodelElement` objects
:return: example submodel
Expand Down
10 changes: 5 additions & 5 deletions basyx/aas/examples/data/example_aas_mandatory_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SPDX-License-Identifier: MIT
"""
Module for the creation of an :class:`ObjectStore <basyx.aas.model.provider.DictObjectStore>` with an example
:class:`~basyx.aas.model.aas.AssetAdministrationShell` and example :class:`Submodels <basyx.aas.model.submodel.SubmodelElement>`
:class:`~basyx.aas.model.aas.AssetAdministrationShell` and example :class:`Submodels <basyx.aas.model.submodel.Submodel>`
and a :class:`~aas.model.concept.ConceptDictionary` containing an
example :class:`~basyx.aas.model.concept.ConceptDescription`. All objects only contain mandatory
attributes.
Expand All @@ -26,7 +26,7 @@
def create_full_example() -> model.DictObjectStore:
"""
Creates an :class:`~.basyx.aas.model.provider.DictObjectStore` which is filled with an example
:class:`~basyx.aas.model.submodel.SubmodelElement`, :class:`~basyx.aas.model.concept.ConceptDescription`
:class:`~basyx.aas.model.submodel.Submodel`, :class:`~basyx.aas.model.concept.ConceptDescription`
and :class:`~basyx.aas.model.aas.AssetAdministrationShell` using the functions of this module
:return: :class:`~basyx.aas.model.provider.DictObjectStore`
Expand All @@ -42,7 +42,7 @@ def create_full_example() -> model.DictObjectStore:

def create_example_submodel() -> model.Submodel:
"""
Creates an example :class:`~basyx.aas.model.submodel.SubmodelElement` containing all kind of
Creates an example :class:`~basyx.aas.model.submodel.Submodel` containing all kind of
:class:`~basyx.aas.model.submodel.SubmodelElement` objects where only mandatory attributes are set
:return: example submodel
Expand Down Expand Up @@ -150,7 +150,7 @@ def create_example_submodel() -> model.Submodel:

def create_example_empty_submodel() -> model.Submodel:
"""
Creates an example empty :class:`~basyx.aas.model.submodel.SubmodelElement` where only the id attribute is set
Creates an example empty :class:`~basyx.aas.model.submodel.Submodel` where only the id attribute is set
:return: example submodel
"""
Expand All @@ -173,7 +173,7 @@ def create_example_asset_administration_shell() -> \
model.AssetAdministrationShell:
"""
Creates an example :class:`~basyx.aas.model.aas.AssetAdministrationShell` containing references to the example,
the example :class:`~Submodels <basyx.aas.model.submodel.SubmodelElement>`.
the example :class:`~Submodels <basyx.aas.model.submodel.Submodel>`.
:return: example asset administration shell
"""
Expand Down
6 changes: 3 additions & 3 deletions basyx/aas/examples/data/example_aas_missing_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def create_full_example() -> model.DictObjectStore:
"""
Creates an :class:`~basyx.aas.model.provider.DictObjectStore` containing an example :class:`~basyx.aas.model.submodel.SubmodelElement`,
Creates an :class:`~basyx.aas.model.provider.DictObjectStore` containing an example :class:`~basyx.aas.model.submodel.Submodel`,
an example :class:`~basyx.aas.model.concept.ConceptDescription` and an example
:class:`~basyx.aas.model.aas.AssetAdministrationShell`
Expand All @@ -34,7 +34,7 @@ def create_full_example() -> model.DictObjectStore:

def create_example_submodel() -> model.Submodel:
"""
Creates an example :class:`~basyx.aas.model.submodel.SubmodelElement` containing all kind of
Creates an example :class:`~basyx.aas.model.submodel.Submodel` containing all kind of
:class:`~basyx.aas.model.submodel.SubmodelElement` objects
:return: example submodel
Expand Down Expand Up @@ -359,7 +359,7 @@ def create_example_concept_description() -> model.ConceptDescription:
def create_example_asset_administration_shell() -> model.AssetAdministrationShell:
"""
Creates an example :class:`~basyx.aas.model.aas.AssetAdministrationShell` containing a reference to an example
:class:`~basyx.aas.model.submodel.SubmodelElement`
:class:`~basyx.aas.model.submodel.Submodel`
:return: example asset administration shell
"""
Expand Down
4 changes: 2 additions & 2 deletions basyx/aas/examples/data/example_submodel_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# SPDX-License-Identifier: MIT
"""
Module for the creation of an example :class:`~basyx.aas.model.submodel.SubmodelElement` template containing all kind of
Module for the creation of an example :class:`~basyx.aas.model.submodel.Submodel` template containing all kind of
:class:`SubmodelElements <basyx.aas.model.submodel.SubmodelElement>` where the kind is
always `TEMPLATE`.
"""
Expand All @@ -20,7 +20,7 @@

def create_example_submodel_template() -> model.Submodel:
"""
Creates an example :class:`~basyx.aas.model.submodel.SubmodelElement` template containing all kind of
Creates an example :class:`~basyx.aas.model.submodel.Submodel` template containing all kind of
:class:`~basyx.aas.model.submodel.SubmodelElement` objects where the kind is always
`TEMPLATE`
Expand Down
2 changes: 1 addition & 1 deletion basyx/aas/model/aas.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AssetAdministrationShell(base.Identifiable, base.UniqueIdShortNamespace, b
:ivar administration: :class:`~basyx.aas.model.base.AdministrativeInformation` of an
:class:`~.basyx.aas.model.base.Identifiable` element. (inherited from
:class:`~basyx.aas.model.base.Identifiable`)
:ivar ~.submodel: Unordered list of :class:`submodels <basyx.aas.model.submodel.SubmodelElement>` to describe typically the asset
:ivar ~.submodel: Unordered list of :class:`submodels <basyx.aas.model.submodel.Submodel>` to describe typically the asset
of an AAS. (Initialization-parameter: `submodel_`)
:ivar derived_from: The :class:`reference <basyx.aas.model.base.ModelReference>` to the AAS the AAs was derived from
:ivar embedded_data_specifications: List of Embedded data specification.
Expand Down
2 changes: 1 addition & 1 deletion basyx/aas/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class KeyTypes(Enum):
:cvar ASSET_ADMINISTRATION_SHELL: :class:`~basyx.aas.model.aas.AssetAdministrationShell`
:cvar CONCEPT_DESCRIPTION: :class:`~basyx.aas.model.concept.ConceptDescription`
:cvar SUBMODEL: :class:`~basyx.aas.model.submodel.SubmodelElement`
:cvar SUBMODEL: :class:`~basyx.aas.model.submodel.Submodel`
**ReferableElements starting from 1000**
Expand Down
4 changes: 2 additions & 2 deletions basyx/aas/util/traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def walk_submodel(collection: Union[model.Submodel, model.SubmodelElementCollect
-> Iterator[model.SubmodelElement]:
"""
Traverse the :class:`SubmodelElements <basyx.aas.model.submodel.SubmodelElement>` in a
:class:`~basyx.aas.model.submodel.SubmodelElement`, :class:`~basyx.aas.model.submodel.SubmodelElementCollection` or a
:class:`~basyx.aas.model.submodel.Submodel`, :class:`~basyx.aas.model.submodel.SubmodelElementCollection` or a
:class:`~basyx.aas.model.submodel.SubmodelElementList` recursively in post-order tree-traversal.
This is a generator function, yielding all the :class:`SubmodelElements <basyx.aas.model.submodel.SubmodelElement>`.
Expand All @@ -33,7 +33,7 @@ def walk_submodel(collection: Union[model.Submodel, model.SubmodelElementCollect

def walk_semantic_ids_recursive(root: model.Referable) -> Iterator[model.Reference]:
"""
Traverse an AAS object hierarchy (e.g. a :class:`~basyx.aas.model.submodel.SubmodelElement` with all recursively contained
Traverse an AAS object hierarchy (e.g. a :class:`~basyx.aas.model.submodel.Submodel` with all recursively contained
:class:`SubmodelElements <basyx.aas.model.submodel.SubmodelElement>`) recursively and return all non-empty (!= None)
semanticIds.
Expand Down

0 comments on commit 4567870

Please sign in to comment.