In this chapter:

ServiceCalendarFrame

Glossary definition

Purpose

Groups calendar definitions that describe when services operate. We do this with AvailabilityConditions stored in this frame. We also have DayTypes and DayTypeAssignments for the holidays.

See the following class diagram for the most important objects of the ServiceCalendarFrame and their relationships to the other frames.

classDiagram
    %% Styles
    classDef frame fill:#FFF8E1,stroke:#FFB300;
    classDef contained fill:#E8F4FF,stroke:#1E90FF;
    classDef external fill:#F6F6F6,stroke:#AAAAAA;

    %% Frame
    class ServiceCalendarFrame {
        - validityConditions : AvailabilityCondition[]
    }
    class ServiceCalendarFrame frame

    %% Contained elements
    class AvailabilityCondition {
        FromDate
        ToDate
        ValidDayBits
    }

    class DayType {

    }

    class DayTypeAssignment {
    }


    class ServiceCalendar {

    }
    class Timeband {

    }

    %% External elements (not in the frame)
    class ServiceJourney {
        
    }

    class CheckConstraint {
    }

    class FacilitySet {
    }

    class StopAssignment {
    }

    class NoticeAssignment {
         }

    %% Containment relations (only contained elements)
    ServiceCalendarFrame "1" o-- "0..*" AvailabilityCondition : contains
    ServiceCalendarFrame "1" o-- "0..*" DayType : contains
    ServiceCalendarFrame "1" o-- "0..*" DayTypeAssignment : contains
    ServiceCalendarFrame "1" o-- "0..*" ServiceCalendar : contains
    ServiceCalendarFrame "1" o-- "0..*" Timeband : contains

    %% Usage relations from external elements to AvailabilityCondition
    ServiceJourney ..> AvailabilityCondition : uses
    CheckConstraint ..> AvailabilityCondition : uses
    FacilitySet ..> AvailabilityCondition : uses
    StopAssignment ..> AvailabilityCondition : uses
    NoticeAssignment ..> AvailabilityCondition : uses

    %% Other internal links
    DayTypeAssignment --> DayType : assigns


Figure: Elements of ServiceCalendar and elements with AvailabilityCondition

Table

A minimal ServiceCalendarFrame must be present in all timetable files.

Table: ServiceCalendarFrame

Sub Element Usage Card Type Description Note
  @id mandatory 1..1 xsd:string Attribute id  
  @version mandatory 1..1 xsd:string Attribute version  
  validityConditions mandatory 1..1 validityConditions_RelStructure VALIDITY CONDITIONs conditioning entity.  
+ AvailabilityCondition mandatory 1..1 AvailabilityCondition VALIDITY CONDITION stated in terms of DAY TYPES and PROPERTIES OF DAYs. Our main mechanism for validity and operating days
  ServiceCalendar expected 1..1 ServiceCalendar A SERVICE CALENDAR. A collection of DAY TYPE ASSIGNMENTs. We only have one ServiceCalendar for the whole timetable year. It is not referenced.
  dayTypes optional 0..1 dayTypes DAY TYPEs for BLOCK.  
+ DayType optional 1..1 DayType A type of day characterized by one or more properties which affect public transport operation. For example: weekday in school holidays. Used for holidays only
  timebands expected 0..1 timebandRefs_RelStructure TIMEBANDS associated with JOURNEY FREQUENCY GROUP.  
+ Timeband expected 1..1 Timeband_VersionedChildStructure A period in a day, significant for some aspect of public transport, e.g. similar traffic conditions or fare category. Mainly used for frequency-based lines.
  dayTypeAssignments optional 0..1 dayTypeAssignments_RelStructure Assignments of DAY TYPEs to specific OPERATING DAYs. The same DAY TYPE may be assigned to multiple Operating dates, and vice versa.  
+ DayTypeAssignment optional 1..1 DayTypeAssignment Associates a DAY TYPE with an OPERATING DAY within a specific Calendar. A specification of a particular DAY TYPE which will be valid during a TIME BAND on an OPERATING DAY. Used for holidays only

General NeTEx definition

Example

<?xml version="1.0" encoding="UTF-8"?>
<ServiceCalendarFrame id="ch:1:ServiceCalendarFrame" version="1">
  <!-- A minimal ServiceCalendarFrame must be present in all timetable files. -->
  <validityConditions>
  <AvailabilityCondition id="ch:1:AvailabilityCondition:b7" version="1">
  <!-- Our main mechanism for validity and operating days -->
  </AvailabilityCondition>
  </validityConditions>
  <ServiceCalendar id="ch:1:ServiceCalendar:j23" version="1">
  <!-- We only have one ServiceCalendar for the whole timetable year. It is not referenced. -->
  </ServiceCalendar>
  <dayTypes>
  <DayType id="ch:1:DayType:ycy10_1" version="1">
  <!-- Used for holidays only -->
  </DayType>
  </dayTypes>
  <timebands>
  <Timeband id="ch:1:Timeband:1140:1260" version="1">
  <!-- Mainly used for frequency-based lines. -->
  </Timeband>
  </timebands>
  <dayTypeAssignments>
  <DayTypeAssignment id="none" version="not">
  <!-- Used for holidays only -->
  <OperatingPeriodRef ref="generated" version="1"/>
  <DayTypeRef ref="ch:1:DayType:ycy10_1" version="1"/>
  </DayTypeAssignment>
  </dayTypeAssignments>
</ServiceCalendarFrame>

Template

Usage Notes

  • Note that AvailabilityConditions can be combined and ANDed (all the conditions must be fulfilled at the same time). Allowed elements to specify constraints are FromDate/ ToDate, ValidDayBits, and timebands.

AvailabilityCondition

Glossary definition

Purpose

Temporal availability in terms of Dates, Timebands, ValidDayBits.

Table

Table: AvailabilityCondition

Sub Element Usage Card Type Description Note
  @id mandatory 1..1 xsd:string Attribute id  
  @version mandatory 1..1 xsd:string Attribute version  
  FromDate optional 0..1 xsd:dateTime Start date of AVAILABILITY CONDITION. Is equal to the start date of the timetable year or, more generally, the period in which the ValidDayBits apply.
  ToDate optional 0..1 xsd:dateTime End of AVAILABILITY CONDITION. Date is INCLUSIVE. Is equal to the end date of the timetable year or, more generally, the period in which the ValidDayBits apply.
  ValidDayBits mandatory 0..1 xsd:normalizedString For UIC style encoding of day types String of bits, one for each day in period: whether valid or not valid on the day. Normally there will be a bit for every day between start and end date. If bit is missing, assume available.  
  timebands optional 0..1 timebandRefs_RelStructure TIMEBANDS associated with JOURNEY FREQUENCY GROUP. Can also be referenced
+ Timeband optional 1..1 Timeband_VersionedChildStructure A period in a day, significant for some aspect of public transport, e.g. similar traffic conditions or fare category.  
+ TimebandRef optional 1..1 TimebandRefStructure Reference to a TIME BAND.  

General NeTEx definition

Example

<?xml version="1.0" encoding="UTF-8"?>
<AvailabilityCondition id="generated" version="1">
  <FromDate>2026-05-17T00:00:00Z
  <!-- Is equal to the start date of the timetable year or, more generally, the period in which the ValidDayBits apply. -->
  </FromDate>
  <ToDate>2026-05-17T00:00:00Z
  <!-- Is equal to the end date of the timetable year or, more generally, the period in which the ValidDayBits apply. -->
  </ToDate>
  <ValidDayBits>01010010111</ValidDayBits>
  <timebands>
  <!-- Can also be referenced -->
  <Timeband id="ch:1:Timeband:4937" version="1">
  <StartTime>06:00:00</StartTime>
  <EndTime>06:01:00</EndTime>
  </Timeband>
  <TimebandRef ref="ch:1:Timeband:4937-2" version="1"/>
  </timebands>
</AvailabilityCondition>

Template

Usage Notes

  • Examples of use of AvailabilityCondition include ServiceJourney, TemplateServiceJourney, facilities.
  • AvailabilityCondition replaces OperatingDay and OperatingPeriod. Whenever a reference to a VP (“Verkehrsperiode” or “operating period” in english) is needed, we use an AvailabilityConditionRef:
  • The referenced AvailabilityConditions are centrally stored in the ServiceCalendarFrame.
  • The element ValidDayBits directly indicates the days on which some service is provided or not. They are similar to the HRDF bitfields.
  • ValidDayBits is required whenever the AvailabilityCondition is of temporal nature (more often than not). Examples include:
    • ServiceJourney
    • NoticeAssignment
    • ServiceFacilitySet
    • ServiceJourneyInterchange
  • AvailabilityConditions can be combined and ANDed (all the conditions must be fulfilled at the same time). Allowed elements to specify constraints are FromDate/ToDate, ValidDayBits, and timebandsnone of these is mandatory on its own; an AvailabilityCondition may consist of only one of them (e.g. only FromDate/ToDate for “summer only”, only timebands for “school holiday period”, or only ValidDayBits for “Sundays only”).
  • Hint: The frames TimetableFrame, ServiceFrame and ServiceCalendarFrame and their elements must have the same validity.
  • id-attribute does not need to be kept stable between exports.

ServiceCalendar

Glossary definition

Purpose

Long-term planning uses calendar days that are classified as specific DayTypes (example: weekday in school holidays). In the general NeTEx model, a ServiceCalendar defines a mapping between DayTypes and OperatingDays; in the Swiss profile, this mapping via OperatingDays is not used — ServiceCalendar serves only as a container for DayTypes and DayTypeAssignments, defining a mapping of DayTypes to dates.

Table

Table: ServiceCalendar

Sub Element Usage Card Type Description Note
  @id mandatory 1..1 xsd:string Attribute id  
  @version mandatory 1..1 xsd:string Attribute version  
  Name expected 0..* MultilingualString Name of Traveller timetable year
  FromDate mandatory 0..1 xsd:dateTime Start date of AVAILABILITY CONDITION. Beginning of timetable year
  ToDate mandatory 0..1 xsd:dateTime End of AVAILABILITY CONDITION. Date is INCLUSIVE. End of timetable year

General NeTEx definition

Example

<?xml version="1.0" encoding="UTF-8"?>
<ServiceCalendar id="ch:1:ServiceCalendar:j23" version="1">
  <Name>Fahrplan 2018
  <!-- timetable year -->
  </Name>
  <FromDate>2017-12-10
  <!-- Beginning of timetable year -->
  </FromDate>
  <ToDate>2018-12-08
  <!-- End of timetable year -->
  </ToDate>
</ServiceCalendar>

Template

Usage Note

  • id-attribute should to be kept stable between exports.

DayType

Glossary definition

Purpose

A classification of days on which a specific set of transport services operates (e.g., Weekdays, Saturdays, Public Holidays). The DayTypes of the Swiss profile represent national holidays.

Table

In Switzerland only used for holidays and the like

Table: DayType

Sub Element Usage Card Type Description Note
  @id mandatory 1..1 xsd:string Attribute id  
  @version mandatory 1..1 xsd:string Attribute version  
+ AlternativeText mandatory 1..1 AlternativeText Alternative Text. +v1.1  
++ Text mandatory 0..* MultilingualString Text content of NOTICe.  
+++ @lang mandatory 1..1 xsd:string Attribute lang  
  Name mandatory 0..* MultilingualString Name of Traveller German or default text
+ @lang mandatory 1..1 xsd:string Attribute lang  
+ Text expected 0..* MultilingualString Text content of NOTICe. Italian
++ @lang mandatory 1..1 xsd:string Attribute lang  
+ Text expected 0..* MultilingualString Text content of NOTICe. French
++ @lang mandatory 1..1 xsd:string Attribute lang  
+ Text expected 0..* MultilingualString Text content of NOTICe. English
++ @lang mandatory 1..1 xsd:string Attribute lang  
  properties expected 0..1 propertiesOfDay_RelStructure Properties of the DAY TYPE.  
+ PropertyOfDay mandatory 1..1 PropertyOfDay A property which a day may possess, such as school holiday, weekday, summer, winter etc. Holidays only
++ HolidayTypes expected 0..1 HolidayTypesListOfEnumerations Type of holiday. Default is Any day.  
++ DayEvent optional 0..1 DayEventEnumeration Events happening on day.  

General NeTEx definition

Example

<?xml version="1.0" encoding="UTF-8"?>
<DayType id="ch:1:DayType:Bundesfeier" version="1">
  <!-- In Switzerland only used for holidays and the like -->
  <Name lang="de">Bundesfeier
  <!-- German or default text -->
  <Text lang="it">Festa nazionale
  <!-- Italian -->
  </Text>
  <Text lang="fr">Fête nationale
  <!-- French -->
  </Text>
  <Text lang="en">National Day
  <!-- English -->
  </Text>
  </Name>
  <properties>
  <PropertyOfDay>
  <!-- Holidays only -->
  <HolidayTypes>NationalHoliday</HolidayTypes>
  <DayEvent>normalDay</DayEvent>
  </PropertyOfDay>
  </properties>
</DayType>

Template

Usage Note

  • id-attribute needs to be kept stable between exports.

Timeband

Glossary definition

Purpose

A period of time within a day, usually defined by a start and end time.

Table

Table: Timeband

Sub Element Usage Card Type Description Note
  @id mandatory 1..1 xsd:string Attribute id  
  @version mandatory 1..1 xsd:string Attribute version  
  StartTime mandatory 0..1 xsd:time Start time of USAGE VALIDITY PERIOD. Local time (not Zulu), i.e., without “Z” or “hh:mm:ss” suffix. Seconds are not used.
  EndTime mandatory 0..1 xsd:time End time of USAGE VALIDITY PERIOD. Local time (not Zulu), i.e., without “Z” or “hh:mm:ss” suffix. Seconds are not used.

General NeTEx definition

Example

<?xml version="1.0" encoding="UTF-8"?>
<Timeband id="ch:1:Timeband:4937" version="1">
  <StartTime>06:00:00
  <!-- Local time (not Zulu), i.e., without “Z” or “hh:mm:ss” suffix. Seconds are not used. -->
  </StartTime>
  <EndTime>06:01:00
  <!-- Local time (not Zulu), i.e., without “Z” or “hh:mm:ss” suffix. Seconds are not used. -->
  </EndTime>
</Timeband>

Template

Usage Notes

  • Currently Timeband is used in RG 1.0 for InterchangeRuleTimings, later also used for the opening hours in StopPlace models.
  • id-attribute should be kept stable between exports.

DayTypeAssignment

Glossary definition

Purpose

Assignment of a date to DayType. The DayTypes of the Swiss profile represent national holidays.

Table

We currently use DayType to store the national holidays.

Table: DayTypeAssignment

Sub Element Usage Card Type Description Note
  @id mandatory 1..1 xsd:string Attribute id  
  @version mandatory 1..1 xsd:string Attribute version  
  Date mandatory 0..1 xsd:date Date of the review  
  DayTypeRef mandatory 1..* DayTypeRefStructure The DAY TYPE of all the services in this group.  

General NeTEx definition

Example

<?xml version="1.0" encoding="UTF-8"?>
<DayTypeAssignment id="BundesfeierAssignment" version="1">
  <!-- We currently use DayType to store the national holidays. -->
  <Date>2023-08-01</Date>
  <DayTypeRef ref="ch:1:DayType:Bundesfeier" version="1"/>
</DayTypeAssignment>

Template

Usage Notes

  • We currently use DayTypeAssignment only for the national holidays.
  • id-attribute should be kept stable between exports.