diff --git a/gtfs-realtime/spec/en/examples/alerts.asciipb b/gtfs-realtime/spec/en/examples/alerts.asciipb index 774adeb1f..601bfd061 100644 --- a/gtfs-realtime/spec/en/examples/alerts.asciipb +++ b/gtfs-realtime/spec/en/examples/alerts.asciipb @@ -30,10 +30,17 @@ entity { # agency_id, route_id, route_type, stop_id, trip (see TripDescriptor) route_id: "219" } - # multiple selectors (informed_entity) can be given + # multiple selectors (informed_entity) can be included in one alert entity informed_entity { stop_id: "16230" } + # multiple fields can be included in one informed_entity + informed_entity { + stop_id: "16299" + route_id: "100" + # This example means route 100 at stop 16299. + # This does not apply to any other stop on route 100 and any other route at stop 16299. + } # cause of the alert - see gtfs-realtime.proto for valid values cause: CONSTRUCTION diff --git a/gtfs-realtime/spec/en/reference.md b/gtfs-realtime/spec/en/reference.md index 1e71bfeca..859af403f 100644 --- a/gtfs-realtime/spec/en/reference.md +++ b/gtfs-realtime/spec/en/reference.md @@ -372,7 +372,7 @@ Identification information for the vehicle performing the trip. ## _message_ EntitySelector -A selector for an entity in a GTFS feed. The values of the fields should correspond to the appropriate fields in the GTFS feed. At least one specifier must be given. If several are given, then the matching has to apply to all the given specifiers. +A selector for an entity in a GTFS feed. The values of the fields should correspond to the appropriate fields in the GTFS feed. At least one specifier must be given. If several are given, they should be interpreted as being joined by the logical `AND` operator and the combination of specifiers should match the information in the corresponding GTFS feed. In other words, in order for an alert to apply to an entity it must match all of the provided EntitySelector fields. For example, an EntitySelector that includes the fields `route_id: "5"` and `route_type: "3"` applies only to the `route_id: "5"` bus - it does not apply to any other routes of `route_type: "3"`. If a producer wants an alert to apply to `route_id: "5"` as well as `route_type: "3"`, it should provide two separate EntitySelectors, one referencing `route_id: "5"` and another referencing `route_type: "3"`. #### Fields diff --git a/gtfs-realtime/spec/en/service-alerts.md b/gtfs-realtime/spec/en/service-alerts.md index c27031ecc..bc6f58d28 100644 --- a/gtfs-realtime/spec/en/service-alerts.md +++ b/gtfs-realtime/spec/en/service-alerts.md @@ -24,6 +24,10 @@ Entities are selected using their GTFS identifiers, and you can select any of th * Trip - affects a particular trip * Stop - affects a particular stop +You may include more than one of the fields listed above in one `informed_entity`. When multiple fields are included in one `informed_entity`, they should be interpreted as being joined by the `AND` logical operator. In other words, the alert should only be applied in a context that meets all of the fields provided in an `informed_entity`. For example, if `route_id: "1"` and `stop_id: "5"` are both included in one `informed_entity`, then the alert should apply only to route 1 at stop 5. It should NOT be applied to any other stop on route 1, and it should NOT be applied to any other route at stop 5. + +If you would like to represent an alert that affects more than one entity (e.g. an alert for both route 1 and stop 5) , you should add multiple `informed_entity` to your `alert`, with each of them applying to the affected entity (e.g. one `informed_entity` that includes route 1 and another `informed_entity` that includes stop 5). + ### Cause What is the cause of this alert? You may specify one of the following: