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
80 stars 39 forks source link

Understanding the implications of choice/groups #669

Open skinkie opened 7 months ago

skinkie commented 7 months ago

In the NeTEx schema choices are sometimes used as a container for groups. If we take a simple example like the CodeRangeGroup. It is to me unclear why a choice is actually used. Wasn't the intention to get the StartValue and EndValue? Or was the intention to choose from either of one.

https://github.com/NeTEx-CEN/NeTEx/blob/master/xsd/netex_framework/netex_genericFramework/netex_organisation_version.xsd#L786

Another variant can be observed in the AllSubmodeChoiceGroup. This variant expects the user to choose an element from either the PtSubmodeChoiceGroup or the PrivateSubmodeChoiceGroup.

https://github.com/NeTEx-CEN/NeTEx/blob/master/xsd/netex_framework/netex_reusableComponents/netex_submode_version.xsd#L86

A different variant of combinations appear in TargetPassingTimeGroup, ObservedPassingTimeGroup, EstimatedPassingTimeGroup. In my perspective these three objects are wrongfully using a choice.

https://github.com/NeTEx-CEN/NeTEx/blob/master/xsd/netex_part_2/part2_journeyTimes/netex_datedPassingTimes_version.xsd#L148 https://github.com/NeTEx-CEN/NeTEx/blob/master/xsd/netex_part_3/part3_monitoring/netex_monitoredPassingTimes_version.xsd#L148 https://github.com/NeTEx-CEN/NeTEx/blob/master/xsd/netex_part_3/part3_monitoring/netex_monitoredPassingTimes_version.xsd#L262

When we consider SiteConnectionEndStructure which gives us a choice of groups. In this case all sub elements, given they are part of the same group, may be added. Given that the groups are not elements, no natural grouping would surface. It wouldn't give the implementer any guidance if it would treat it with the same 'flattening' strategy as the AllSubmodeChoiceGroup. I guess we can agree 'this is something different', how to identify this difference is the question.

https://github.com/NeTEx-CEN/NeTEx/blob/master/xsd/netex_part_1/part1_tacticalPlanning/netex_siteConnection_version.xsd#L159

Given that the list of exceptions is rather small, would like this to be resolved. I have ignored SIRI for now.

ue71603 commented 7 months ago

What we need to have is a construction guide line. Also for the structs etc that Christophe and Nick usually use. The distribution between xxx_version.xsd and xxx_support.xsd etc. Perhaps we start with markdown in the NeTEx wiki. Or does something like that exist?

Aurige commented 6 months ago

in the CodeRangeGroup example, the choice is totally useless since it is a choice with 1 single element (the CodeRangeGroup .... the choice does not go through the Group, and it is not a choice between StartValue and EndValue). So this choice should be removed.

AllSubmodeChoiceGroup it is a way to combine 2 choices (PtSubmodeChoiceGroup and PrivateSubmodeChoiceGroup who are themselves choices) and the only way to do combine them to be a bigger choice is to include them in a choice.

For TargetPassingTimeGroup, it is either a TargetTimesAtStopGroup either a NonStopTimesAtStopGroup (the vehicle pass without stopping and just has a passing time) so it is perfectly Ok here.

And for the SiteConnectionEndStructure , the connection end is either a StopPlace (StopPlaceEndGroup), a PointOfInterest (PointOfInterestEndGroup) or a Parking (ParkingEndGroup)

So the first one is obviously a bug, but I don't see any ambiguity for the others.

ue71603 commented 5 months ago

@skinkie we just fix the first one? Or is something open?