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

"RefStructure" generic variant (VersionOfObjectRef) #407

Open skinkie opened 1 year ago

skinkie commented 1 year ago

At this point there are about 426 "*RefStructure" variants which model about the same attributes, some with marginal differences for example having the ref as a mandatory attribute. I would like to understand why this was not done via the SubstitutionGroup VersionOfObjectRef? Can we try to model this in NeTEx 2.0?

This would be my list of "issues".

access_equipment_ref_structure.py
accessibility_assessment_ref_structure.py
access_ref_structure.py
access_vehicle_equipment_ref_structure.py
accommodation_ref_structure.py
accountable_element_ref_structure.py
activated_equipment_ref_structure.py
activation_link_ref_structure.py
activation_point_ref_structure.py
all_countries_ref_structure.py
all_distribution_channels_ref_structure_element.py
all_organisations_ref_structure.py
allowed_line_direction_ref_structure.py
all_transport_organisations_ref_structure.py
alternative_name_ref_structure.py
alternative_text_ref_structure.py
amount_of_price_unit_product_ref_structure.py
assistance_booking_service_ref_structure.py
assistance_service_ref_structure.py
availability_condition_ref_structure.py
beacon_point_ref_structure.py
blacklist_ref_structure.py
block_part_ref_structure.py
block_ref_structure.py
border_point_ref_structure.py
cancelling_ref_structure.py
capped_discount_right_ref_structure.py
capping_rule_price_ref_structure.py
capping_rule_ref_structure.py
catering_service_ref_structure.py
cell_ref_structure.py
charging_moment_ref_structure.py
charging_policy_ref_structure.py
class_of_use_ref_structure.py
commercial_profile_eligibility_ref_structure.py
commercial_profile_ref_structure.py
common_section_ref_structure.py
communication_service_ref_structure.py
companion_profile_ref_structure.py
complaints_service_ref_structure.py
complex_feature_projection_ref_structure.py
composite_frame_ref_structure.py
compound_block_ref_structure.py
compound_train_ref_structure.py
connection_ref_structure.py
control_centre_ref_structure.py
controllable_element_price_ref_structure.py
controllable_element_ref_structure.py
coupled_journey_ref_structure.py
course_of_journeys_ref_structure.py
crossing_equipment_ref_structure.py
customer_account_ref_structure.py
customer_account_security_listing_ref_structure.py
customer_account_status_ref_structure.py
customer_eligibility_ref_structure.py
customer_purchase_package_element_access_ref_structure.py
customer_purchase_package_element_ref_structure.py
customer_purchase_package_price_ref_structure.py
customer_purchase_package_ref_structure.py
customer_ref_structure.py
customer_security_listing_ref_structure.py
customer_service_ref_structure.py
cycle_storage_equipment_ref_structure.py
data_source_ref_structure.py
dated_special_service_ref_structure.py
dated_vehicle_journey_ref_structure.py
day_type_ref_structure.py
dead_run_journey_pattern_ref_structure.py
dead_run_ref_structure.py
default_connection_ref_structure.py
default_dead_run_run_time_ref_structure.py
default_interchange_ref_structure.py
default_service_journey_time_ref_structure.py
delivery_variant_ref_structure.py
department_ref_structure.py
destination_display_ref_structure.py
destination_display_variant_ref_structure.py
direction_ref_structure.py
discounting_rule_ref_structure.py
distance_matrix_element_price_ref_structure.py
distance_matrix_element_ref_structure.py
distribution_channel_ref_structure_element.py
driver_ref_structure.py
driver_schedule_frame_ref_structure.py
driver_trip_ref_structure.py
driver_trip_time_ref_structure.py
duty_part_ref_structure.py
duty_ref_structure.py
eligibility_change_policy_ref_structure.py
entitlement_given_ref_structure.py
entitlement_product_ref_structure.py
entitlement_required_ref_structure.py
entrance_equipment_ref_structure.py
equipment_ref_structure.py
escalator_equipment_ref_structure.py
estimated_passing_time_ref_structure.py
exchanging_ref_structure.py
facility_ref_structure.py
facility_requirement_ref_structure.py
facility_set_ref_structure.py
fare_contract_entry_ref_structure.py
fare_contract_ref_structure.py
fare_contract_security_listing_ref_structure.py
fare_day_type_ref_structure.py
fare_demand_factor_ref_structure.py
fare_frame_ref_structure.py
fare_interval_ref_structure.py
fare_price_ref_structure.py
fare_product_price_ref_structure.py
fare_product_ref_structure.py
fare_quota_factor_ref_structure.py
fare_request_ref_structure.py
fare_scheduled_stop_point_ref_structure.py
fare_section_ref_structure.py
fare_structure_element_price_ref_structure.py
fare_structure_element_ref_structure.py
fare_structure_factor_ref_structure.py
fare_table_column_ref_structure.py
fare_table_row_ref_structure.py
fare_unit_ref_structure.py
flexible_line_ref_structure.py
flexible_link_properties_ref_structure.py
flexible_point_properties_ref_structure.py
flexible_service_properties_ref_structure.py
frequency_of_use_ref_structure.py
fulfilment_method_price_ref_structure.py
fulfilment_method_ref_structure.py
garage_point_ref_structure.py
general_frame_ref_structure.py
general_section_ref_structure.py
general_sign_ref_structure.py
geographical_interval_price_ref_structure.py
geographical_interval_ref_structure.py
geographical_structure_factor_ref_structure.py
geographical_unit_price_ref_structure.py
geographical_unit_ref_structure.py
group_ticket_ref_structure.py
heading_sign_ref_structure.py
help_point_equipment_ref_structure.py
hire_service_ref_structure.py
infrastructure_frame_ref_structure.py
infrastructure_link_ref_structure.py
infrastructure_point_ref_structure.py
installed_equipment_ref_structure.py
interchange_ref_structure.py
interchange_rule_ref_structure.py
interchange_rule_timing_ref_structure.py
interchanging_ref_structure.py
journey_meeting_ref_structure.py
journey_part_couple_ref_structure.py
journey_pattern_headway_ref_structure.py
journey_pattern_layover_ref_structure.py
journey_pattern_ref_structure.py
journey_pattern_run_time_ref_structure.py
journey_pattern_wait_time_ref_structure.py
journey_ref_structure.py
journey_timing_ref_structure.py
left_luggage_service_ref_structure.py
level_ref_structure.py
lift_equipment_ref_structure.py
limitation_ref_structure.py
limiting_rule_ref_structure.py
line_link_ref_structure.py
line_network_ref_structure.py
line_ref_structure.py
line_section_ref_structure.py
link_projection_ref_structure.py
link_ref_structure.py
link_sequence_projection_ref_structure.py
link_sequence_ref_structure.py
local_service_ref_structure.py
log_entry_ref_structure.py
logical_display_ref_structure.py
lost_property_service_ref_structure.py
luggage_allowance_ref_structure.py
luggage_locker_equipment_ref_structure.py
luggage_service_ref_structure.py
meeting_point_service_ref_structure.py
minimum_stay_ref_structure.py
money_service_ref_structure.py
month_validity_offset_ref_structure.py
navigation_path_ref_structure.py
notice_ref_structure.py
observed_passing_time_ref_structure.py
offered_travel_specification_ref_structure.py
onboard_stay_ref_structure.py
open_transport_mode_ref_structure.py
operating_day_ref_structure.py
operating_department_ref_structure.py
operating_period_ref_structure.py
operational_context_ref_structure.py
organisational_unit_ref_structure.py
organisation_part_ref_structure.py
parking_capacity_ref_structure.py
parking_charge_band_ref_structure.py
parking_point_ref_structure.py
parking_price_ref_structure.py
parking_properties_ref_structure.py
parking_tariff_ref_structure.py
passenger_capacity_ref_structure.py
passenger_carrying_requirement_ref_structure.py
passenger_equipment_ref_structure.py
passenger_information_equipment_ref_structure.py
passenger_information_request_ref_structure.py
passenger_safety_equipment_ref_structure.py
passenger_seat_ref_structure.py
passing_time_ref_structure.py
path_link_ref_structure.py
penalty_policy_ref_structure.py
place_lighting_equipment_ref_structure.py
place_sign_ref_structure.py
point_of_interest_classification_ref_structure.py
point_projection_ref_structure.py
point_ref_structure.py
preassigned_fare_product_ref_structure.py
priceable_object_ref_structure.py
price_unit_ref_structure.py
pricing_parameter_set_ref_structure.py
pricing_rule_ref_structure.py
pricing_service_ref_structure.py
projection_ref_structure.py
purchase_window_ref_structure.py
purpose_of_equipment_profile_ref_structure.py
purpose_of_grouping_ref_structure.py
purpose_of_journey_partition_ref_structure.py
quality_structure_factor_price_ref_structure.py
quality_structure_factor_ref_structure.py
queueing_equipment_ref_structure.py
railway_link_ref_structure.py
railway_point_ref_structure.py
ramp_equipment_ref_structure.py
refunding_ref_structure.py
relief_opportunity_ref_structure.py
relief_point_ref_structure.py
repeated_trip_fare_request_ref_structure.py
replacing_ref_structure.py
requested_travel_specification_ref_structure.py
reselling_ref_structure.py
reserving_ref_structure.py
residential_qualification_eligibility_ref_structure.py
residential_qualification_ref_structure.py
resource_frame_ref_structure.py
responsibility_role_ref_structure.py
responsibility_set_ref_structure.py
retail_device_ref_structure.py
retail_device_security_listing_ref_structure.py
retail_service_ref_structure.py
road_link_ref_structure.py
road_point_ref_structure.py
rough_surface_ref_structure.py
rounding_ref_structure.py
rounding_step_ref_structure.py
round_trip_ref_structure.py
route_instruction_ref_structure.py
route_link_ref_structure.py
route_point_ref_structure.py
route_ref_structure.py
routing_ref_structure.py
rubbish_disposal_equipment_ref_structure.py
sale_discount_right_ref_structure.py
sales_offer_package_element_ref_structure.py
sales_offer_package_entitlement_given_ref_structure.py
sales_offer_package_price_ref_structure.py
sales_offer_package_ref_structure.py
sales_transaction_frame_ref_structure.py
sales_transaction_ref_structure.py
sanitary_equipment_ref_structure.py
scheduled_stop_point_ref_structure.py
schedule_request_ref_structure.py
schematic_map_member_ref_structure.py
schematic_map_ref_structure.py
seating_equipment_ref_structure.py
section_ref_structure.py
security_listing_ref_structure.py
security_list_ref_structure.py
series_constraint_price_ref_structure.py
service_access_right_ref_structure.py
service_calendar_frame_ref_structure.py
service_calendar_ref_structure.py
service_facility_set_ref_structure.py
service_frame_ref_structure.py
service_journey_interchange_ref_structure.py
service_journey_pattern_interchange_ref_structure.py
service_journey_pattern_ref_structure.py
service_journey_ref_structure.py
service_link_ref_structure.py
service_pattern_ref_structure.py
shelter_equipment_ref_structure.py
single_trip_fare_request_ref_structure.py
site_connection_ref_structure.py
site_equipment_ref_structure.py
site_facility_set_ref_structure.py
site_frame_ref_structure.py
special_service_ref_structure.py
staircase_equipment_ref_structure.py
start_time_at_stop_point_ref_structure.py
step_limit_ref_structure.py
stop_event_request_ref_structure.py
stop_finder_request_ref_structure.py
stop_path_link_ref_structure.py
submode_ref_structure.py
subscribing_ref_structure.py
supplement_product_ref_structure.py
supply_contract_ref_structure.py
suspending_ref_structure.py
target_passing_time_ref_structure.py
tariff_ref_structure.py
template_service_journey_ref_structure.py
third_party_product_ref_structure.py
ticketing_equipment_ref_structure.py
ticketing_service_ref_structure.py
ticket_validator_equipment_ref_structure.py
timeband_ref_structure.py
time_demand_profile_ref_structure.py
time_demand_type_ref_structure.py
time_interval_price_ref_structure.py
time_interval_ref_structure.py
time_structure_factor_ref_structure.py
timetabled_passing_time_ref_structure.py
timetable_frame_ref_structure.py
time_unit_price_ref_structure.py
time_unit_ref_structure.py
timing_algorithm_type_ref_structure.py
timing_link_ref_structure.py
timing_pattern_ref_structure.py
timing_point_ref_structure.py
traffic_control_point_ref_structure.py
train_block_part_ref_structure.py
train_block_ref_structure.py
train_element_ref_structure.py
train_in_compound_train_ref_structure.py
train_number_ref_structure.py
train_ref_structure.py
transferability_ref_structure.py
transfer_ref_structure.py
travelator_equipment_ref_structure.py
travel_document_ref_structure.py
travel_document_security_listing_ref_structure.py
travel_specification_ref_structure.py
trip_plan_request_ref_structure.py
trolley_stand_equipment_ref_structure.py
turnaround_time_limit_time_ref_structure.py
type_of_access_right_assignment_ref_structure.py
type_of_activation_ref_structure.py
type_of_codespace_assignment_ref_structure.py
type_of_concession_ref_structure.py
type_of_congestion_ref_structure.py
type_of_customer_account_ref_structure.py
type_of_delivery_variant_ref_structure.py
type_of_equipment_ref_structure.py
type_of_facility_ref_structure.py
type_of_fare_contract_entry_ref_structure.py
type_of_fare_contract_ref_structure.py
type_of_fare_product_ref_structure.py
type_of_fare_structure_element_ref_structure.py
type_of_fare_structure_factor_ref_structure.py
type_of_fare_table_ref_structure.py
type_of_feature_ref_structure.py
type_of_flexible_service_ref_structure.py
type_of_frame_ref_structure.py
type_of_journey_pattern_ref_structure.py
type_of_line_ref_structure.py
type_of_link_ref_structure.py
type_of_link_sequence_ref_structure.py
type_of_machine_readability_ref_structure.py
type_of_notice_ref_structure.py
type_of_operation_ref_structure.py
type_of_organisation_part_ref_structure.py
type_of_organisation_ref_structure.py
type_of_passenger_information_equipment_ref_structure.py
type_of_payment_method_ref_structure.py
type_of_place_ref_structure.py
type_of_point_ref_structure.py
type_of_pricing_rule_ref_structure.py
type_of_product_category_ref_structure.py
type_of_projection_ref_structure.py
type_of_responsibility_role_ref_structure.py
type_of_retail_device_ref_structure.py
type_of_sales_offer_package_ref_structure.py
type_of_security_list_ref_structure.py
type_of_service_feature_ref_structure.py
type_of_service_ref_structure.py
type_of_tariff_ref_structure.py
type_of_time_demand_type_ref_structure.py
type_of_transfer_ref_structure.py
type_of_travel_document_ref_structure.py
type_of_usage_parameter_ref_structure.py
type_of_validity_ref_structure.py
type_of_value_ref_structure.py
type_of_version_ref_structure.py
type_of_zone_ref_structure.py
usage_discount_right_ref_structure.py
usage_parameter_price_ref_structure.py
usage_parameter_ref_structure.py
usage_validity_period_ref_structure.py
user_profile_eligibility_ref_structure.py
user_profile_ref_structure.py
validable_element_price_ref_structure.py
validable_element_ref_structure.py
validity_condition_ref_structure.py
validity_rule_parameter_ref_structure.py
validity_trigger_ref_structure.py
vehicle_charging_equipment_ref_structure.py
vehicle_equipment_profile_ref_structure.py
vehicle_equipment_ref_structure.py
vehicle_journey_ref_structure.py
vehicle_manoeuvring_requirement_ref_structure.py
vehicle_model_ref_structure.py
vehicle_position_alignment_ref_structure.py
vehicle_quay_alignment_ref_structure.py
vehicle_ref_structure.py
vehicle_requirement_ref_structure.py
vehicle_schedule_frame_ref_structure.py
vehicle_service_part_ref_structure.py
vehicle_service_ref_structure.py
vehicle_type_preference_ref_structure.py
vehicle_type_ref_structure.py
version_frame_ref_structure.py
version_of_object_ref_structure.py
version_ref_structure.py
waiting_equipment_ref_structure.py
wheelchair_vehicle_ref_structure.py
whitelist_ref_structure.py
wire_link_ref_structure.py
wire_point_ref_structure.py
zone_projection_ref_structure.py
Aurige commented 1 year ago

Just to clearly understand your expectation, for example we have <xsd:element name="InfrastructureLinkRef" type="InfrastructureLinkRefStructure" abstract="true" substitutionGroup="LinkRef">

but also

    <xsd:complexType name="InfrastructureLinkRefStructure">
        ...
        <xsd:simpleContent>
            <xsd:restriction base="LinkRefStructure">

So the InfrastructureLinkRef is both inheriting from LinkRefStructure and is in the LinkRef substitution group (that allows interchageability of elements with less contraints than the inheritance, which is sometimes necessary (for example due to some multiple inheritance in TM). So this has been adopted as a kind of design pattern for all Refs in NeTEx.

What would you like to change here ?

skinkie commented 1 year ago

What is missing from these elements is that they never inherit from VersionOfObjectRef. If they would, it is extremely clear that they are in fact a group of objects that are references (and can be treated as such).

Aurige commented 1 year ago

in that case, they do since you also have:

    <xsd:complexType name="LinkRefStructure">
        ...
        <xsd:simpleContent>
            <xsd:restriction base="VersionOfObjectRefStructure">

So the inheritance chain is InfrastructureLinkRefStructure -> LinkRefStructure -> VersionOfObjectRefStructure

skinkie commented 1 year ago

Restriction base is not used for all the other RefObjects...

skinkie commented 1 year ago

An example. Why not base the top object on VersionOfObjectRef?

<xsd:element name="SomethingElseRef" type="SomethingElseRefStructure" substitutionGroup="VersionOfObjectRef">
Aurige commented 1 year ago

that's for strong typing, and avoid mixing refs of totally unrelated types of objects. However, I agree that all Refs should end on a VersionOfObjectRefStructure at hte end of their inheritance chain.

skinkie commented 1 year ago

Lets start with the first example. Your argument would be: "It has a restriction base".

Can you elaborate what the technical difference would be between the restriction base or it being a substitutiongroup?

  <xsd:complexType name="AccessEquipmentRefStructure">
    <xsd:annotation>
      <xsd:documentation>Type for a reference to an ACCESS EQUIPMENT.</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:restriction base="PlaceEquipmentRefStructure">
        <xsd:attribute name="ref" type="AccessEquipmentIdType" use="required">
          <xsd:annotation>
            <xsd:documentation>Identifier of a ACCESS EQUIPMENT.</xsd:documentation> 
          </xsd:annotation>
        </xsd:attribute>
      </xsd:restriction>
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:complexType name="PlaceEquipmentRefStructure" abstract="true">
    <xsd:annotation>
      <xsd:documentation>Type for a reference to an PLACE EQUIPMENT.</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:restriction base="InstalledEquipmentRefStructure">
        <xsd:attribute name="ref" type="PlaceEquipmentIdType" use="required">
          <xsd:annotation>
            <xsd:documentation>Identifier of a PLACE EQUIPMENT.</xsd:documentation>
          </xsd:annotation> 
        </xsd:attribute> 
      </xsd:restriction>
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:complexType name="InstalledEquipmentRefStructure" abstract="true">
    <xsd:annotation>
      <xsd:documentation>Type for a reference to an INSTALLED EQUIPMENT.</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:restriction base="EquipmentRefStructure">
        <xsd:attribute name="ref" type="InstalledEquipmentIdType" use="required">
          <xsd:annotation>
            <xsd:documentation>Identifier of an INSTALLED EQUIPMENT.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:restriction>
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:complexType name="EquipmentRefStructure">
    <xsd:annotation>
      <xsd:documentation>Type for a reference to an EQUIPMENT.</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:restriction base="VersionOfObjectRefStructure">
        <xsd:attribute name="ref" type="EquipmentIdType" use="required">
          <xsd:annotation>
            <xsd:documentation>Identifier of an EQUIPMENT.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:restriction>
    </xsd:simpleContent>
  </xsd:complexType>
nick-knowles commented 9 months ago

One wants a structure hierarched for the xxxRefs so one can reference all the subtypes of a supertype with a sing ref to the supertype

XML has some pretty horrible limitations and complexities on restricting / extending types and elements (and there are several of weird bugs in XMLSpy on validating) . _

ue71603 commented 4 months ago

@skinkie What do we do for 2.0? Or is this a general 2.1 subject?

skinkie commented 4 months ago

I hope we can this as a hygiene improvement in 2.0.