Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model: Allow empty strings in SubmodelElement.value #242

Open
WelliSolutions opened this issue Feb 27, 2024 · 1 comment
Open

model: Allow empty strings in SubmodelElement.value #242

WelliSolutions opened this issue Feb 27, 2024 · 1 comment
Labels
bug Something isn't working v3.0

Comments

@WelliSolutions
Copy link

AAS before processing with Basyx: it has an empty manufacturer name:
image

AAS after processing with Basyx: the manufacturer name is gone:
image

So, basically the difference is between "" (empty string) and None (null).

IMHO, the cause is in line 219 of xml_deserialization.py

Proposed fix:

    if element is None:
        return None
    return element.text if element.text is not None else ""
@s-heppner
Copy link
Contributor

I see what the problem is there.

Before version 3.0 of the specification, there existed a constraint:

Constraint AASd-100: An attribute with data type "string" is not allowed to be empty

However, that constraint has been removed with v3.0:

AASd-100 Removed: Since new string types with length constraints were added, this constraint is no longer needed

So, the idea behind the removal was, that it already exists implicitly in every data type that is based on string anyway.
However, such constraint appears to have been forgotten with the most basic xs:String.

Semantically, it is unclear what is meant with an empty string "" in comparision to a None, therefore we (and the specification as well) did not allow it.
Due to the fact, that the behavior of the function you provided is expected in every case except for values of SubmodelElements, your fix sadly is not sufficient.

In order to be fully compliant to the specification, I will convert your Issue to a Bug and we will fix it for v3.0
However, I will also bring this issue up with the specification group.

Thanks for helping to uncover this issue!

@s-heppner s-heppner added bug Something isn't working v3.0 labels Mar 2, 2024
@s-heppner s-heppner changed the title Basyx library loses empty string values model: Allow empty strings in SubmodelElement.value Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v3.0
Projects
None yet
Development

No branches or pull requests

2 participants