Skip to content

Add setter-functions for object attributes that consist of NamespaceSets #65

Description

@s-heppner

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement of an existing featuresdkSomething to do with the `sdk` package

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions