Changes between Version 21 and Version 22 of Rules/PublicTransportGtfs
- Timestamp:
- 2020-08-09T14:49:09+02:00 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Rules/PublicTransportGtfs
v21 v22 62 62 */ 63 63 64 relation[type=route_master][route_master =~ /^(bus|share_taxi|trolleybus|train| tram|light_rail|subway|monorail|ferry)$/] {64 relation[type=route_master][route_master =~ /^(bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorailfunicular||ferry|aerialway|school_bus|walking_bus)$/] { 65 65 set PtRouteMaster; 66 66 } 67 68 67 /* 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)$/] { 70 69 set PtRoute; 71 70 } … … 75 74 } 76 75 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] { 78 77 set noPtVehicle; 79 78 } … … 114 113 relation.PtRouteMaster[type=route_master][!gtfs:source_date], 115 114 relation.PtRouteMaster[type=route_master][!network], 116 relation.PtRouteMaster[type=route_master][!network:short],117 115 relation.PtRouteMaster[type=route_master][!operator], 118 relation.PtRouteMaster[type=route_master][!operator:short],119 116 relation.PtRouteMaster[type=route_master][!ref], 120 117 relation.PtRouteMaster[type=route_master][!source], … … 130 127 relation.PtRoute[type=route][!gtfs:source_date], 131 128 relation.PtRoute[type=route][!network], 132 relation.PtRoute[type=route][!network:short],133 129 relation.PtRoute[type=route][!opening_hours], 134 130 relation.PtRoute[type=route][!operator], 135 relation.PtRoute[type=route][!operator:short],136 131 relation.PtRoute[type=route][!ref], 137 132 relation.PtRoute[type=route][!source], … … 145 140 * assertNoMatch: "relation type=route_master route_master=bus colour=green"; 146 141 */ 142 } 143 144 /* {0.tag} without {1.key} (info level) */ 145 146 /* route_master and route relations, ToDo ferry on ways */ 147 relation.PtRouteMaster[type=route_master][!network:short], 148 relation.PtRouteMaster[type=route_master][!operator:short], 149 relation.PtRoute[type=route][!network:short], 150 relation.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"; 147 155 } 148 156 … … 241 249 } 242 250 /* gtfs:feed, *:guid, gtfs:source_date */ 251 /* FIXME: Get proper list of valid values. */ 243 252 /* FIXME: Get proper syntax as regex displayed. */ 244 253 *[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)$/], … … 262 271 /* ref:IFOPT, gtfs:stop_id */ 263 272 /* 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}(:.+)?)?$/] { 266 277 throwError: tr("Value `{0}` for `{1}=*` does not match value syntax.", "{0.value}", "{0.key}"); 267 278 /* throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`.", "{0.value}", "{0.key}", "{1.value}"); */ … … 293 304 294 305 /* 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}(:.+)?)?$/] { 297 308 throwOther: tr("Value of `{0}` is in old format.", "{0.key}"); 298 309 group: tr("Public Transport GTFS: value syntax"); … … 303 314 /* short ref:IFOPT */ 304 315 node[public_transport=stop_position][ref:IFOPT ]!.ErrorSyntaxIFOPT[ref:IFOPT !~ /^.+(:.+){4}$/], 305 node[public_transport= platform][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/],316 node[public_transport=stop_position][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/], 306 317 node[public_transport=platform ][ref:IFOPT ]!.ErrorSyntaxIFOPT[ref:IFOPT !~ /^.+(:.+){4}$/], 307 318 node[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/], 308 319 way[public_transport=platform ][ref:IFOPT ]!.ErrorSyntaxIFOPT[ref:IFOPT !~ /^.+(:.+){3}$/], 309 320 way[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)$/] {321 relation[public_transport=platform ][ref:IFOPT ]!.ErrorSyntaxIFOPT[ref:IFOPT !~ /^.+(:.+){3}$/], 322 relation[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){3}$/] { 312 323 throwWarning: tr("Incomplete `{0}` on `{1}`.", "{1.tag}", "{0.tag}"); 313 324 group: tr("Public Transport GTFS: value syntax"); … … 315 326 assertNoMatch: "node public_transport=platform ref:IFOPT=de:09162:1179:53:KIF 1"; 316 327 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";318 328 assertMatch: "relation public_transport=platform ref:IFOPT=de:09162:1179"; 319 329 assertNoMatch: "relation public_transport=platform ref:IFOPT=de:09162:1179:30"; 330 } 331 way[public_transport=platform ][ref:IFOPT ]!.ErrorSyntaxIFOPT[ref:IFOPT !~ /^.+(:.+){4}$/], 332 way[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/], 333 relation[public_transport=platform ][ref:IFOPT ]!.ErrorSyntaxIFOPT[ref:IFOPT !~ /^.+(:.+){4}$/], 334 relation[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/], 335 relation[public_transport=stop_area][ref:IFOPT ]!.ErrorSyntaxIFOPT[ref:IFOPT !~ /^.+(:.+){3}$/], 336 relation[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"; 320 341 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"; 321 344 } 322 345 … … 326 349 327 350 /* 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}"); 331 356 group: tr("Public Transport GTFS: conflicting tags"); 332 357 assertMatch: "node public_transport=platform local_ref=14 ref:IFOPT=de:08315:6504:0:1";
