{
  "type": "Decision",
  "domain": "decision",
  "description": "1 件のエンティティについての、1 件の自動判定です。規則の集まりが出す問いへのモデルの答え（確率付き）と、その結果の行動を持ちます。",
  "contextUrl": "https://datamodels.jp/context/decision/v1.jsonld",
  "propertyDetails": {
    "refersTo": {
      "ngsiType": "Relationship",
      "valueType": "uri",
      "example": "urn:ngsi-ld:RoadRestriction:0001",
      "required": false,
      "description": "判定の対象（入力）のエンティティ。refersTo か externalReference のどちらかが必須です。",
      "@context": "http://www.w3.org/ns/prov#used"
    },
    "externalReference": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": null,
      "required": false,
      "description": "対象がブローカーのエンティティでないときの参照（例：Issue の URL）",
      "@context": "https://datamodels.jp/ns/decision/externalReference"
    },
    "action": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "review",
      "required": true,
      "description": "規則が出した行動。次に何が起きるかを表します（例：auto、review、publish、urgent）。値は規則の集まりが定めます。",
      "@context": "https://datamodels.jp/ns/decision/action"
    },
    "answers": {
      "ngsiType": "JsonProperty",
      "valueType": "array",
      "example": {
        "json": [
          {
            "name": "category",
            "type": "choice",
            "value": "closedWeather",
            "probability": 0.81,
            "probabilities": {
              "closedWeather": 0.81,
              "closedConstruction": 0.02,
              "closedHeavyVehicle": 0.01,
              "closedWinter": 0,
              "laneRestriction": 0.09,
              "alternatingOneWay": 0.05,
              "mobileRestriction": 0,
              "chainRestriction": 0,
              "chainGuidance": 0,
              "other": 0.02
            }
          },
          {
            "name": "status_matches",
            "type": "noul",
            "value": true,
            "probability": 0.92
          },
          {
            "name": "danger",
            "type": "noul",
            "value": false,
            "probability": 0.58
          },
          {
            "name": "clarity",
            "type": "score",
            "value": 3,
            "probability": 0.74,
            "probabilities": {
              "0": 0.02,
              "1": 0.06,
              "2": 0.18,
              "3": 0.74
            }
          }
        ]
      },
      "required": true,
      "description": "モデルの答え。問いごとに 1 つで、それぞれに確率が付きます。各要素は name（問いの名前）、type、value、probability（value の確率）を持ちます。type は noul（はい・いいえ）、choice（選択肢から 1 つ）、score（順序のある段階）のどれかです。choice と score では、probabilities（選択肢や段階ごとの確率）も持ちます。",
      "@context": "https://datamodels.jp/ns/decision/answers"
    },
    "facts": {
      "ngsiType": "JsonProperty",
      "valueType": "array",
      "example": {
        "json": [
          {
            "name": "flood",
            "missing": false,
            "values": {
              "inside": true,
              "rank": 4,
              "class": "1 to 3 m"
            },
            "source": "gsi-flood-max"
          }
        ]
      },
      "required": false,
      "description": "規則の集まりが求めた空間の事実を、この判定のために調べた結果です（当たった規則が使ったかどうかは問いません）。モデルではなく、空間の演算で求めた値です（例：浸水想定区域の中か、最寄りの避難場所までの距離）。各要素は name と missing を持ちます。求められたときは values（項目ごとの値）と source（出どころ）、求められなかったときは reason（no_location、unavailable、timeout、error）も持ちます。求められなかった事実を使う規則は当たりません。",
      "@context": "https://datamodels.jp/ns/decision/facts"
    },
    "profile": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "road-restriction-check",
      "required": true,
      "description": "問いを出し、答えを行動に変えた規則の集まりの ID",
      "@context": "https://datamodels.jp/ns/decision/profile"
    },
    "profileVersion": {
      "ngsiType": "Property",
      "valueType": "integer",
      "example": 1,
      "required": true,
      "description": "規則の集まりの版",
      "@context": "https://datamodels.jp/ns/decision/profileVersion",
      "validation": {
        "minimum": 1
      }
    },
    "policyRule": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "default",
      "required": false,
      "description": "行動を出した規則。0 から数えた番号を文字列で書き（\"0\"、\"1\" など）、どの規則にも当たらなかったときは \"default\" です。判定の根拠になります。",
      "@context": "https://datamodels.jp/ns/decision/policyRule",
      "validation": {
        "pattern": "^(0|[1-9][0-9]*|default)$"
      }
    },
    "model": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "clef-flash",
      "required": true,
      "description": "答えたモデルの ID",
      "@context": "https://datamodels.jp/ns/decision/model"
    },
    "decidedAt": {
      "ngsiType": "Property",
      "valueType": "datetime",
      "example": "2026-07-08T10:46:12+09:00",
      "required": true,
      "description": "判定した日時",
      "@context": "http://www.w3.org/ns/prov#endedAtTime"
    },
    "humanInvolvement": {
      "ngsiType": "VocabProperty",
      "valueType": "string",
      "example": {
        "vocab": "dpv:HumanInvolvementForVerification"
      },
      "required": false,
      "description": "人の関わり方（W3C DPV の語）：dpv:HumanInvolvementForVerification（行動の前に人が確認する）、dpv:HumanInvolvementForOversight（行動はそのまま行い、人が後から確認・修正できる）、dpv:HumanInvolvementForDecision（人が決め、答えは参考にする）、dpv:HumanNotInvolved（人は関わらない）",
      "@context": "https://w3id.org/dpv#hasHumanInvolvement",
      "validation": {
        "enum": [
          "dpv:HumanInvolvementForVerification",
          "dpv:HumanInvolvementForOversight",
          "dpv:HumanInvolvementForDecision",
          "dpv:HumanNotInvolved"
        ]
      }
    },
    "reviewStatus": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "resolved",
      "required": false,
      "description": "人による確認の状態：pending（確認待ち）か resolved（確認済み）。確認を求めないときは省きます。",
      "@context": "https://datamodels.jp/ns/decision/reviewStatus",
      "validation": {
        "enum": [
          "pending",
          "resolved"
        ]
      }
    },
    "finalAction": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "publish",
      "required": false,
      "description": "人が確認した後の行動",
      "@context": "https://datamodels.jp/ns/decision/finalAction"
    },
    "reviewedBy": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "staff-0012",
      "required": false,
      "description": "確認した人。アカウント、役割、チームの識別子で、個人名は入れません。",
      "@context": "https://datamodels.jp/ns/decision/reviewedBy"
    },
    "reviewedAt": {
      "ngsiType": "Property",
      "valueType": "datetime",
      "example": "2026-07-08T10:52:40+09:00",
      "required": false,
      "description": "確認した日時",
      "@context": "https://datamodels.jp/ns/decision/reviewedAt"
    },
    "corrections": {
      "ngsiType": "JsonProperty",
      "valueType": "array",
      "example": {
        "json": [
          {
            "name": "category",
            "value": "closedWeather",
            "by": "staff-0012",
            "at": "2026-07-08T10:52:40+09:00",
            "note": "冠水による通行止めで間違いない"
          }
        ]
      },
      "required": false,
      "description": "人が直した答え（モデルの正しさを測るための正解データ）。各要素は name、value、by（識別子）、at を持ち、note は任意です。",
      "@context": "https://datamodels.jp/ns/decision/corrections"
    },
    "wasInformedBy": {
      "ngsiType": "Relationship",
      "valueType": "uri",
      "example": null,
      "required": false,
      "description": "判定が続いているときの、この判定の前の判定",
      "@context": "http://www.w3.org/ns/prov#wasInformedBy"
    }
  },
  "additionalProperties": false
}
