Changes between Version 13 and Version 14 of Rules/PublicTransportGtfs


Ignore:
Timestamp:
2020-07-27T13:23:57+02:00 (4 years ago)
Author:
skyper
Comment:

syntax update for ref:IFOPT aka gtfs:stop_id and ids for the routes

Legend:

Unmodified
Added
Removed
Modified
  • Rules/PublicTransportGtfs

    v13 v14  
    212212 */
    213213
    214 /* ref:IFOPT, gtfs:stop_id, route_id, shape_id, trip_id */
     214/* route_id, shape_id, trip_id */
    215215/* FIXME: Get proper syntax as regex displayed. */
    216 *[gtfs:route_id      ][gtfs:route_id       !~                           /^[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?(;[ ]?[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?)*$/],
    217 *[gtfs:shape_id      ][gtfs:shape_id       !~                           /^[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR](;[ ]?[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR])*$/],
    218 *[gtfs:trip_id       ][gtfs:trip_id        !~ /^[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR](;[ ]?[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR])*$/],
    219 *[gtfs:trip_id:sample][gtfs:trip_id:sample !~ /^[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR](;[ ]?[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR])*$/] {
     216*[gtfs:route_id      ][gtfs:route_id       !~                           /^[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?(;[ ]?[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?)*$/],
     217*[gtfs:shape_id      ][gtfs:shape_id       !~                           /^[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR](;[ ]?[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR])*$/],
     218*[gtfs:trip_id       ][gtfs:trip_id        !~ /^[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR](;[ ]?[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR])*$/],
     219*[gtfs:trip_id:sample][gtfs:trip_id:sample !~ /^[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR](;[ ]?[1-9][0-9]{0,3}\.T[023A]\.[0-9]{1,2}-[A-Z]?[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR])*$/] {
    220220  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax.", "{0.value}", "{0.key}");
    221221/*  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`.", "{0.value}", "{0.key}", "{1.value}"); */
     
    230230  assertNoMatch: "relation gtfs:shape_id=11-4-I-j20-1.23.H";
    231231  assertNoMatch: "relation gtfs:shape_id=7-342-j1j-1.51.R";
     232  assertNoMatch: "relation gtfs:shape_id=0-S3-E-j20-2.1.R";
    232233  assertMatch:   "relation gtfs:trip_id=1108.T2.11-4-I-j20-1.10.";
    233234  assertNoMatch: "relation gtfs:trip_id=1108.T2.11-4-I-j20-1.10.H";
     
    241242*[operator:guid][operator:guid !~  /^([A-Z]{2}-){2}[a-zA-Z]{2}.*$/],
    242243*[gtfs:source_date][gtfs:source_date !~ /^20(1[7-9]|20)-(0[1-9]|1[0-2])-(3[01]|[12][0-9]|0[1-9])$/],
    243 *[ref:IFOPT   ][ref:IFOPT    !~ /^[a-z]{2}:[0-9]{5}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:[1-9][0-9]?)?)?$/],
    244 *[gtfs:stop_id][gtfs:stop_id !~ /^[a-z]{2}:[0-9]{4,5}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:[1-9][0-9]?)?)?$/] {
     244*[ref:IFOPT   ][ref:IFOPT    !~ /^(gen:[0-9]{4}|[a-z]{2}:[0-9]{5}):[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/],
     245*[gtfs:stop_id][gtfs:stop_id !~ /^(gen:[0-9]{4}|[a-z]{2}:[0-9]{4,5}):[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/] {
    245246  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax.", "{0.value}", "{0.key}");
    246247/*  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`.", "{0.value}", "{0.key}", "{1.value}"); */
     
    258259  assertMatch:   "node ref:IFOPT=aa:aa:09";
    259260  assertMatch:   "node ref:IFOPT=ch:3001:64883";
     261  assertMatch:   "node ref:IFOPT=gen:91888:5599:0:956R";
    260262  assertNoMatch: "node ref:IFOPT=ch:23001:64883";
    261263  assertNoMatch: "node ref:IFOPT=de:08315:6504:0:14";
     264  assertNoMatch: "node ref:IFOPT=gen:9188:5599:0:956R";
     265  assertNoMatch: "node ref:IFOPT=de:09162:1179:3:KIF 1";
    262266  assertNoMatch: "node ref:IFOPT=ch:23005:6";
    263267  assertNoMatch: "node gtfs:stop_id=ch:3001:64883";
     
    276280}
    277281
     282/* old syntax ref:IFOPT */
     283*[ref:IFOPT   ][ref:IFOPT    =~ /^gen:[0-9]{4}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/],
     284*[gtfs:stop_id][gtfs:stop_id =~ /^gen:[0-9]{4}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/] {
     285  throwOther: tr("Value of `{0}` is in old format.", "{0.key}");
     286  group: tr("Public Transport GTFS: value syntax");
     287  assertMatch:   "node ref:IFOPT=gen:9188:5599:0:956R";
     288  assertNoMatch: "node ref:IFOPT=de:09162:1179:3:KIF 1";
     289}
     290
    278291
    279292/*  -----------------------
     
    282295
    283296/* ref:IFOPT, gtfs:stop_id, local_ref */
    284 *[public_transport][public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.*:){4}([1-9][0-9]?)", tag("ref:IFOPT")), 2))][local_ref][ref:IFOPT] {
     297*[public_transport][public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.*:){4}([A-Z]+[ ]?)?([1-9][0-9]{0,2}[A-Z]?)", tag("ref:IFOPT")), 3))][local_ref][ref:IFOPT],
     298*[public_transport][public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.*:){4}([A-Z]+[ ]?)?([1-9][0-9]{0,2}[A-Z]?)", tag("gtfs:stop_id")), 3))][local_ref][ref:IFOPT] {
    285299  throwWarning:  tr("`{0}` conflicts with `{1}`.", "{3.tag}", "{4.tag}");
    286300  group: tr("Public Transport GTFS: conflicting tags");
    287   assertMatch:   "relation public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:0:1";
    288   assertNoMatch: "relation public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:0:14";
    289   assertNoMatch: "relation public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:14";
     301  assertMatch:   "node public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:0:1";
     302  assertMatch:   "node public_transport=platform local_ref=56R ref:IFOPT=gen:9188:5599:0:956R";
     303  assertNoMatch: "node public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:0:14";
     304  assertNoMatch: "node public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:14";
     305  assertNoMatch: "node public_transport=platform local_ref=956R ref:IFOPT=gen:9188:5599:0:956R";
     306  assertNoMatch: "node public_transport=platform local_ref=1 ref:IFOPT=de:09162:1179:3:KIF 1";
    290307}
    291308