{
  "name": "GeocodingResult",
  "description": "The result of geocoding one address: the address as a JapaneseAddress, the point, and what the geocoding did (how much of the input matched, from which level the coordinates come, which geocoder and data). Type https://models.geolonia.com/ns/geocoding#GeocodingResult; @context https://models.geolonia.com/context/geocoding/v0.jsonld.",
  "strict": true,
  "schema": {
    "type": "object",
    "properties": {
      "query": {
        "type": "string",
        "description": "The address text given to the geocoder, unchanged (not empty)"
      },
      "address": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "addressCountry": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "JP",
              null
            ],
            "description": "Country. Always JP"
          },
          "postalCode": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{3}-?\\d{4}$",
            "description": "Postal code, 7 digits with or without hyphen"
          },
          "addressRegion": {
            "type": [
              "string",
              "null"
            ],
            "description": "Prefecture name"
          },
          "addressLocality": {
            "type": [
              "string",
              "null"
            ],
            "description": "Municipality name. For designated cities includes the ward (e.g. 横浜市中区)"
          },
          "machiaza": {
            "type": [
              "string",
              "null"
            ],
            "description": "Town or district name (町字: 町名, 大字, 字), without chome"
          },
          "chome": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d+$",
            "description": "Chome (丁目), digits only (\"一丁目\" → \"1\")"
          },
          "banchi": {
            "type": [
              "string",
              "null"
            ],
            "description": "Banchi (番地): in a residential-indication area the block number (街区符号); elsewhere the whole lot number (地番), branch number included, for example 4638-1"
          },
          "go": {
            "type": [
              "string",
              "null"
            ],
            "description": "Go (号): in a residential-indication area the residence number (住居番号). Empty for a lot number (地番): its branch number stays in banchi"
          },
          "buildingName": {
            "type": [
              "string",
              "null"
            ],
            "description": "Building name, room number and anything below go"
          },
          "residentialIndication": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "true in a residential-indication area (banchi/go are block and residence numbers), false for lot numbers (地番)"
          },
          "jisPrefectureCode": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}$",
            "description": "Prefecture code (JIS X 0401, 2 digits)"
          },
          "jisMunicipalityCode": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{5}$",
            "description": "Municipality code (JIS X 0402, 5 digits including the prefecture code)"
          },
          "localGovernmentCode": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{6}$",
            "description": "Local government code (全国地方公共団体コード: JIS X 0402 plus a check digit, 6 digits)"
          },
          "abrMachiazaId": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{7}$",
            "description": "Address Base Registry town id (町字ID, 7 digits). Unique together with localGovernmentCode"
          },
          "addressText": {
            "type": [
              "string",
              "null"
            ],
            "description": "Full address as one normalised line. Also the fallback when structured fields are unavailable"
          }
        },
        "required": [
          "addressCountry",
          "postalCode",
          "addressRegion",
          "addressLocality",
          "machiaza",
          "chome",
          "banchi",
          "go",
          "buildingName",
          "residentialIndication",
          "jisPrefectureCode",
          "jisMunicipalityCode",
          "localGovernmentCode",
          "abrMachiazaId",
          "addressText"
        ],
        "additionalProperties": false,
        "description": "The matched address, as a JapaneseAddress value (datamodels.jp common subject). addressText holds the geocoder's normalised address line"
      },
      "unmatchedParts": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string"
        },
        "description": "Parts of the input the geocoder could not match, in input order (for example a building name and floor)"
      },
      "matchLevel": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "prefecture",
          "city",
          "machiaza",
          "machiazaDetail",
          "residentialBlock",
          "residentialNumber",
          "parcel",
          null
        ],
        "description": "The most detailed level of the address that matched. parcel (a lot number) is an alternative to the two residential levels, not more detailed than them. Left out when no value fits; the geocoder's own value is in matchLevelLabel"
      },
      "coordinateLevel": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "prefecture",
          "city",
          "machiaza",
          "machiazaDetail",
          "residentialBlock",
          "residentialNumber",
          "parcel",
          null
        ],
        "description": "The level of the address the coordinates belong to. Can be less detailed than matchLevel, for example when the geocoder only has a point for the town"
      },
      "matchLevelLabel": {
        "type": [
          "string",
          "null"
        ],
        "description": "The match level as the geocoder writes it, unchanged, as text: a geocoder that returns a number gives it as text (for example rsdtdsp_rsdt, or \"3\")"
      },
      "geocoder": {
        "type": [
          "string",
          "null"
        ],
        "description": "Name of the geocoder that made the result"
      },
      "geocoderVersion": {
        "type": [
          "string",
          "null"
        ],
        "description": "Version of the geocoder"
      },
      "datasetVersion": {
        "type": [
          "string",
          "null"
        ],
        "description": "Version of the address data the geocoder used"
      },
      "dateGeocoded": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "description": "When the address was geocoded"
      },
      "location": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Point"
            ]
          },
          "coordinates": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "[longitude, latitude] in WGS 84, optionally with the altitude as a third number"
          }
        },
        "required": [
          "type",
          "coordinates"
        ],
        "additionalProperties": false,
        "description": "The point the geocoder found, as a GeoJSON Point A GeoJSON geometry (Point)."
      }
    },
    "required": [
      "query",
      "address",
      "unmatchedParts",
      "matchLevel",
      "coordinateLevel",
      "matchLevelLabel",
      "geocoder",
      "geocoderVersion",
      "datasetVersion",
      "dateGeocoded",
      "location"
    ],
    "additionalProperties": false
  }
}
