{"id":"meta-wiki-art-bridge","relativePath":"meta-wiki-art-bridge.md","title":"Meta Wiki Art Bridge (MediaWiki + Wikibase)","markdown":"# Meta Wiki Art Bridge (MediaWiki + Wikibase)\n\nStatus: Era C5 implementation is active, with the source-of-truth contract finalized.\n\n## Decision\n\nMeta Museum will use a **MediaWiki instance extended with a custom Wikibase** as the publication surface for the Meta Wiki Art bridge.\n\nThis extends the existing C5 plan from \"publish to MediaWiki\" to a structured semantic publication model that supports statement-level references and authority reconciliation.\n\n## Source-Of-Truth Contract (Finalized)\n\nChosen model: **publication-target-only**.\n\n- Canonical source of truth: Meta Museum internal Linked Art records in Postgres/storage (`/api/records` domain model).\n- Wiki role: governed publication projection layer (MediaWiki narrative + Wikibase statements/references).\n- Edit ownership: publication content may evolve on wiki, but canonical data corrections must flow through Meta Museum ingest/reconciliation pipelines first.\n- Publish gate: `/api/wiki-drafts/[id]/publish` preflight now requires the draft `sourceRecordId` to resolve to an existing internal record.\n- Runtime policy key: `METAMUSEUM_WIKI_SOURCE_OF_TRUTH_MODE` (default and current enforced mode is `publication-target-only`).\n\nCommunity-editable mode now requires explicit opt-in and reverse-ETL enablement:\n\n- `METAMUSEUM_WIKI_SOURCE_OF_TRUTH_MODE=community-editable`\n- `METAMUSEUM_WIKI_REVERSE_ETL_ENABLED=1`\n\nReverse-ETL endpoint:\n\n- `POST /api/wiki-sync/reverse-etl`\n\nDeterministic merge policy (implemented):\n\n1. Resolve internal target record via explicit `internalEntityId` or bidirectional sync map (`wikiItemId` -> internal ID).\n2. Normalize + sort incoming claims deterministically (`property`, `modifiedAt`, `changeId`, `value`).\n3. Apply per-property precedence:\n   - newer `modifiedAt` wins;\n   - tie-break by lexicographic `changeId`;\n   - older/equal precedence claims are skipped.\n4. Idempotency:\n   - replayed `changeId` is skipped safely.\n5. Mapped claim updates:\n   - `P_label` -> record `_label`\n   - `P_primary_name` -> first `identified_by` Name\n   - `P_description` -> `referred_to_by` statement (`Wikibase Description`)\n   - `P_publish_rights_status` -> `referred_to_by` statement (`Wikibase Publish Rights Status`)\n6. Unmapped claim properties remain no-op for record fields but are tracked in merge state for deterministic conflict handling.\n\n## Why this fits\n\n1. Linked Art alignment:\n   Linked Art JSON-LD, RDF modeling, and planned SPARQL workflows map directly to Wikibase's item/property statement model.\n2. AI grounding:\n   C4 Graph-RAG and NL→SPARQL require verifiable, structured entities; Wikibase supplies a strong query/citation substrate.\n3. Provenance requirements:\n   Meta Museum's \"cite or refuse\" rule is reinforced by Wikibase statement references and qualifiers.\n4. Authority reconciliation:\n   B6/C2 authority-cache work (AAT/ULAN/TGN/Wikidata/GeoNames/LoC) maps naturally to external IDs and exact-match links in Wikibase.\n\n## Sequencing constraints\n\nThis bridge is intentionally deferred until Era C5. It must not ship before Era B hardening is complete.\n\nRequired gates before write-path activation:\n\n1. SHACL validation stable (B2).\n2. Postgres as storage of record (B3 cutover complete).\n3. Auth + role-gated write paths and auditability (B4).\n4. Authority cache and reconciliation baselines established (B6/C2).\n\n## Planned C5 flow\n\n1. Curator/agent creates `WikiDraft`.\n2. Draft enters human review queue with rights + citation checks.\n3. Approved draft publishes to MediaWiki/Wikibase:\n   - narrative article content (MediaWiki),\n   - structured claims + references (Wikibase),\n   - source attribution + rights templates.\n4. Publish action writes an audit trail and stores return identifiers for round-trip sync.\n\n## Boundaries (Out Of Scope For Era A/B)\n\n1. Live MediaWiki/Wikibase provisioning in current app runtime.\n2. Public write automation from agents without explicit human approval.\n3. Direct external-authority query on request path.\n\n## Migration operations playbook\n\nFor cost-first rollout (Wikibase Cloud now) with a controlled path to self-hosted Wikibase later, use:\n\n- [wikibase-cloud-migration-checklist.md](wikibase-cloud-migration-checklist.md)\n","sections":[{"level":2,"heading":"Decision","anchor":"decision"},{"level":2,"heading":"Source-Of-Truth Contract (Finalized)","anchor":"source-of-truth-contract-finalized"},{"level":2,"heading":"Why this fits","anchor":"why-this-fits"},{"level":2,"heading":"Sequencing constraints","anchor":"sequencing-constraints"},{"level":2,"heading":"Planned C5 flow","anchor":"planned-c5-flow"},{"level":2,"heading":"Boundaries (Out Of Scope For Era A/B)","anchor":"boundaries-out-of-scope-for-era-a-b"},{"level":2,"heading":"Migration operations playbook","anchor":"migration-operations-playbook"}],"html":"<h1 id=\"meta-wiki-art-bridge-mediawiki-wikibase\">Meta Wiki Art Bridge (MediaWiki + Wikibase)</h1>\n<p>Status: Era C5 implementation is active, with the source-of-truth contract finalized.</p>\n<h2 id=\"decision\">Decision</h2>\n<p>Meta Museum will use a <strong>MediaWiki instance extended with a custom Wikibase</strong> as the publication surface for the Meta Wiki Art bridge.</p>\n<p>This extends the existing C5 plan from &quot;publish to MediaWiki&quot; to a structured semantic publication model that supports statement-level references and authority reconciliation.</p>\n<h2 id=\"source-of-truth-contract-finalized\">Source-Of-Truth Contract (Finalized)</h2>\n<p>Chosen model: <strong>publication-target-only</strong>.</p>\n<ul><li>Canonical source of truth: Meta Museum internal Linked Art records in Postgres/storage (`/api/records` domain model).</li><li>Wiki role: governed publication projection layer (MediaWiki narrative + Wikibase statements/references).</li><li>Edit ownership: publication content may evolve on wiki, but canonical data corrections must flow through Meta Museum ingest/reconciliation pipelines first.</li><li>Publish gate: `/api/wiki-drafts/[id]/publish` preflight now requires the draft `sourceRecordId` to resolve to an existing internal record.</li><li>Runtime policy key: `METAMUSEUM_WIKI_SOURCE_OF_TRUTH_MODE` (default and current enforced mode is `publication-target-only`).</li></ul>\n<p>Community-editable mode now requires explicit opt-in and reverse-ETL enablement:</p>\n<ul><li>`METAMUSEUM_WIKI_SOURCE_OF_TRUTH_MODE=community-editable`</li><li>`METAMUSEUM_WIKI_REVERSE_ETL_ENABLED=1`</li></ul>\n<p>Reverse-ETL endpoint:</p>\n<ul><li>`POST /api/wiki-sync/reverse-etl`</li></ul>\n<p>Deterministic merge policy (implemented):</p>\n<ol><li>Resolve internal target record via explicit `internalEntityId` or bidirectional sync map (`wikiItemId` -&gt; internal ID).</li></ol>\n<ol><li>Normalize + sort incoming claims deterministically (`property`, `modifiedAt`, `changeId`, `value`).</li></ol>\n<ol><li>Apply per-property precedence:</li></ol>\n<ol><li>Idempotency:</li></ol>\n<ol><li>Mapped claim updates:</li></ol>\n<ol><li>Unmapped claim properties remain no-op for record fields but are tracked in merge state for deterministic conflict handling.</li></ol>\n<ul><li>newer `modifiedAt` wins;</li><li>tie-break by lexicographic `changeId`;</li><li>older/equal precedence claims are skipped.</li><li>replayed `changeId` is skipped safely.</li><li>`P_label` -&gt; record `_label`</li><li>`P_primary_name` -&gt; first `identified_by` Name</li><li>`P_description` -&gt; `referred_to_by` statement (`Wikibase Description`)</li><li>`P_publish_rights_status` -&gt; `referred_to_by` statement (`Wikibase Publish Rights Status`)</li></ul>\n<h2 id=\"why-this-fits\">Why this fits</h2>\n<ol><li>Linked Art alignment:</li></ol>\n<p>   Linked Art JSON-LD, RDF modeling, and planned SPARQL workflows map directly to Wikibase&#39;s item/property statement model.</p>\n<ol><li>AI grounding:</li></ol>\n<p>   C4 Graph-RAG and NL→SPARQL require verifiable, structured entities; Wikibase supplies a strong query/citation substrate.</p>\n<ol><li>Provenance requirements:</li></ol>\n<p>   Meta Museum&#39;s &quot;cite or refuse&quot; rule is reinforced by Wikibase statement references and qualifiers.</p>\n<ol><li>Authority reconciliation:</li></ol>\n<p>   B6/C2 authority-cache work (AAT/ULAN/TGN/Wikidata/GeoNames/LoC) maps naturally to external IDs and exact-match links in Wikibase.</p>\n<h2 id=\"sequencing-constraints\">Sequencing constraints</h2>\n<p>This bridge is intentionally deferred until Era C5. It must not ship before Era B hardening is complete.</p>\n<p>Required gates before write-path activation:</p>\n<ol><li>SHACL validation stable (B2).</li></ol>\n<ol><li>Postgres as storage of record (B3 cutover complete).</li></ol>\n<ol><li>Auth + role-gated write paths and auditability (B4).</li></ol>\n<ol><li>Authority cache and reconciliation baselines established (B6/C2).</li></ol>\n<h2 id=\"planned-c5-flow\">Planned C5 flow</h2>\n<ol><li>Curator/agent creates `WikiDraft`.</li></ol>\n<ol><li>Draft enters human review queue with rights + citation checks.</li></ol>\n<ol><li>Approved draft publishes to MediaWiki/Wikibase:</li></ol>\n<ol><li>Publish action writes an audit trail and stores return identifiers for round-trip sync.</li></ol>\n<ul><li>narrative article content (MediaWiki),</li><li>structured claims + references (Wikibase),</li><li>source attribution + rights templates.</li></ul>\n<h2 id=\"boundaries-out-of-scope-for-era-a-b\">Boundaries (Out Of Scope For Era A/B)</h2>\n<ol><li>Live MediaWiki/Wikibase provisioning in current app runtime.</li></ol>\n<ol><li>Public write automation from agents without explicit human approval.</li></ol>\n<ol><li>Direct external-authority query on request path.</li></ol>\n<h2 id=\"migration-operations-playbook\">Migration operations playbook</h2>\n<p>For cost-first rollout (Wikibase Cloud now) with a controlled path to self-hosted Wikibase later, use:</p>\n<ul><li>wikibase-cloud-migration-checklist.md(wikibase-cloud-migration-checklist.md)</li></ul>","updatedAt":"2018-10-20T01:46:40.000Z","checksum":"7a43fb0c48b81dc661e5bddd784c40be859371198013308113d7ea3aa7b5e7f5","checksumPrefix":"7a43fb0c48b8","anchorCount":7,"lineCount":90,"rawUrl":"/api/docs/content?path=meta-wiki-art-bridge.md","htmlUrl":"/docs?doc=meta-wiki-art-bridge.md","apiUrl":"/api/docs/content?path=meta-wiki-art-bridge.md"}