# JOSM TagChecker validator file

# Format:
# Each line specifies a certain error to be reported
# <data type> : messagetype : <key><expression><value>
# Lines starting with a # are considered as comments.
#
# Data type can be:
#  node        - a node point
#  way         - a way
#  relation    - a relation
#  *           - all data types
#
# Message type can be:
# E            - an error
# W            - a warning
# I            - an low priority informational warning
#
# Key and value are expressions describing certain keys and values of these keys.
# Regulator expressions are supported. In this case the expressions starts and
# ends with a / sign. If an 'i' is appended, the regular expression is
# case insensitive. For instance, /foo|bar/i
#
# The * sign indicates any string.
# The texts BOOLEAN_TRUE and BOOLEAN_FALSE in the value part indicate a special
# handling for boolean values (yes, true, 0, false, no, ...).
#
# Expression can be:
#  !=          - the key/value combination does not match
#  ==          - the key/value combination does match
#
# To have more complicated expressions, multiple elements can be grouped together
# with an logical and (&&).
#
# The comment at the end of a rule is displayed in validator description
#
# Empty lines and space signs are ignored

way  : W : highway == * && name == /.* (Ave|Blvd|Cct|Cir|Cl|Cr|Crct|Cres|Crt|Ct|Dr|Drv|Esp|Espl|Hwy|Ln|Mw|Mwy|Pl|Rd|Qy|Qys|Sq|St|Str|Ter|Tce|Tr|Wy)\.?$/i               # abbreviated street name

node : W : oneway == *                                         # oneway tag on a node
node : W : bridge == BOOLEAN_TRUE                              # bridge tag on a node
node : W : highway == tertiary                                 # wrong highway tag on a node
node : W : highway == secondary                                # wrong highway tag on a node
node : W : highway == residential                              # wrong highway tag on a node
node : W : highway == unclassified                             # wrong highway tag on a node
node : W : highway == track                                    # wrong highway tag on a node
way  : I : highway == unclassified && name != *                # Unnamed unclassified highway
way  : I : highway == secondary && ref != *                    # highway without a reference
way  : I : highway == tertiary && ref != *                     # highway without a reference
way  : I : highway == motorway && nat_ref != *                 # highway without a reference
*    : W : highway == road                                     # temporary highway type
*    : W : / *name */i == * && name != *                       # misspelled key name

# The following could replace unnamed way check. Still at the moment we keep it as it is
#way  : W : junction == roundabout && highway == /motorway|trunk|primary|secondary|tertiary|residential|pedestrian/ && /name|ref|(name:.*)|(.*_name)|(.*_ref)/ != * # Unnamed junction
#way  : W : highway == /motorway|trunk|primary|secondary|tertiary|residential|pedestrian/ && /name|ref|(name:.*)|(.*_name)|(.*_ref)/ != * # Unnamed 

way  : W : highway == cycleway && bicycle == BOOLEAN_FALSE     # cycleway with tag bicycle
way  : W : highway == footway && foot == BOOLEAN_FALSE         # footway with tag foot
#way  : I : highway == cycleway && bicycle == *                 # cycleway with tag bicycle
#way  : I : highway == footway && foot == *                     # footway with tag foot
way  : W : highway == cycleway && cycleway == lane             # separate cycleway as lane on a cycleway
way  : W : highway == * && barrier == *                        # barrier used on a way

#way  : I : waterway == * && layer != *                         # waterway without layer tag
way  : I : highway == footway && maxspeed == *                 # maxspeed used for footway
way  : I : highway == steps && maxspeed == *                   # maxspeed used for footway

# see #5844, #6760
#way  : W : oneway != BOOLEAN_FALSE && /.*:(backward|forward)/ == *    # oneway combined with *:backward/forward

*    : W : layer == /\+.*/                                     # layer tag with + sign

*    : I : name == /.*Strasse.*/i                              # street name contains ss

relation : E : type != *                                       # relation without type

node : I : amenity == /restaurant|cafe|fast_food/ && name != * # restaurant without name
#way  : I : highway != * && railway != * && waterway != * && name == * # unusual named way type
#*    : W : natural == water && waterway == *                   # unusual tag combination (natural=water & waterway)
*    : W : highway == * && waterway == *                       # unusual tag combination (highway & waterway)
*    : W : highway == * && natural == *                        # unusual tag combination (highway & natural)

*    : W : natural == water && leisure == swimming_pool       # natural water used for swimming pool
*    : W : natural == water && amenity == swimming_pool       # natural water used for swimming pool

# see ticket #5017
# Taginfo query: select keypairs.key1, keypairs.key2, keypairs.count_all, keys.count_all, cast(keypairs.count_all as real)/keys.count_all as from_fraction_all from keys, keypairs where key1='waterway' and keys.key=keypairs.key2 and (key1<>'highway' or keypairs.count_all>12000) and (key1<>'railway' or keypairs.count_all>3000) and (key1<>'waterway' or keypairs.count_all>800) and key2 not like '%:%' and from_fraction_all>0.97 and 1 union select keypairs.key2, keypairs.key1, keypairs.count_all, keys.count_all, cast(keypairs.count_all as real)/keys.count_all as from_fraction_all from keys, keypairs where key2='waterway' and keys.key=keypairs.key1 and (key2<>'highway' or keypairs.count_all>12000) and (key2<>'railway' or keypairs.count_all>3000) and (key2<>'waterway' or keypairs.count_all>800) and key1 not like '%:%' and from_fraction_all>0.97 and 1 order by keypairs.count_all desc limit 1000;
*    : W : incline              == * && highway != *                                   # incline without highway
way  : W : junction             == * && highway != *                                   # junction without highway
*    : W : lanes                == * && highway != *                                   # lanes without highway
*    : W : lcn                  == * && highway != *                                   # lcn without highway
*    : W : lit                  == * && highway != * && public_transport != platform   # lit without highway
*    : W : living_street        == * && highway != *                                   # living_street without highway
*    : W : maintenance          == * && highway != *                                   # maintenance without highway
*    : W : median               == * && highway != *                                   # median without highway
*    : W : motorroad            == * && highway != *                                   # motorroad without highway
*    : W : ntd_id               == * && highway != *                                   # ntd_id without highway
*    : W : oneway               == * && highway != *                                   # oneway without highway
*    : W : sac_scale            == * && highway != *                                   # sac_scale without highway
*    : W : segregated           == * && highway != *                                   # segregated without highway
*    : W : sidewalk             == * && highway != *                                   # sidewalk without highway
*    : W : smoothness           == * && highway != *                                   # smoothness without highway
*    : W : snowplowing          == * && highway != *                                   # snowplowing without highway
*    : W : step_count           == * && highway != *                                   # step_count without highway
*    : W : toll                 == * && highway != *                                   # toll without highway
*    : W : tracktype            == * && highway != *                                   # tracktype without highway
*    : W : trail_visibility     == * && highway != *                                   # trail_visibility without highway
*    : W : trolley_wire         == * && highway != *                                   # trolley_wire without highway
*    : W : zip_left             == * && highway != *                                   # zip_left without highway
*    : W : zip_right            == * && highway != *                                   # zip_right without highway
*    : W : detail               == * && railway != *                                   # detail without railway
*    : W : eddy_current_brake   == * && railway != *                                   # eddy_current_brake without railway
*    : W : electrified          == * && railway != *                                   # electrified without railway
*    : W : etcs                 == * && railway != *                                   # etcs without railway
*    : W : gauge                == * && railway != *                                   # gauge without railway
*    : W : grade_of_track       == * && railway != *                                   # grade_of_track without railway
*    : W : kursbuchstrecke      == * && railway != *                                   # kursbuchstrecke without railway
*    : W : lzb                  == * && railway != *                                   # lzb without railway
*    : W : old_railway_operator == * && railway != *                                   # old_railway_operator without railway
*    : W : operating_procedure  == * && railway != *                                   # operating_procedure without railway
*    : W : pzb                  == * && railway != *                                   # pzb without railway
*    : W : radio                == * && railway != *                                   # radio without railway
*    : W : structure_gauge      == * && railway != *                                   # structure_gauge without railway
*    : W : tilting_technology   == * && railway != *                                   # tilting_technologie without railway
*    : W : track_class          == * && railway != *                                   # track_class without railway
*    : W : tracks               == * && railway != *                                   # tracks without railway
*    : W : traffic_mode         == * && railway != *                                   # traffic_mode without railway
*    : W : usage                == * && railway != *                                   # usage without railway
*    : W : workrules            == * && railway != *                                   # workrules without railway
*    : W : stream               == * && waterway != *                                  # stream without waterway
*    : W : intermittent         == * && waterway != *                                  # intermittent without waterway
*    : W : boat                 == * && waterway != * && natural != water              # boat without waterway / natural=water
*    : W : length_unit          == * && waterway != *                                  # length_unit without waterway
*    : W : llid                 == * && waterway != *                                  # llid without waterway
*    : W : canal                == * && waterway != *                                  # canal without waterway
*    : W : have_riverbank       == * && waterway != *                                  # have_riverbank without waterway
*    : W : tunnel               == * && highway != * && railway != * && waterway != *  # tunnel without highway/railway/waterway
*    : W : bridge               == * && highway != * && railway != * && waterway != *  # bridge without highway/railway/waterway
*    : W : psv                  == * && highway != * && railway != * && waterway != *  # psv without highway/railway/waterway
*    : W : width                == * && highway != * && railway != * && waterway != * && aeroway != *  # width without highway/railway/waterway/aeroway
*    : W : maxspeed             == * && highway != * && railway != * && traffic_sign != maxspeed # maxspeed without highway/railway/traffic_sign
