Sdcreader

io.github.SemanticDataCharter由 GitHub 帳號 SemanticDataCharter 發布v4.4.1更新於 Nov 2, 2026

Read published Semantic Data Charter models: catalog search, record structure, codes, pinned schema.

概覽

AI 產生的概覽

讀取已發布的 Semantic Data Charter 模型:可從 SDCStudio 公開目錄或本機套件取得目錄檢索、結構、代碼、固定 schema 與受管紀錄。

可以做什麼
  • 以文字檢索公開目錄,或依名稱列出某個公開專案的模型
  • 描述單一模型:標題、專案、根紀錄、葉節點與元件數量、Dublin Core、固定 SHA-256 的 schema 網址
  • 依文件順序分頁列出模型的葉節點及其路徑、型別、限制與識別連結
  • 列出某個元件的列舉值及其 IRI、定義與代碼系統
  • 檢查套件目錄的完整性並回傳 SHA-256 與固定 schema 網址
  • 依模型讀取磁碟上的受管資料紀錄:屬性、各值、脈絡與例外值
適用情境
適合處理 Semantic Data Charter / SDC4 模型的情境:讓助理檢視已發布模型的結構與代碼、讀取受管資料紀錄,或在把模型投影到 DCAT、CDIF 等其他標準前核對套件。
執行需求
以 stdio 方式在本機執行,通常透過 uvx 啟動 PyPI 套件 sdcreader(Python)。不需要帳號、API 金鑰或環境變數。使用目錄檢索與 ct_id 查詢時需連線至 SDCStudio 公開目錄主機,主機可在啟動時以命令列參數指定;套件目錄與紀錄相關工具只處理本機檔案。
安裝前請注意
所有工具皆為唯讀且不需帳號,且沒有工具接受 URL,目錄主機在啟動時即固定。紀錄與套件從你指定的本機路徑讀取。讀取器不會對值做型別化、驗證或解讀,這部分仍由呼叫端負責。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Sdcreader,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

sdcreader

Read a published Semantic Data Charter model's package for projection into other standards.

A projection describes a model's governed data records in another standard's terms: CDIF, DCAT-US 3.0, DCAT-AP 3.0.1, HealthDCAT-AP, and whatever comes next. What every projection describes is the same evidence, the model's package, and reads it into the same shape. sdcreader is that evidence and that shape, once, with nothing about any projection in it. The four projection writers (sdc_cdif, sdc_dcat3_us, sdc_dcat3_ap, sdc_healthdcat_ap) carried it as identical copies until this package.

pip install sdcreader            # the reader, with HTTP for fetching from the public catalog (since 4.1.0 no extra is needed)
python
from sdcreader import fetch_package, load_package, read_model
pkg = load_package("samples/nhanes-participant")          # a package on diskpkg = fetch_package("xy8upneajsb8vdcmnve01g6g", save_to="pkg/")   # or from SDCStudio's public catalog, no accountmodel = read_model(pkg)
pkg.schema_url_pinned        # https://sdcstudio.axius-sdc.com/dmlib/dm-xy8u...xsd?sha256=0df4...   the exact bytes the records are validated againstmodel.title, model.leaves    # 'NHANES Participant', 153 leaves in document order, each with its path of clustersmodel.codes[ct_id]           # the enumerated values of a component with the IRI, definition and code the schema annotates them withmodel.dc("publisher")        # what the modeler wrote, None where SDCStudio's default sits

What a package is

SDCStudio generates a package for every published model and serves it publicly for models in public projects:

GET /api/v1/catalog/dm/<ct>/the catalog record: title, description, project, the artifact list (catalog.json)
GET /api/v1/catalog/dm/<ct>/<artifact>/a storage pointer, {"download_url": ..., "filename": ..., "storage": "gcs"}, for jsonld, xsd and the rest; the reader follows it
dm-<ct>.jsonldthe model and its components: type, label, description, cardinality, constraints (enumerations, units, ranges, patterns), semantic links (dcterms:identifier the library slot, dcterms:source, dcterms:publisher, skos:exactMatch, rdfs:seeAlso, prov:wasRevisionOf), contains
GET /dmlib/dm-<ct>.xsdthe schema bytes: the Dublin Core header for the model, and for each enumerated value its definition and the code it is defined by (dm-<ct>.xsd)
GET /dmlib/dm-<ct>.versions.jsonevery published version of the schema by SHA-256, with the current one (versions.json)

A package directory holds those four files. The reader refuses a directory without the JSON-LD and the schema, a JSON-LD whose identifier is not the directory's model, and a schema whose bytes are not the published current version: a projection cites the schema by URL and SHA-256, so the bytes have to be the ones that URL serves.

Two gaps in the package are on SDCStudio's issue tracker: the JSON-LD metadata drops fields the schema header carries (#748), and the header omits dc:source (#749). The reader takes the model's Dublin Core from the header, which is complete.

What the reader gives

  • ModelPackage: the four files, the SHA-256, the schema URL and its pinned form (?sha256=), the public catalog URL, and check().
  • Model: title, description, root (the governed record's cluster), components by identifier, leaves in document order (each a Leaf with its component, its path of clusters and a slug of that path, unique in the record), codes (the enumerated values per component as Code: value, IRI, definition, the code it is defined by), metadata (the JSON-LD's) and header (the schema's Dublin Core).
  • Model.dc(name): what the modeler wrote, the header first and the JSON-LD second, with SDCStudio's field defaults as unset: "Universal" for coverage, "None" for relation, "SDC Data Model (DM)" for type, blanks. A projection never publishes a default as a fact. contributors, subjects (the semicolon list), rights_url and rights_statement derive from it.
  • Component: sdc_type, label, description, data_type, constraints, links by predicate (link(p) for the first), contains, iri.
  • Constants: the leaf, numeric and quantified types; the predicate IRIs IDENTIFIER, SOURCE, PUBLISHER, EXACT, CLOSE, SEE_ALSO, HAS_UNIT; DC_DEFAULTS.

Reading a record (4.3.0)

read_record(source, model) reads a Governed Data Record, the XML instance, and joins each value to the component that defines it. source is the record's bytes, its text or a path; a record of another model is refused (RecordError), as is anything that is not an sdc4:dm-<ct_id> record.

  • Record: attributes (instance_id, instance_version, creation_timestamp, current-state, ...), values in document order, and exceptional, the values that carry an Exceptional Value.
  • RecordValue: the component, its path of clusters (root first), instances parallel to the path (which occurrence each cluster is among the same cluster's repeats under the same parent; instance_key pairs them with the clusters' identifiers, one key per cluster instance), an occurrence index for a component repeated within its cluster instance, its position, its elements as the record holds them (a quantity's units nested: {"xdquantity-value": "1", "xdquantity-units": {"label": "Trade Units", "xdstring-value": "EA"}}), and its context (act, vtb, vte, tr, modified, latitude, longitude).
  • ExceptionalValue: the ISO 21090 null flavor (code, name) and its origin: source when it stands in place of the value, recovery when sdcvalidator's recovery inserted it beside a value that failed its constraint. For recovery, RecordValue.rejected is that value, kept so a person can see it.

Cluster members sit inside adapter elements that are not components of the model; the reader passes through them. It does not type, validate or interpret values: that is the caller's work (a mapper, an exporter, a checker).

MCP server

sdcreader is also an MCP server, registered as io.github.SemanticDataCharter/sdcreader, so an assistant can read a published model the way sdcvalidator, sdcgovernance and sdcreceipt let it validate, govern and settle a record. stdio, no SDK, no account, read-only.

uvx sdcreader                    # or: sdcreader-mcp, or python -m sdcreader.mcp_serveruvx sdcreader --host https://your-sdcstudio.example   # a sovereign SDCStudio's public catalog
ToolDoes
find_modelssearch the public catalog by text, or list a public project's models by name
describe_modelone model: title, project, root record, leaf and component counts by type, Dublin Core with SDCStudio's defaults as null, the schema URL pinned to its SHA-256
list_leavesthe leaves in document order with path, type, constraints, code count and identity links, paged
list_codesone component's enumerated values with IRI, definition and code system
check_packagethe reader's integrity check on a package directory
read_recorda Governed Data Record on disk read against its model: attributes, then each value with its component, path, elements, context and Exceptional Value, paged; the model is the one the record names unless a source is given

Each model tool takes a ct_id (fetched from the host the server was started with) or a package directory on disk. No tool takes a URL: the host is fixed at start, so a caller cannot point the server elsewhere. Every tool calls the same functions as the library; the two interfaces describe one model the same way.

Tests

pip install -e ".[dev]"python -m pytest tests -q                    # includes one fetch against productionpython -m pytest tests -q -m "not network"   # offline, as CI runs it

The fixture is the NHANES Participant package of the FAIR Data Demo, the record every projection is proven on.

Versioning

The leading 4 is the SDC4 reference model, as with every Semantic Data Charter package. An addition to what the reader exposes is a minor version, a fix a patch; the major changes only when the reference model does.

License

Apache-2.0 (see LICENSE, NOTICE).

來源:README.md,提交 743f9a4

工具

6

find_models

Search SDCStudio's public catalog of published models by text, or list the models of one public project by name. Needs no account. Returns identifiers, titles and projects; pass an identifier to describe_model.

輸入參數pagesearchprojectpage_size

describe_model

Describe one published model: title, description, project, the root record, how many leaves and components it has and of which types, its Dublin Core as the modeler wrote it (defaults reported as null), its semantic links, and the schema URL pinned to the SHA-256 of the bytes every record is validated against.

輸入參數ct_iddirectory

list_leaves

The model's leaves in document order, each with its path of clusters, its SDC4 type, its constraints, how many enumerated values it has and its identity links. Paged: a model can have more than a thousand leaves.

輸入參數ct_idlimitoffsetdirectory

list_codes

The enumerated values of one component in a model: each value with the IRI, definition and code system the published schema annotates it with.

輸入參數ct_idcomponent必填directory

read_record

Read a Governed Data Record (an XML file on disk) against its model: the record's attributes and each value in document order with its component, path of clusters, elements, context and any Exceptional Value (ISO 21090 code, name, and whether it was written at the source or inserted by recovery beside a rejected value). The model is the one the record names, fetched by its identifier unless ct_id or directory is given. Paged. Does not validate the record.

輸入參數ct_idlimitoffsetrecord必填directory

check_package

Run the reader's integrity check on a package directory: the JSON-LD names the directory's model, it has components, the schema is an XML Schema, and its bytes are the published current version when versions.json is present. Returns the SHA-256 and the pinned schema URL.

輸入參數directory必填

版本歷史

4
  1. v4.4.1最新Oct 26, 2026
  2. v4.4.0Oct 25, 2026
  3. v4.3.1Oct 25, 2026
  4. v4.2.0Oct 13, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分