aas-core-works / aas-core-meta

Provide formalized meta-models for Asset Administration Shell (AAS).
Other
9 stars 3 forks source link

ID-shorts of operation variables required? #253

Closed mristin closed 1 year ago

mristin commented 1 year ago

At the moment, operation variables can omit id_short in their value's:

class Operation_variable(DBC):
    """
    The value of an operation variable is a submodel element that is used as input
    and/or output variable of an operation.
    """

    value: "Submodel_element"
    """
    Describes an argument or result of an operation via a submodel element
    """

    def __init__(self, value: "Submodel_element") -> None:
        self.value = value

We merely check that the ID-shorts are unique, but not that they are not none in Operation:

# fmt: off
@invariant(
    lambda self:
    not (self.inoutput_variables is not None)
    or len(self.inoutput_variables) >= 1,
    "Inoutput variables must be either not set or have at least one item"
)
@invariant(
    lambda self:
    not (self.output_variables is not None)
    or len(self.output_variables) >= 1,
    "Output variables must be either not set or have at least one item"
)
@invariant(
    lambda self:
    not (self.input_variables is not None)
    or len(self.input_variables) >= 1,
    "Input variables must be either not set or have at least one item"
)
@invariant(
    lambda self:
    ID_shorts_of_variables_are_unique(
        self.input_variables,
        self.output_variables,
        self.inoutput_variables
    ),
    "Constraint AASd-134: For an Operation the ID-short of all values of "
    "input, output and in/output variables."
)
@reference_in_the_book(section=(5, 3, 7, 11))
# fmt: on
class Operation(Submodel_element):
    ...

IMO, there should be a constraint that ID-shorts are defined for value of each operation variable.

s-heppner commented 1 year ago

As I understand it, this is not explicitly required as per specification, but implicitly it is, considering the only time id_short is not required is in Submodel_element_list-objects. Also, logically, there's no sense in creating Submodel_elements without id_short in Operation_variable.value.

I think this boils down to a missing implementation of an invariant for constraint AASd-117:

Constraint AASd-117: id_short of non-Identifiable Referables not being a direct child of a Submodel_element_list shall be specified.

I'll try to solve this.