diff --git a/sdk/basyx/aas/adapter/aasx.py b/sdk/basyx/aas/adapter/aasx.py index 1c27640fa..93cf01bbb 100644 --- a/sdk/basyx/aas/adapter/aasx.py +++ b/sdk/basyx/aas/adapter/aasx.py @@ -143,7 +143,20 @@ def read_into(self, object_store: model.AbstractObjectStore, try: aasx_origin_part = core_rels[RELATIONSHIP_TYPE_AASX_ORIGIN][0] except IndexError as e: - raise ValueError("Not a valid AASX file: aasx-origin Relationship is missing.") from e + if core_rels.get("http://www.admin-shell.io/aasx/relationships/aasx-origin"): + # Since there are many AASX files with this (wrong) relationship URls in the wild, we make an exception + # and try to read it anyway. However, we notify the user that this may lead to data loss, since it is + # highly likely that the other relationship URLs are also wrong in that file. + # See also [#383](https://github.com/eclipse-basyx/basyx-python-sdk/issues/383) for the discussion. + logger.warning("SPECIFICATION VIOLATED: The Relationship-URL in your AASX file " + "('http://www.admin-shell.io/aasx/relationships/aasx-origin') " + "is not valid, it should be 'http://admin-shell.io/aasx/relationships/aasx-origin'. " + "We try to read the AASX file anyway, but this cannot guaranteed in the future," + "and the file may not be fully readable, so data losses may occur." + "Please fix this and/or notify the source of the AASX.") + aasx_origin_part = core_rels["http://www.admin-shell.io/aasx/relationships/aasx-origin"][0] + else: + raise ValueError("Not a valid AASX file: aasx-origin Relationship is missing.") from e read_identifiables: Set[model.Identifier] = set()