OAGi / Score

Score
MIT License
9 stars 6 forks source link

Express Set of BIEs in Less Repetitive XML Schema Pattern than Russian Doll #1631

Open lmkennethburnett opened 3 months ago

lmkennethburnett commented 3 months ago

Being able to express a package of BIEs in a non-repetitive XML Schema pattern such as Garden of Eden can greatly reduce file size and may be required by some systems that send/receive XML BODs. We will develop and append some examples of what the output might look like for further discussion.

lmkennethburnett commented 1 month ago

Ideally we will have a minimal output that avoids duplicating type definitions. For example this simple pair of BIEs which are currently expressed as:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.openapplications.org/oagis/10"
            targetNamespace="http://www.openapplications.org/oagis/10" elementFormDefault="qualified"
            attributeFormDefault="unqualified">
    <xsd:element name="NotifyPartList">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="1" name="ApplicationArea">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element minOccurs="0" maxOccurs="1" name="Sender">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="ID" minOccurs="0" maxOccurs="unbounded"
                                                     type="type_277fd64b9f414e90a228bd2c18d19e20"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element minOccurs="0" maxOccurs="unbounded" name="Receiver">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="ID" minOccurs="0" maxOccurs="unbounded"
                                                     type="type_9ca98a41cd444329b5caf4b1adb411df"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element name="CreationDateTime" minOccurs="1" maxOccurs="1"
                                         type="type_e57429e9f3f9402cb11b3667cb935f95"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element minOccurs="1" maxOccurs="1" name="DataArea">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element minOccurs="1" maxOccurs="1" name="Notify">
                                <xsd:complexType/>
                            </xsd:element>
                            <xsd:element minOccurs="1" maxOccurs="unbounded" name="PartList">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="DocumentDateTime" nillable="true" minOccurs="0" maxOccurs="1"
                                                     type="type_f96c8aeb75f144038f531eb58a583813"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
            <xsd:attribute name="releaseID" use="required" type="type_2c52deaa51ac40a192677ecf6f9d0b70"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="type_2c52deaa51ac40a192677ecf6f9d0b70">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="3"/>
            <xsd:maxLength value="7"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_277fd64b9f414e90a228bd2c18d19e20">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="5"/>
            <xsd:maxLength value="5"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_9ca98a41cd444329b5caf4b1adb411df">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="5"/>
            <xsd:maxLength value="5"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_e57429e9f3f9402cb11b3667cb935f95">
        <xsd:restriction base="xsd:dateTime">
            <xsd:pattern value="\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?(Z|[\-\+]\d\d:\d\d)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_f96c8aeb75f144038f531eb58a583813">
        <xsd:restriction base="xsd:dateTime">
            <xsd:pattern value="\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?(Z|[\-\+]\d\d:\d\d)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:element name="ProcessItemMaster">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="1" name="ApplicationArea">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element minOccurs="0" maxOccurs="1" name="Sender">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="ID" nillable="true" minOccurs="0" maxOccurs="unbounded"
                                                     type="type_26443cc37f464f90878d93f5e74ca383"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element minOccurs="0" maxOccurs="unbounded" name="Receiver">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="ID" nillable="true" minOccurs="0" maxOccurs="unbounded"
                                                     type="type_a25e058b8f5e429ba8e60ca51bbda338"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element name="CreationDateTime" minOccurs="1" maxOccurs="1"
                                         type="type_ebc88a2b9f4240f09bc82dd4fac8248c"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element minOccurs="1" maxOccurs="1" name="DataArea">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element minOccurs="1" maxOccurs="1" name="Process">
                                <xsd:complexType/>
                            </xsd:element>
                            <xsd:element minOccurs="1" maxOccurs="unbounded" name="ItemMaster">
                                <xsd:complexType/>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
            <xsd:attribute name="releaseID" use="required" type="type_f571240a4c3545f980914b332e391023"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="type_f571240a4c3545f980914b332e391023">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="3"/>
            <xsd:maxLength value="7"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_26443cc37f464f90878d93f5e74ca383">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="5"/>
            <xsd:maxLength value="5"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_a25e058b8f5e429ba8e60ca51bbda338">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="5"/>
            <xsd:maxLength value="5"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_ebc88a2b9f4240f09bc82dd4fac8248c">
        <xsd:restriction base="xsd:dateTime">
            <xsd:pattern value="\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?(Z|[\-\+]\d\d:\d\d)"/>
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>

would become something like:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.openapplications.org/oagis/10"
            targetNamespace="http://www.openapplications.org/oagis/10" elementFormDefault="qualified"
            attributeFormDefault="unqualified">
    <xsd:element name="NotifyPartList">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="1" name="ApplicationArea"
                             type="type_3440ab92b6fd46febaaffa6542534f1a">
                </xsd:element>
                <xsd:element minOccurs="1" maxOccurs="1" name="DataArea" type="type_5c84ec51e5804360b9fbfe0bc8590338">
                </xsd:element>
            </xsd:sequence>
            <xsd:attribute name="releaseID" use="required" type="type_2c52deaa51ac40a192677ecf6f9d0b70"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ProcessItemMaster">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element minOccurs="1" maxOccurs="1" name="ApplicationArea"
                             type="type_3440ab92b6fd46febaaffa6542534f1a">
                </xsd:element>
                <xsd:element minOccurs="1" maxOccurs="1" name="DataArea"
                             type="type_d055fa23-00c0-4280-94cf-a98bed9a19d2">
                </xsd:element>
            </xsd:sequence>
            <xsd:attribute name="releaseID" use="required" type="type_2c52deaa51ac40a192677ecf6f9d0b70"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:complexType name="type_3440ab92b6fd46febaaffa6542534f1a">
        <xsd:sequence>
            <xsd:element minOccurs="0" maxOccurs="1" name="Sender" type="type_71924d1070a14399b7ea6289729b926b">
            </xsd:element>
            <xsd:element minOccurs="0" maxOccurs="unbounded" name="Receiver"
                         type="type_71924d1070a14399b7ea6289729b926b">
            </xsd:element>
            <xsd:element name="CreationDateTime" minOccurs="1" maxOccurs="1"
                         type="type_e57429e9f3f9402cb11b3667cb935f95"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="type_5c84ec51e5804360b9fbfe0bc8590338">
        <xsd:sequence>
            <xsd:element minOccurs="1" maxOccurs="1" name="Notify">
                <xsd:complexType/>
            </xsd:element>
            <xsd:element minOccurs="1" maxOccurs="unbounded" name="PartList">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="type_d055fa23-00c0-4280-94cf-a98bed9a19d2">
        <xsd:sequence>
            <xsd:element minOccurs="1" maxOccurs="1" name="Process">
                <xsd:complexType/>
            </xsd:element>
            <xsd:element minOccurs="1" maxOccurs="unbounded" name="ItemMaster">
                <xsd:complexType/>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="type_71924d1070a14399b7ea6289729b926b">
        <xsd:sequence>
            <xsd:element name="ID" minOccurs="0" maxOccurs="unbounded" type="type_277fd64b9f414e90a228bd2c18d19e20"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:simpleType name="type_2c52deaa51ac40a192677ecf6f9d0b70">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="3"/>
            <xsd:maxLength value="7"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_277fd64b9f414e90a228bd2c18d19e20">
        <xsd:restriction base="xsd:normalizedString">
            <xsd:minLength value="5"/>
            <xsd:maxLength value="5"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="type_e57429e9f3f9402cb11b3667cb935f95">
        <xsd:restriction base="xsd:dateTime">
            <xsd:pattern value="\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?(Z|[\-\+]\d\d:\d\d)"/>
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>

That is, if the contents of a complex or simple type definition would be identical to an already existing type then the existing type is reused. Also it might be desirable to have all of the type definitions in a separate file referenced by an include.

Just one idea, other suggestions?