Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Internal reference validation #6

@skinkie

Description

@skinkie

One of the things that currently seem to lack in the xml schema is the validation of the semantics of a NeTEx document. What I mean here is that a certain object types may refer to another (strict) object type which should fail in the XSD validation, when incorrect. An example of such reference can be found below.

The PointProjectionRef refers to a RoutePoint, there isn't any logic that nameOfRefClass would limit the reference made from this entity to the foreign entity. One would expect that the nameOfRefClass should be defined in the scope of this object. Hence a PointProjectionRef must only refer to object of class of Point. xs:keyref should facilitate this effort. http://docstore.mik.ua/orelly/xml/schema/ch09_03.htm

Secondary the reference itself is not to be present in the document and/or to be unique. If we consider the parent type of all ObjectIds we end up with an xsd:normalizedString. This would lead to the use of xs:ID upon definition and xs:IDREF upon reference.
http://docstore.mik.ua/orelly/xml/schema/ch09_01.htm

The XML Source.

<PointProjectionRef nameOfRefClass="RoutePoint" ref="NDOV:RP:NL:Q:36002156"/>

And the XML Schema's:

    <xsd:simpleType name="PointProjectionIdType">
        <xsd:annotation>
            <xsd:documentation>Type for identifier of a POINT PROJECTION.</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="ProjectionIdType"/>
    </xsd:simpleType>
    <xsd:element name="PointProjectionRef" type="PointProjectionRefStructure" substitutionGroup="ProjectionRef">
        <xsd:annotation>
            <xsd:documentation>Reference to a PROJECTION.</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:complexType name="PointProjectionRefStructure">
        <xsd:annotation>
            <xsd:documentation>Type for a reference to a POINT PROJECTION.</xsd:documentation>
        </xsd:annotation>
        <xsd:simpleContent>
            <xsd:restriction base="ProjectionRefStructure">
                <xsd:attribute name="ref" type="PointProjectionIdType" use="required">
                    <xsd:annotation>
                        <xsd:documentation>Identifier of a POINT PROJECTION.</xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:restriction>
        </xsd:simpleContent>
    </xsd:complexType>
    <xsd:element name="VersionOfObjectRef" type="VersionOfObjectRefStructure">
        <xsd:annotation>
            <xsd:documentation>Reference to a NeTEx Object .  i.e. concrete instance of an ENTITY  may include a version. Implements a one to one relationship by reference.</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:complexType name="VersionOfObjectRefStructure">
        <xsd:annotation>
            <xsd:documentation>Type for a versioned reference to a NeTEx Object.</xsd:documentation>
        </xsd:annotation>
        <xsd:simpleContent>
            <xsd:extension base="ObjectIdType">
                <xsd:attribute name="nameOfRefClass" type="NameOfClass" use="optional">
                    <xsd:annotation>
                        <xsd:documentation>Name of Class of the referenced entity. Allows reflection. Fixed for each entity type.</xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attributeGroup ref="ReferenceModificationDetailsGroup"/>
                <xsd:attribute name="ref" type="ObjectIdType" use="required">
                    <xsd:annotation>
                        <xsd:documentation>Identifier of referenced entity.</xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>
    <xsd:simpleType name="ObjectIdType">
        <xsd:annotation>
            <xsd:documentation>Abstract Type for identifier of a NeTEx Object.</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:normalizedString"/>
    </xsd:simpleType>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions