Jump to content
切換選單
切換偏好設定選單
切換個人選單
尚未登入
如果您進行編輯,系統將會為您建立一個臨時帳戶。

模組:Infobox/Schema/doc

出自幻跡百科

此頁面為 模組:Infobox/Schema 的說明文件


這是什麼?

本模組是 BenWiki Infobox 的呈現 Schema 解析器。

它處理:

Infobox/Schema/Base
└─ Infobox/Schema/創作者
   └─ Infobox/Schema/VTuber

的繼承與合併。

它描述什麼?

Infobox Schema 描述的是:

已經存在的資料應該如何進入資訊欄。

例如:

  • title source
  • image presentation
  • bodyClass
  • section
  • collection presentation
  • Infobox item order

和 EntitySchema 的差別

模組:EntitySchema 是 canonical data schema。

它負責:

  • 某類 Entity 有哪些資料
  • Property
  • parameter
  • value kind
  • requirement
  • canonical order

Infobox Schema 則只描述 presentation。

因此不要因為某個欄位要出現在資訊欄,就直接把「資料模型」只寫在 Infobox Schema。

合理資訊流:

EntitySchema
    ↓
領域資料定義

Infobox/Schema
    ↓
presentation definition

Adapter
    ↓
normalized model

Infobox
    ↓
Capiunto

繼承規則

Schema 可以:

return {
    extends = '父Schema'
}

解析器會先載入父 Schema,再由子 Schema deep merge。

一般 scalar value 由子層覆寫。

解析完成後會提供:

__name
最終 Schema 名稱。
__lineage
完整繼承路徑。

並檢查 inheritance cycle。

責任邊界

本模組負責:

  • 載入 Infobox Schema
  • extends
  • deep merge
  • cycle detection

本模組不負責:

  • canonical Entity data definition
  • 查詢 SMW
  • 取得模板參數
  • Capiunto rendering
  • Form UI

資料 Schema 請參考:

通用 renderer: