Sdcgovernance

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

Governance validation for Semantic Data Charter instances; returns OASIS XACML decisions.

概覽

AI 產生的概覽

針對 Semantic Data Charter 實例的治理諮詢引擎,讓助理驗證工作流程、認證、參與方/角色與溯源規則,並取得 PERMIT/DENY/INDETERMINATE 決策。

可以做什麼
  • 檢查 SDC 模型定義了哪些治理構面並回報啟用狀況
  • 驗證工作流程狀態轉換,判斷擬議轉換是否被允許
  • 對實例執行完整治理驗證,回傳錯誤與決策憑據
  • 以 W3C PROV-O 紀錄形式寫入溯源事件
  • 依 table_id 與版本註冊、列出並評估 DMN 決策表
  • 透過重算雜湊驗證 MTCP 證據包的完整性
適用情境
適合助理處理帶有治理內容的 Semantic Data Charter 資料模型與實例時,需要在代理工作流程中把關流程步驟、檢查認證或參與方/角色要求,或產生可稽核的決策憑據。
執行需求
以 Python 套件 sdcgovernance 透過 uvx 在本機以 stdio 執行,需要 Python 執行環境與 uv。未宣告驗證、環境變數或標頭。需提供 SDC 模型(XSD)與 XML 實例,依賴 rdflib 與 pyshacl。
安裝前請注意
它只提供諮詢性決策與憑據,決策後的路由、升級或中止由呼叫端自行實作。註冊決策表會寫入磁碟檔案,且已註冊版本不可變更。模型未定義治理元件時結果為 PERMIT,因此缺少治理不會被標示為失敗。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

sdcgovernance

W3C standards-based governance advisory engine for Semantic Data Charter instances.

A Python library that validates governance content in XML data instances against governance components defined in the SDC data model. If the model defines governance (workflow, attestation, party/role, provenance, audit), the instance must carry that content - and this library validates it.

Returns decisions using OASIS XACML semantics: PERMIT, DENY, or INDETERMINATE.

No framework dependency. No middleware. A function call.

How It Works

SDC data models (XSD) can optionally include governance components: Workflow state machines, Attestation authority requirements, Party/Role constraints, Provenance requirements, and Audit definitions. These are part of the data model, not a separate governance layer.

When governance components are defined, every XML data instance must carry the corresponding governance content. This library validates that content against the model:

python
from sdcgovernance import validate_governance
result = validate_governance("model.xsd", "instance.xml")
print(result.decision)      # PERMIT, DENY, or INDETERMINATEprint(result.has_governance) # True if model defines governance componentsprint(result.errors)         # list of governance validation errorsprint(result.receipt)        # tamper-evident decision receipt

If the model does not define governance components, the result is PERMIT - no governance to enforce.

Two Independent Libraries

sdcvalidator and sdcgovernance are separate, independent libraries. There is no hook, no chaining, no automatic invocation of one from the other.

sdcvalidator (structural validation)    Does the instance conform to the XSD schema?    Single-pass. Instance in, pass/fail out.
sdcgovernance (governance advisory)    Does the model define governance components?    If yes: does the instance carry valid governance content?    Conversational. Agents query multiple times during a workflow.

Both libraries read the schema from the instance. Agents call each one independently, at different points in a workflow, in whatever order the operational logic requires. A single workflow may involve multiple calls to both libraries.

What Gets Validated

ComponentWhat the model definesWhat the instance must carry
WorkflowCluster tree of valid paths (sub-clusters with XdOrdinal states)Current XdOrdinal state, proposed transition validated against ordinal adjacency in valid paths
AttestationAuthority requirements per actionAttestation with correct role, party reference, timestamp
Party/RoleRole constraints for governed actionsActing party identification with required role
Provenance/AuditProvenance requirements (PROV-O) + retention policy (DPV)PROV-formatted record(s) per retention policy: most recent + hash, last N, or full chain

Governance components are discovered by their position in the DMType root (fixed RM slots: workflow, attestation, party/role, audit, and related), not by CUID2 identity. Once a slot is found, its content is validated by vocabulary binding against the relevant standard (PROV-O, SCXML, VC, DPV). Any component occupying the right slot and bound to the right vocabulary is recognized - whether it comes from the Default project or was custom-built.

Enforcement Decisions (OASIS XACML)

DecisionMeaning
PERMITAll governance checks pass - action is authorized
DENYOne or more governance checks fail - action is refused
INDETERMINATEGovernance checks partially pass - requires review (configurable)

Every decision produces a W3C PROV record and a SHA-256 hash-chained receipt.

What happens after the decision is the agent's responsibility. sdcgovernance issues the decision and the receipt. The operational response - routing, escalation, notification, halting - is customer business logic that varies per implementation.

Two Interfaces, One Engine

Python API - for direct integration:

python
from sdcgovernance import validate_governance
result = validate_governance("model.xsd", "instance.xml")

MCP Server - for any agent framework:

bash
sdcgovernance            # what an MCP registry client runs (uvx sdcgovernance)sdcgovernance mcp        # the same, spelled like the other Semantic Data Charter serverssdcgovernance serve --mcp   # still works for existing client configurations

A client configuration needs only "command": "uvx", "args": ["sdcgovernance"].

The MCP server exposes governance as tools that agents call. The agent runs the loop. sdcgovernance advises.

Standards

  • OASIS XACML - decision semantics (PERMIT/DENY/INDETERMINATE)
  • SDC native structure + W3C SCXML concepts - workflow sequencing via XdOrdinal components in sub-cluster paths, borrowing the concepts of state and transition from automata theory as specified in W3C SCXML
  • W3C PROV (PROV-O, PROV-DM) - provenance/audit records (one governance dimension)
  • W3C Data Privacy Vocabulary (DPV) - provenance retention policy (same vocabulary used for SDC access control)
  • W3C Activity Streams 2.0 - activity/event type vocabulary
  • W3C Verifiable Credentials Data Model 2.0 - attestation authority pattern
  • W3C SHACL - cross-entity constraint validation
  • OMG DMN - decision tables for complex governance rules
  • SHA-256 - tamper-evident hash chains for decision receipts

Architecture

src/sdcgovernance/├── __init__.py          # Public API: validate_governance()├── engine.py            # GovernanceEngine - the decision engine agents query├── model_inspector.py   # Inspect SDC model for governance components├── workflow.py          # Validate workflow transitions in instance├── attestation.py       # Validate attestation content in instance├── party_role.py        # Validate party/role constraints in instance├── provenance.py        # Validate provenance/audit records + PROV generation + DPV retention policy├── decision.py          # DMN decision table evaluation + content hash├── tables.py            # Decision table registry: id, version, hash; files on disk├── receipts.py          # Decision receipt chain (hash-chained)├── shacl_runtime.py     # SHACL cross-entity constraint validation└── mcp_server.py        # MCP server exposing governance tools to any agent

Pure Python. No Django. No middleware. No web framework dependency.

Installation

bash
pip install sdcgovernance

Integration with SDC Ecosystem

  • sdcvalidator - independent structural validation library. Agents call it separately from sdcgovernance, at different points in a workflow.
  • SDCStudio - models governance components visually. The XSD output includes governance definitions that sdcgovernance validates against.
  • AppGen - generated applications can call validate_governance() at data entry boundaries.
  • SDC Agents - reference implementations showing how to wire governance MCP tools into agentic workflows using Default project governance models. Customer agents connect to the same MCP server and use the tools however they want.

Status

Production-ready. Available on PyPI under Apache 2.0.

Dependencies

  • rdflib - RDF/PROV record generation
  • pyshacl - SHACL constraint validation

License

Apache 2.0

來源:README.md,提交 abf62ec

工具

9

get_governance_status

Report which governance dimensions the model defines. Returns model_id, model_label, has_governance, and active dimensions.

輸入參數schema_path必填

get_allowed_transitions

Get valid next states from the current workflow state. Returns list of valid transitions with target state info and path(s).

輸入參數schema_path必填instance_path必填

evaluate_transition

Evaluate whether a specific workflow transition is permitted. Returns PERMIT/DENY/INDETERMINATE with receipt.

輸入參數actorschema_path必填target_state必填instance_path必填

validate_governance

Full governance validation of an instance against its model. Returns decision, has_governance, errors, dimensions_validated.

輸入參數schema_path必填instance_path

record_provenance

Record a provenance event as a W3C PROV-O record. Returns the PROV record content.

輸入參數agent_refentity_idsystem_idagent_name必填descriptionactivity_type必填entity_hash_afterentity_hash_before

evaluate_decision

Evaluate a DMN decision table against instance context. Name the table by table_id (and table_version; the highest registered version when omitted) for a governed evaluation, or pass it inline as table_json for an ad-hoc one. Returns decision, matched_rules, reasoning, errors, the table's identity and content hash, and a tamper-evident Receipt whose receipt_hash covers table_id, table_version and table_hash as well as context_hash. instance_path is optional: when omitted, the decision is evaluated against extra_context alone, which is the path external context-only consumers (e.g. MTCP Evidence Packs) should use. Pass previous_hash to chain receipts; the caller is responsible for chain persistence.

輸入參數table_idtable_jsoninstance_idcontext_hashextra_contextinstance_pathprevious_hashtable_versioninstance_version

register_decision_table

Register a decision table under a stable table_id and an immutable version, so evaluate_decision can name it and every Receipt it produces records which policy version applied. Returns table_id, version, table_hash (SHA-256 of the table's RFC 8785 canonical JSON), domain and policy. Registering the same content again under the same id and version is a no-op; different content under an existing id and version is refused: register it as a new version. Persists to the server's tables directory when one is configured.

輸入參數domainpolicyversion必填table_id必填table_json必填

list_decision_tables

List the registered decision tables: table_id, version, table_hash, domain, policy and registered_at for each version, lowest version first. Filter by table_id or domain. With table_id the full table JSON of each version is included, which is how a receipt's table_id and table_version are resolved back to the rules that applied.

輸入參數domaintable_id

verify_evidence_pack

Verify the integrity of an MTCP Evidence Pack by recomputing its evidence_pack_hash. Returns valid (bool), computed_hash, and expected_hash. Canonicalization follows RFC 8785: keys sorted, no whitespace, comma-colon separators, UTF-8.

輸入參數evidence_pack必填

版本歷史

6
  1. v4.3.1最新Oct 26, 2026
  2. v4.3.0Oct 18, 2026
  3. v4.2.4Sep 28, 2026
  4. v4.2.3Sep 17, 2026
  5. v4.2.1Sep 16, 2026
  6. v4.2.0Sep 16, 2026

評分

已滿足適用檢查項的 90%

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

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

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

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