How to express semantics of unordered groups

I'd like to consider this concept as a way to express the semantics in DFDL of unordered groups. The approach is to use source language transformation. Here's an example of an unordered sequence of 2 elements: <xs:element name="n1"> <xs:complexType> <xs:sequence dfdl:unordered='true' separator=","> <xs:element name="s1" type="string" dfdl:initiator="s1:" /> <xs:element name="s2" type="int" dfdl:initiator="s2:"/> </xs:sequence> </xs:complexType> </xs:element> We explain what this means by indicating that it behaves like this rewrite: <xs:element name="n1"> <xs:annotation><xs:appinfo source=....> <dfdl:format validation="cardinality(./s1) <= 1 & cardinality(./s2) <= 1"/> </xs:appinfo></xs:annotation> <xs:complexType> <xs:sequence' separator=","> <xs:choice> <xs:sequence> <xs:element name="s1Initiator" type="xs:string" fixed="s1:"/> <xs:element name="s1" type="xs:string" /> </xs:sequence> <xs:sequence> <xs:element name="s2Initiator" type="xs:string" fixed="s2:"/> <xs:element name="s2" type="xs:int" /> </xs:sequence> <xs:sequence /> <!-- empty --> </xs:choice> <xs:choice> <xs:sequence> <xs:element name="s1Initiator" type="xs:string" fixed="s1:"/> <xs:element name="s1" type="xs:string" /> </xs:sequence> <xs:sequence> <xs:element name="s2Initiator" type="xs:string" fixed="s2:"/> <xs:element name="s2" type="xs:int" /> </xs:sequence> <xs:sequence /> <!-- empty --> </xs:choice> </xs:sequence> </xs:complexType> </xs:element> The above is probably missing a DFDL annotation indicating that the discrimination of the choice is done using the s1Initiator and s2Initiator fields based on their parsing correctly w.r.t. their fixed value facet. In XSD, unordered sequences (aka "all" groups) also have the semantics that each element can occur only zero or 1 time. This is modeled by the additional validation constraint you find at the top of the rewritten form. This isn't the only choice for semantics of unordered groups of course, but it is one coherent position on it. I think it is very attractive to reduce the issue of initiator-based unordered sequences to choice and discrimination, since we need those constructs no matter what. Comments? ...mikeb
participants (1)
-
Mike Beckerle