[QUESTION] What is a cannonical representation for SubmodelElementLists with property value = null?
According to meta model, submodel element lists may have a value = null, as value has a cardinality of 0..* (https://industrialdigitaltwin.io/aas-specifications/IDTA-01001/v3.1/spec-metamodel/submodel-elements.html#submodel-element-list-attributes) and the spec additionally forbids e.g. empty json lists. Same holds for XML.
This raises two questions:
- For Submodel Instances: Consider a SMT with an optional SubmodelElementList, that may be empty, i.e., a SubmodelElementList with Qualifier SMT/Cardinality of value ZeroToOne with list elements with Qualifier SMT/Cardinality of value ZeroToMany.
If in my Submodel Instance this list is empty. Should I skip the SubmodelElementList element altogether from my submodel, or should I include it, but set its "value" to null?
- For Submodel Templates: given, that SubmodelElementLists include significant descriptive information about its item type (valueTypeListElement, typeValueListElement, semanticIdListElement), do I always have to specify a list item in my SMT or not? If I not, is there a "default" SMT/Cardinality qualifier supposed for the items?
Using aas4j (for example) to generate a SM including a SML "without" value yields:
<aas:submodelElementList>
<aas:idShort>harting_sme_smlTest</aas:idShort>
<aas:orderRelevant>false</aas:orderRelevant>
<aas:typeValueListElement>Property</aas:typeValueListElement>
</aas:submodelElementList>
{
"modelType" : "SubmodelElementList",
"idShort" : "sme_smlTest",
"orderRelevant" : false,
"typeValueListElement" : "Property"
}
Regarding question 1: IMHO an optional SML (SMT/Cardinality = ZeroToOne) without any SMEs (value= null, resp. empty array) can be safely skipped. But, if you like, you can add the empty SML to your SM instance (see the two sample code blocks above). To my knowledge, there is no clear guideline here, which, in my opinion, is not absolutely necessary.
Regarding question 2: I'm not sure I understand you correctly, but in a SMT specification including a SML (whether if SMT/Cardinality of the SML is ZeroToOne or One) there should always be a specification of the list items (also whether if SMT/Cardinality of the SME is ZeroToOne or One.
Thanks for your reply. This mostly aligns with what I have seen and would have interpreted so far.
Regarding question 1: IMHO an optional SML (SMT/Cardinality = ZeroToOne) without any SMEs (
value= null, resp. empty array) can be safely skipped. But, if you like, you can add the empty SML to your SM instance (see the two sample code blocks above). To my knowledge, there is no clear guideline here, which, in my opinion, is not absolutely necessary.
The more I think about this, the more I feel like there should be a guideline for implementors, though; especially when different implementations handle empty lists differently. Consider the following situation (admittedly contrived, but even the spec mentioned nested SMLs):
You have an SMT with a list definition:
{
"modelType": "SubmodelElementList",
"typeValueListElement": "SubmodelElementList",
"qualifiers": [{
"type": "SMT/Cardinality",
"valueType": "xs:string",
"value": "ZeroToOne"
}],
"value": [{
"modelType": "SubmodelElementList",
"typeValueListElement": "Property",
"valueTypeListElement": "xs:string",
"qualifiers": [{
"type": "SMT/Cardinality",
"valueType": "xs:string",
"value": "OneToMany"
}],
"value": [{
"modelType": "SubmodelElementList",
"valueType": "xs:string",
"qualifiers": [{
"type": "SMT/Cardinality",
"valueType": "xs:string",
"value": "ZeroToMany"
}]
}]
}]
}
In this situation the decision whether an element should be elided if empty or not has a direct effect on the list position of subsequent elements. However, this also means the implementation needs to adjust any model references just for import/export.
@BirgitBoss what´s your opinion?
issue transferred from Questions and Answers to metamodel workstream
There are three relevant specifications in SMT:
The qualifier "OneToMany" (as used in https://github.com/admin-shell-io/aas-specs-metamodel/issues/644#issuecomment-3655285366) or "ZeroToMany" does not make any sense for a SML. In this case you would do a SML containing SML.
aas4j handels it the correct way (see https://github.com/admin-shell-io/aas-specs-metamodel/issues/644#issuecomment-3655285349).
In a way the current schema does not support SMT with "ZeroToMany" Elements within a SML. It only supports ZeroToOne for the complete list and then "OneToMany" for the elements within. In other words: empty lists are not supported. @s-heppner may you please check what it means to change the schema to allow empty lists?
This reminds me of the empty string vs missing string discussions like eclipse-basyx/basyx-python-sdk#242 (I could have sworn we also had these disucssions here, but can't find a relevant issue).
I agree with @empwilli that there should be a clear guideline on how to deal with empty lists in the implementation, considering it changes the modelReferences in the List of Lists example due to the shift in index.
Consider this example:
[ [list A], [list B] ]
Therefore, list B is at index 1 (starting at 0) of the outer list.
This means, the modelReference would be something like <identifier>.path.to.outer.list[1].
Now let's introduce an empty list:
[ [list A], [], [list B] ]
Simply by introducing the empty list, list B now jumped one index further in the outer list, and therefore the modelReference is now something like <identifier>.path.to.outer.list[2].
(Which is another example for why I proposed to reference objects by unique ids rather than list indexes, but that's beside the point).
@s-heppner may you please check what it means to change the schema to allow empty lists?
From a technical point of view, this shouldn't be too hard to change.
Still, I advocate to consider this carefully, since currently, the schema is clear in how you should write it down. If we loosen it, we might end up with broken modelReferences between implementations that handle this differently internally, even though they did everything correctly.
2026-01-21 Workstream AAS Specs
in Normal: [ [typeValueListElement: xsd:float value: 0.4], [ typeValueListElement: xsd:float] , [typeValueListElement: xsd:float value: 0.2 ]
in ValueOnly [ [0.4],[0.2 ] ] ==> index for 0.2 is different than in "Normal"
Optional elements (like for example globalAssetId for an Entity submodel element) with no value shall be omitted in the serialization.
Elements within a SML are neither optional nor mandatory per se. So in Value-Only all elements within a SML shall be displayed even if they are empty (handled as if they are mandatory). Documentation will be updated + example [ [list A], [], [list B] ] to make this clear. Rationale behind: index of elements within list shall not be changed and identical in Normal and Value-Only format,