Description
As many of you probably know, the order in which facets appears in applicability is predefined. On the first glance this is the same for the requirements, but it's not as easy as it appears.
// Excerpt from ids.xsd
<xs:sequence maxOccurs="unbounded">
<xs:element name="entity" minOccurs="0">...</xs:element>
<xs:element name="partOf" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="classification" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="attribute" minOccurs="0" maxOccurs="unbounded">...</xs:element>
<xs:element name="property" minOccurs="0" maxOccurs="unbounded">...</xs:element>
<xs:element name="material" minOccurs="0" maxOccurs="unbounded">...</xs:element>
</xs:sequence>
Notice that on the xs:sequence we have maxOccurs="unbounded"
this enables the sequence to be repeated as many times as we want to. Combining this with optional elements inside the sequence, it's now possible to have ids files with orders which look different, but still are compliant.
This makes it not only possible to repeat the entity facet more than once inside the requirements, but also enables the user to ignore the ordering of the xs:sequence
:
<ids:requirements>
<ids:property>...</ids:property>
<ids:material>...</ids:material>
<ids:partOf>...</ids:partOf>
<ids:material>...</ids:material>
<ids:partOf>...</ids:partOf>
</ids:requirements>
Audit runs fine:
=== ids-tool - utility tool for buildingSMART IDS files.
info: idsTool.Program[0] Auditing: Ids structure, Ids content.
info: idsTool.Program[0] Auditing file: `/Users/niklaspor/Documents/GitHub/IDS-Audit-tool/ordering-test.ids`.
info: idsTool.Program[0] The file schema version is: Ids1_0
info: idsTool.Program[0] Completed reading 69 xml elements.
info: idsTool.Program[0] Completed with status: Ok.
I think this is rather confusing for the implementer / user. Inside the applicabilityType
the order is required and enforced. Inside the requirementsType
it look on the first glance like it's supposed to be ordered (xs:sequence
) while in reality you can use any order.
As it was an explicit decision to use xs:sequence
to "produce the text version of the content in a reliable and consistent way" (comment from @CBenghi ) I think it would be favorable to remove the maxOccurs="unbounded"
from the requirementsType
once the next breaking & major version of the schema is released.
If I'm missing any reason for the maxOccurs="unbounded"
please tell me, I could not find anything while searching through issues & docs. Thanks for taking the time to read through this 👋