XML Schema Definitions (XSDs) offer a variety of possibilities to define syntactic constraints, describing the syntax of an XML file, including the type and multiplicity of an element. For example in railML® 2, it is possible to describe and validate that a <train> must reference one or more <trainPart>s, that all <trackElements> must have a position on the <track>, that the length of a <tunnel> is a decimal number and that allowed positions of <couplers> are at the front, rear or both ends of a <wagon>. However, XML Schema Definitions are not able to express a constraint on one element or attribute that depends on the value or existence of another element or attribute. One example is that an XSD cannot express that a departure time must be greater than or equal to the arrival time, or that it does not make sense to specify a stopOnRequest and at the same time that the train is not allowed to stop. Such rules restricting the contents, or semantics, of one element or attribute depending on other content, are called semantic constraints.
Semantic constraints are as important as syntactic constraints. If they are ignored, other software may not be able to handle your railML® files, or may interpret the contents in different ways. Therefore, their implementation will be checked during certification.
Elements with approved semantic constraints are listed in Category:Semantic constraints. On the element documentation pages, the semantic constraints can be found in a dedicated chapter below the syntactic constraints. Proposed semantic constraints are listed in Category:Semantic constraints_proposed. A list of the semantic constraints by introduction date of a can be found below.
Every application of railML® has to be checked not only on XSD compliance but also on the obedience to the semantic constraints.
How to introduce Semantic Constraints
Constraints that can be described by XML Schema Definitions (XSDs) should be implemented syntactically in the schemas. Please, follow the guideline for participating in the development process. If a constraint cannot be described by XML Schema Definitions, you can propose a semantic constraints.
If there is consensus in a working group to add a new semantic constraint, a post will be made in the forum and the proposed constraint will be added to the element documentation using Template:Semcon, with
status=proposed and added to the list below. If there are no objections in the forum, it will be approved after six weeks and implemented in the wiki with
If you see the need for a semantic constraint beyond the schema, please discuss it in the forum (link to the railML® website) and then add a proposal in the element documentation using Template:Semcon, with
status=proposed. Please also add the proposal to the list below! If a consensus is reached in the forum, the proposal will be accepted, it will implemented in the wiki with
- Implement a seperate semantic constraint for every rule.
- Use the template with all mandatory arguments according to Template:SemanticConstraint.
- Record the semantic constraint on the respective list below (Dev:Semantic_Constraints/table2 for railML® 2 and Dev:Semantic_Constraints/table3 for railML® 3).
- assign a serial id to the semantic constraint according to the appropriate list below.
Current Constraints as of railML® 2.5
|Element||ID||Proposal date||Date of acception||Date of deprecation||Description|
|<TT:timetablePeriod>||TT:001||2018-11-12||2019-03-21||Any starting time stamp (as it may result e.g. from a combination of startDate and startTime) shall be lower or equal any ending time stamp (e.g. endDate) if both are given. Must not overlap with other validity periods.|
|<TT:operatingPeriodRef>><TT:specialService>||TT:001||2018-11-12||2019-03-21||Any starting time stamp (as it may result e.g. from a combination of startDate and startTime) shall be lower or equal any ending time stamp (e.g. endDate) if both are given. Must not overlap with other validity periods.|
|<TT:operatingPeriod>><TT:specialService>||TT:001||2018-11-12||2019-03-21||Any starting time stamp (as it may result e.g. from a combination of startDate and startTime) shall be lower or equal any ending time stamp (e.g. endDate) if both are given. Must not overlap with other validity periods.|
|<TT:ocpTT> (first semantic constraint)||TT:002||2018-10-25||2019-06-20||The attribute sequence is shall be increasing according to the train path.|
|<TT:blockPart> (first semantic constraint)||TT:001||2018-11-12||2019-03-21|
|<TT:blockPart> (second semantic constraint)||TT:003||2019-07-13||By means of a <blockPart> it is possible to model both journeys with and without reference to a <trainPart> within a roster, as well as services without change of location (without reference to a <trainPart>). These 3 basic types are distinguished by the attribute mission.|
|<TT:blockPart> (third semantic constraint)||TT:004||2019-07-20||vehicleRef and formationRef shall not be used within the same blockPart, since a blockPart is either one for a certain vehicle or one for a whole formation.|
|<RS:owner> (introduced with version 2.5)||TT:001||2018-11-12||2019-03-21|
|<IS:state (with length)>||TT:001||2018-11-12||2019-03-21|
|<CO:phase> (introduced with version 2.5)||TT:001||2018-11-12||2019-03-21|
|<IS:speedChange> (second semantic constraint)||IS:011||2022-03-14|
|<TT:rostering>||TT:005||2019-05-22||2019-06-25||vehicleRef and formationRef are to be used exceptional since the circulation plan is either one for a certain vehicle or one for a whole formation.|
|<TT:stopDescription> (first semantic constraint)||TT:006||2018-09-03||2019-06-20||Constraints between the attributes <ocpTT>.ocpType, <stopDescription>.guaranteedPass, .commercial, .onOff, .stopOnRequest and .operationalStopOrdered|
|<TT:trackInfo> (first semantic constraint)||TT:008||2018-08-21||2019-06-20||The representation of differentiated track usage must not result in differences in arrival and departure times. In these cases, a separate <trainPart> / <train> with different arrival and departure times must be created.|
|<TT:trackInfo> (second semantic constraint)||TT:009||2018-08-21||2019-06-20||The operating days days of the <operatingPeriodRef>s of the individual <trackInfo> entries must be disjoint and must not contain more traffic days than the parent <trainPart>. If fewer traffic days are provided in the <trackInfo> entries than the parent <trainPart> contains, the information (e.g. attribute trackInfo) of the parent <ocpTT> must be evaluated for these operating days.|
|<TT:times> (Correct encoding of run time supplements)||TT:010||2019-06-19||2020-10-15||@scope='earliest' and 'latest' are not intended to encode supplement times, as this is redundant to <ocpTT>.<sectionTT>.<runTimes>@operationalReserve, @additionalReserve, @minimalTime.|
|<TT:times>||TT:012||2019-06-19||2022-06-02||When @scope='actual' is used, then the operating period and/or timetable period specified at the trainpart level shall refer to only one operating day. Like this the operating day to which the actual times refer is defined.|
|<TT:times> (Arrival times for passing OCP's)||TT:014||2019-06-19||2022-06-02||@arrival is not to be specified if the attribute ocpType of the parent <ocpTT> has the value pass - use departure for run-through (passing) times; This is in line with the definition of @arrival as the moment at which the train ends its movement and gets to a halt at the parent <ocpTT>.|
|<TT:times> (Arrival time at first OCP)||TT:015||2019-06-19||2022-06-02||At the first <ocpTT> of a <trainPart> that is not the first one of the <trainPartSequence>, the attribute @arrival is optional. If it is set anyway, then, for consistency reasons, the value of @arrival of the regarding <ocpTT> must be identical for both this <trainPart> and the preceding one.|
|<TT:times> (Departure time at last OCP)||TT:016||2020-10-09||2022-06-02||At the last <ocpTT> of a <trainPart> that is not the last one of the <trainPartSequence>, the attribute @departure is optional. If it is set anyway, then, for consistency reasons, the value of @departure of the regarding <ocpTT> must be identical for both this <trainPart> and the subsequent one.|
|<TT:connection>||TT:017||2022-12-15||2022-12-15||If the trainPartRef attribute is given, then there must also be a trainRef attribute, and the trainPartRef attribute must point to a train part of the train referenced by the trainRef attribute.|
|<IS:track>||IS:004||2019-06-17||Single track railway lines shall have main driving direction @mainDir="none" if they are used in both directions|
|<IS:ocp>||IS:005||2019-06-19||An <ocp> that refers to a parent <ocp> via an @parentOcpRef overwrites the attributes and elements of the parent <ocp> if explicitely defined. If an element is specified on an <ocp> that uses a @parentOcpRef any information provided with that element on a higher layer of the <ocp>-tree is overwritten. There is no merging of element-information from different levels. The same applies for attributes of <ocp>.|
|<IS:uptime>||IS:008||2020-02-28||An <ocp> with <propOperational>@operationalType=blockSignal shall not have
@mode=manned (as a manned blockSignal shall be modelled in railML® 2.x as a blockPost).
|<IS:uptime>||IS:009||2020-02-28||An <ocp> with attribute <propOperational>@operationalType=stoppingPoint shall not have @mode=manned (as a stoppingPoint has no operational usage and therefore no operational staff by the IM).|
|<IS:uptime>||IS:010||2020-02-28||An enumeration of several time periods by @from and @until for one <ocp> shall not overlap so that for every time there shall be a unique status of <uptime>.|
|<IS:speedProfile> (first semantic constraint)||IS:012||2022-03-14||@basicSpeedProfile is always linked with @influence=increasing|
|<IS:speedProfile> (second semantic constraint)||IS:013||2022-03-14||
|<IS:tunnel>||IS:014||2022-03-14||Define the tunnel resistance factor @resistanceFactorPassenger resp. @resistanceFactorFreight only if @kind and @crossSection are not known.|
|<IS:ocp>||IS:015||2022-07-14||When specifying @parentOcpRef for an <ocp> circles are not allowed. That means that when following the chain of @parentOcpRef no <ocp> shall be visited twice.|