NeTEx-CEN / NeTEx

NeTEx is a CEN Technical Standard for exchanging Public Transport schedules and related data.
http://netex-cen.eu
GNU General Public License v3.0
81 stars 39 forks source link

GaragePoint not accepted as TimingPoint in ServiceFrame #131

Closed hennoit closed 3 years ago

hennoit commented 3 years ago

A GaragePoint (or ParkingPoint or ReliefPoint) is derived from a TimingPoint and belongs to that substitutionGroup (TimingPoint_).

<xsd:element name="GaragePoint" abstract="false" substitutionGroup="ParkingPoint_" .../> <xsd:element name="ParkingPoint_" type="ReliefPoint_VersionStructure" abstract="true" substitutionGroup="ReliefPoint_" .../> <xsd:element name="ReliefPoint_" type="TimingPoint_VersionStructure" abstract="true" substitutionGroup="TimingPoint_" .../>

<xsd:element name="TimingPoint" abstract="false" substitutionGroup="TimingPoint_" .../>

Therefore I would expect that in a ServiceFrame 'GaragePoint' could be used instead of 'TimingPoint' in the 'timingPoints' structure:

<xsd:complexType name="timingPointsInFrame_RelStructure"> <xsd:complexContent> <xsd:extension base="containmentAggregationStructure"> <xsd:sequence> <xsd:element ref="TimingPoint" maxOccurs="unbounded"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType>

This is not accepted however, and I cannot figure out why not.

                <timingPoints>
                    <TimingPoint id="xxx:TimingPoint:tp1" version="any">
                        <Name>tp1</Name>
                        <PointNumber>1001</PointNumber>
                    </TimingPoint>
                    <GaragePoint id="xxx:GaragePoint:gp4" version="any">
                        <Name>gp4</Name>
                        <PointNumber>1004</PointNumber>
                    </GaragePoint>
                </timingPoints>

_Element 'GaragePoint' is not allowed under element 'timingPoints'. Reason: The following elements are expected at this location: 'TimingPoint' Error location: PublicationDelivery/dataObjects/CompositeFrame/frames/ServiceFrame/timingPoints/GaragePoint Details: cvc-complex-type.1.4: Element 'GaragePoint' unexpected by type 'timingPointsInFrameRelStructure' of element 'timingPoints'.

Aurige commented 3 years ago

I would have guess some include issues in netex_serviceFrame_version.xsd .... but I just tried and that doesn't solve the issue

skinkie commented 3 years ago

@hennoit garagepoints are under InfrastructureFrame/vehicleAndCrewPoints. I don't think it is correct that you have placed them under timingPoints, because you wouldn't also put a ScheduledStopPoint there.

nick-knowles commented 3 years ago

The hierarchy is _DataManagedPoint/TimingPoint/ReliefPoint/ParkingPoint/GaragePoint so it should be allowed.

In the XML TimingPoint/ReliefPoint/ParkingPoint/GaragePoint are indeed defined as successive specialisations.....

However, the problem is to do with substitution groups. There is some weirdness in the implementation of substitution groups (or maybe even in the W3C type system definition) such that sometimes the validator refuses to accept the specifcation of a superclass as the substitution group for a subclass, even though the subclass is apparenty type conformant (i.e. does not remove attributes or elements and is not more restrictive on attribute values). To work around this, one can define a dummy superclass (By Convention the names end in an underscore '_', e.g. TimingPoint _) and use that instead to establish a dummy hierarchy.

In this case , for example TimingPoint_ /ReliefPoint /ParkingPoint /GaragePoint_

The mystifying thing is that in some cases it does work (i.e.. one doesn't need dummy substitution groups) and I have never been able to characterise what it is that the validator doesn't like. (It my be something to do with the formal XML type substitution rules, with subtly different namespaces, or a limitation or bug in XML SPY on the number of levels it can cope with). It seems to happen in particular when the subclass is more than two or three levels deep and is in a different file.

So the specific problem here is that for the structure (ie _timingLinksRelStructure) used in a TimingPattern to specify the points , instead of TimingPoint it should be specifying a type of TimingPoint_ (which would allow the full hierarcjy

``

:::::::: ::::::::::::: :::::::::::::::: :::::::::::::::::::: ::::::::::::::::</xsd:sequence> ::::::::::::</xsd:extension> ::::</xsd:complexContent> </xsd:complexType> `` Alternatively one could make it a choice between a TimingLink and a ReliefPoint_

hennoit commented 3 years ago

I see that Nick has already created pr #133 to solve this. Thanks for the quick response!

hennoit commented 3 years ago

@hennoit garagepoints are under InfrastructureFrame/vehicleAndCrewPoints. I don't think it is correct that you have placed them under timingPoints, because you wouldn't also put a ScheduledStopPoint there.

Stefan's point is also valid. I overlooked that occurrence apparently.