-
Notifications
You must be signed in to change notification settings - Fork 28
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
aasx.adapter: fix semantic id type deserialization of ModelReference
#337
base: main
Are you sure you want to change the base?
aasx.adapter: fix semantic id type deserialization of ModelReference
#337
Conversation
968597b
to
9f0dea6
Compare
logger.warning("type %s of last key of reference to %s does not match reference type %s", | ||
keys[-1].type.name, " / ".join(str(k) for k in keys), type_.__name__) | ||
return object_class(tuple(keys), type_, cls._construct_reference(_get_ts(dct, 'referredSemanticId', dict)) | ||
return object_class(tuple(keys), last_key_type, | ||
cls._construct_reference(_get_ts(dct, 'referredSemanticId', dict)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this won't introduce side effects, as the _construct_model_reference
method is used frequently.
We could addittionaly add a check and fallback to type_
if last_key_type
is type(None)
.
Thank you very much for your input! I agree that our SDK should not discard content without warning when reading and writing again, so that is definitly something that needs to be addressed. Regarding your suggestions: I need to do some more thinking about which solution is the one with the least repercussions. I'll bring this discussion to our dev meeting and will get back to you. |
Thanks for investigating the topic so far! |
904e747
to
381d6a9
Compare
I added a test that covers all semantic ids that are expected to be ModelReferences for the same type. |
This is what we concluded in our meeting:
Sadly, I did not have time yet to look deeper into the matter. |
766c5d4
to
ee006dc
Compare
ee006dc
to
a441d20
Compare
I rebased on main and changed to a re-raise for those cases. It will raise an error if the reference is a This will still not check if
|
Many AASX packages include semantic ids with external or model references.
Concept descriptions are lost when reading and writing back to AASX
Problem
When a semantic id with a
ModelReference
is deserialized itstype
is currently set to the abstract typeReferable
.When the aasx is serialized again and the semantic id refers to a concept description, it is skipped, because only concrete
ModelReference
types are looked up and serialized.Solutions
type
of the semantic id to the concrete type determined by the last key element.Writing aasx with external references as semantic ids produce many info logs
Problem
Often an external reference with a global id (e.g. to ECLASS IRDIs) is used as semantic id.
A typical technical data submodel may easily contain around 100 of them.
Writing to an aasx will print an info message for each semantic id, that is not a model reference to an concept description, which clutters the output.
Solutions