When instantiating an AssetAdministrationShell-object, we hand over ConceptDictionarys in any kind of Iterable (See here)
def __init__(self,
...
concept_dictionary: Iterable[concept.ConceptDictionary] = (),
...):
However, internally, we create a NamespaceSet containing these ConceptDictionarys in order to be able to resolve them later:
self.concept_dictionary: base.NamespaceSet[concept.ConceptDictionary] = \
base.NamespaceSet(self, concept_dictionary)
Now, if a user were to only look at the initialization parameters, and wanted to add a ConceptDictionary later, after initalization, they could theoretically assume, they could set it like this:
my_aas.concept_dictionary = [my_concept_dictionary]
This would have terrible results when iterating over ObjectStores containing these objects, since suddenly, we'd get the (not very helpful) error:
AttributeError: 'list' object has no attribute 'update_nss_from'
This obviously points nowhere in the right direction.
I have the suspicion, that this is not the only time, where such a problem may arise. How can we restrrict the user from making such a mistake in the first place? Should we write getter and setter functions for these kinds of attributes? On the other hand, maybe this is something to be checked by the ObjectStore, when adding an item to it?
When instantiating an
AssetAdministrationShell-object, we hand overConceptDictionarys in any kind ofIterable(See here)However, internally, we create a
NamespaceSetcontaining theseConceptDictionarys in order to be able to resolve them later:Now, if a user were to only look at the initialization parameters, and wanted to add a
ConceptDictionarylater, after initalization, they could theoretically assume, they could set it like this:This would have terrible results when iterating over
ObjectStores containing these objects, since suddenly, we'd get the (not very helpful) error:This obviously points nowhere in the right direction.
I have the suspicion, that this is not the only time, where such a problem may arise. How can we restrrict the user from making such a mistake in the first place? Should we write getter and setter functions for these kinds of attributes? On the other hand, maybe this is something to be checked by the
ObjectStore, when adding an item to it?