ExCEP.Model.Consistency (ex_cep v0.1.1)

Copy Markdown

ICD ↔ Simplified JSON Model consistency verifier per CSG CEP TS2.1 Section 9.3:

"设备的ICD模型和简化模型如果同时提供,二者的数据项应具备对应关系一致性。 数据对象的数量、数据对象名、中文语义和数据对象类型应完全一致。"

Summary

Functions

Verifies consistency between an ICD %ExCEP.Model{} and a simplified JSON %ExCEP.Model{}.

Types

mismatch()

@type mismatch() ::
  {:count_mismatch, non_neg_integer(), non_neg_integer()}
  | {:missing_in_json, String.t()}
  | {:missing_in_icd, String.t()}
  | {:description_mismatch, String.t(), String.t(), String.t()}
  | {:do_type_mismatch, String.t(), String.t(), String.t()}

Functions

verify(icd_model, json_model)

@spec verify(ExCEP.Model.t(), ExCEP.Model.t()) :: :ok | {:error, [mismatch()]}

Verifies consistency between an ICD %ExCEP.Model{} and a simplified JSON %ExCEP.Model{}.

Checks:

  1. Total number of Data Objects (DO) matches.
  2. Every DO matches on DOname (scoped by LDname.LNinst.DOname or DOname), Chinese semantic description, and DOtype (CDC).

Returns :ok or {:error, [mismatch()]}.