Changes between Version 21 and Version 22 of Rules/PublicTransportGtfs


Ignore:
Timestamp:
2020-08-09T14:49:09+02:00 (6 years ago)
Author:
skyper
Comment:

add more vehicle types; downgrade warning about *:short; proper syntax for ref:IFOPT

Legend:

Unmodified
Added
Removed
Modified
  • Rules/PublicTransportGtfs

    v21 v22  
    6262 */
    6363
    64 relation[type=route_master][route_master =~ /^(bus|share_taxi|trolleybus|train|tram|light_rail|subway|monorail|ferry)$/] {
     64relation[type=route_master][route_master =~ /^(bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorailfunicular||ferry|aerialway|school_bus|walking_bus)$/] {
    6565  set PtRouteMaster;
    6666}
    67 
    6867/* Not only relations as ferry can be a way */
    69 *[type=route][route =~ /^(bus|share_taxi|trolleybus|train|tram|light_rail|subway|monorail|ferry)$/] {
     68*[type=route              ][route        =~ /^(bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorail|funicular|ferry|aerialway|school_bus|walking_bus)$/] {
    7069  set PtRoute;
    7170}
     
    7574}
    7675
    77 *[!aerialway][bus!=yes][share_taxi!=yes][trolleybus!=yes][train!=yes][tram!=yes][light_rail!=yes][subway!=yes][monorail!=yes][ferry!=yes] {
     76*[bus!=yes][coach!=yes][share_taxi!=yes][trolleybus!=yes][train!=yes][light_rail!=yes][subway!=yes][tram!=yes][monorail!=yes][funicular!=yes][ferry!=yes][!aerialway] {
    7877  set noPtVehicle;
    7978}
     
    114113relation.PtRouteMaster[type=route_master][!gtfs:source_date],
    115114relation.PtRouteMaster[type=route_master][!network],
    116 relation.PtRouteMaster[type=route_master][!network:short],
    117115relation.PtRouteMaster[type=route_master][!operator],
    118 relation.PtRouteMaster[type=route_master][!operator:short],
    119116relation.PtRouteMaster[type=route_master][!ref],
    120117relation.PtRouteMaster[type=route_master][!source],
     
    130127relation.PtRoute[type=route][!gtfs:source_date],
    131128relation.PtRoute[type=route][!network],
    132 relation.PtRoute[type=route][!network:short],
    133129relation.PtRoute[type=route][!opening_hours],
    134130relation.PtRoute[type=route][!operator],
    135 relation.PtRoute[type=route][!operator:short],
    136131relation.PtRoute[type=route][!ref],
    137132relation.PtRoute[type=route][!source],
     
    145140 *  assertNoMatch: "relation type=route_master route_master=bus colour=green";
    146141 */
     142}
     143
     144/* {0.tag} without {1.key} (info level) */
     145
     146/* route_master and route relations, ToDo ferry on ways */
     147relation.PtRouteMaster[type=route_master][!network:short],
     148relation.PtRouteMaster[type=route_master][!operator:short],
     149relation.PtRoute[type=route][!network:short],
     150relation.PtRoute[type=route][!operator:short] {
     151  throwOther: tr("Public transport {0} relation without `{1}*`.", "{1.value}", "{2.tag}");
     152  group: tr("Public Transport GTFS: missing tag");
     153  assertMatch:   "relation type=route route=train";
     154  assertMatch:   "relation type=route_master route_master=bus";
    147155}
    148156
     
    241249}
    242250/* gtfs:feed, *:guid, gtfs:source_date */
     251/* FIXME: Get proper list of valid values. */
    243252/* FIXME: Get proper syntax as regex displayed. */
    244253*[gtfs:feed    ][gtfs:feed     !~ /^(([A-Z]{2}-){2}[a-zA-Z]{2}.*|[A-Z]{2}-(Alle|Flixbus)|BO-C-Cochabamba|(CH|LU)-[a-zA-Z]{3,}|CO-BOY-[A-Z].+|DE-SPNV|DE-S-und-U-Bahnen|ES-AR-Z-[A-Z].+|FR-IDF-(r|[a-zA-Z]{3,}.*)|MG-T-Antananarivo)$/],
     
    262271/* ref:IFOPT, gtfs:stop_id */
    263272/* FIXME: Get proper syntax as regex displayed. */
    264 *[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]?)?)?$/],
    265 *[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]?)?)?$/] {
     273/* *[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]?)?)?$/], */
     274/* *[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]?)?)?$/] { */
     275*[ref:IFOPT   ][ref:IFOPT    !~ /^(gen:[0-9]{4}|[a-z]{2}:[0-9]{5}):[1-9][0-9]{0,4}(:[0-9]{1,2}(:.+)?)?$/],
     276*[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}(:.+)?)?$/] {
    266277  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax.", "{0.value}", "{0.key}");
    267278/*  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`.", "{0.value}", "{0.key}", "{1.value}"); */
     
    293304
    294305/* old syntax ref:IFOPT */
    295 *[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]?)?)?$/],
    296 *[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]?)?)?$/] {
     306*[ref:IFOPT   ][ref:IFOPT    =~ /^gen:[0-9]{4}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:.+)?)?$/],
     307*[gtfs:stop_id][gtfs:stop_id =~ /^gen:[0-9]{4}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:.+)?)?$/] {
    297308  throwOther: tr("Value of `{0}` is in old format.", "{0.key}");
    298309  group: tr("Public Transport GTFS: value syntax");
     
    303314/* short ref:IFOPT */
    304315node[public_transport=stop_position][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT        !~ /^.+(:.+){4}$/],
    305 node[public_transport=platform     ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id     !~ /^.+(:.+){4}$/],
     316node[public_transport=stop_position][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id     !~ /^.+(:.+){4}$/],
    306317node[public_transport=platform     ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT        !~ /^.+(:.+){4}$/],
    307318node[public_transport=platform     ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id     !~ /^.+(:.+){4}$/],
    308319way[public_transport=platform      ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT         !~ /^.+(:.+){3}$/],
    309320way[public_transport=platform      ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id      !~ /^.+(:.+){3}$/],
    310 relation[public_transport          ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){3}$/][public_transport =~ /^(platform|stop_area)$/],
    311 relation[public_transport          ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){3}$/][public_transport =~ /^(platform|stop_area)$/] {
     321relation[public_transport=platform ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){3}$/],
     322relation[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){3}$/] {
    312323  throwWarning: tr("Incomplete `{0}` on `{1}`.", "{1.tag}", "{0.tag}");
    313324  group: tr("Public Transport GTFS: value syntax");
     
    315326  assertNoMatch: "node public_transport=platform ref:IFOPT=de:09162:1179:53:KIF 1";
    316327  assertNoMatch: "node public_transport=platform ref:IFOPT=DDDD:09162:1179:3:KIF 1";
    317   assertNoMatch: "way public_transport=platform ref:IFOPT=de:09162:1179:21";
    318328  assertMatch:   "relation public_transport=platform ref:IFOPT=de:09162:1179";
    319329  assertNoMatch: "relation public_transport=platform ref:IFOPT=de:09162:1179:30";
     330}
     331way[public_transport=platform      ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT         !~ /^.+(:.+){4}$/],
     332way[public_transport=platform      ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id      !~ /^.+(:.+){4}$/],
     333relation[public_transport=platform ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){4}$/],
     334relation[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/],
     335relation[public_transport=stop_area][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){3}$/],
     336relation[public_transport=stop_area][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){3}$/] {
     337  throwOther: tr("Possibly, incomplete `{0}` on `{1}`.", "{1.tag}", "{0.tag}");
     338  group: tr("Public Transport GTFS: value syntax");
     339  assertMatch:   "way public_transport=platform ref:IFOPT=de:09162:1179:21";
     340  assertNoMatch: "way public_transport=platform ref:IFOPT=de:09162:1179:21:0";
    320341  assertNoMatch: "relation public_transport=platform ref:IFOPT=de:09162:1179:30:KIF 1";
     342  assertMatch:   "relation public_transport=stop_area ref:IFOPT=de:09162:1179";
     343  assertNoMatch: "relation public_transport=stop_area ref:IFOPT=de:09162:1179:30";
    321344}
    322345
     
    326349
    327350/* ref:IFOPT, gtfs:stop_id, local_ref */
    328 *[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],
    329 *[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] {
    330   throwWarning:  tr("`{0}` conflicts with `{1}`.", "{3.tag}", "{4.tag}");
     351/* *[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], */
     352/* *[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] { */
     353*[local_ref][ref:IFOPT]!.ErrorSyntaxIFOPT[public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.+:){4}(.+)", tag("ref:IFOPT")), 2))],
     354*[local_ref][ref:IFOPT]!.ErrorSyntaxIFOPT[public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.+:){4}(.+)", tag("gtfs:stop_id")), 2))] {
     355  throwWarning:  tr("`{0}` conflicts with `{1}`.", "{0.tag}", "{1.tag}");
    331356  group: tr("Public Transport GTFS: conflicting tags");
    332357  assertMatch:   "node public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:0:1";