Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace vectorBaseTypes with xsd:list #808

Open
MarAlder opened this issue Dec 15, 2022 · 0 comments
Open

Replace vectorBaseTypes with xsd:list #808

MarAlder opened this issue Dec 15, 2022 · 0 comments
Milestone

Comments

@MarAlder
Copy link
Collaborator

MarAlder commented Dec 15, 2022

Relates to: #806

In the current CPACS, most vectors are based on the stringVectorBaseType. Some have already been set on a derived doubleVectorBaseType which emulates semicolon-separated elements of type Double via complex regex keys.

The use of regex is not very robust, as it is difficult to impossible to map and validate certain types of data. For example, we cannot validate vectors that contain uID references.

This can be solved by using xsd:list, sometimes in combination with regex. I therefore propose to introduce new vector types (neglecting the annotations). xsd:list vectors are separated by a space. See cpacs4 branch for example files.

Double type vectors:

<xsd:simpleType name="doubleVectorType">
    <xsd:list itemType="xsd:double"/>
</xsd:simpleType>

String vectors:

<xsd:simpleType name="stringVectorType">
    <xsd:list itemType="xsd:string"/>
</xsd:simpleType>

This validates the uID-references in the vector; pretty cool 😏:

<xsd:simpleType name="uidRefVectorType">
    <xsd:list itemType="xsd:IDREF"/>
</xsd:simpleType>

Integer vectors:

<xsd:simpleType name="integerVectorType">
    <xsd:list itemType="xsd:integer"/>
</xsd:simpleType>

The indexVectorType ensures that indices are counting from 1, not from zero. However, this needs to be realized by regex pattern:

<xsd:simpleType name="indexVectorType">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="([1-9][0-9]*([\s]+[1-9][0-9]*)*)"/>
    </xsd:restriction>
</xsd:simpleType>

Same with restrictions (unless someone finds a better solution at stackoverflow):

<xsd:element name="wayPointType">
    <xsd:simpleType>
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="(flyOver|flyBy)( (flyOver|flyBy))*"/>
        </xsd:restriction>
    </xsd:simpleType>
</xsd:element>
@MarAlder MarAlder added this to the cpacs 4.0 milestone Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant