Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ RUN python3 -m venv /root/venv && \
/root/venv/bin/pip install --no-cache-dir --upgrade \
pip \
setuptools \
black
black \
pyshacl==0.40.1

WORKDIR /workspace/development

Expand Down
95 changes: 95 additions & 0 deletions development/docs/adr/0025-bootstrap-ontology-capability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# 25) Bootstrap ontology capability {#adr_0025}

Date: 2026-09-09

## Status

accepted

## Context

A newly installed Wikibase is empty. For people starting a Wikibase project,
choosing an initial ontology can be a difficult first step. A small, curated
foundation of properties gives them a practical starting point for modelling a
domain and configuring related tools without requiring them to discover and
create every common property manually.

The community-maintained
[wikibase-bootstrap](https://gitlab.wikimedia.org/olea/wikibase-bootstrap/)
project provides reviewed OWL/Turtle source material based on established
Wikibase patterns. Its Python importer, however, assumes fixed local IDs.
Wikibase Suite must not assume that an upstream source IRI will become a
particular local `P…` identifier.

## Decision

Bundle a `WikibaseBootstrap` MediaWiki extension in the Wikibase image. This
puts two reviewed, property-only ontology starting points directly where a new
Wikibase administrator can use them, rather than requiring a separate Python
or command-line bootstrap workflow. The feature is opt-in and is available
only while Wikibase has no active properties.

The extension Special page and the extension's regular MediaWiki maintenance
script use the same service, so the same bootstrap can be run from either the
administrative interface or the command line. The Special page is the intended
onboarding path; the maintenance script supports automated or operational use.

The service creates properties through Wikibase's entity-store API and lets
Wikibase allocate fresh local IDs. Bundle source IRIs are stable planning keys;
claims between bundle properties are resolved using the IDs allocated in that
same run. Both interfaces use the same server-owned service, which rechecks
eligibility immediately before applying a bundle.

The bundled Turtle retains upstream attribution, licence, provenance, and
version metadata. Its narrow profile is checked with pySHACL by the test suite
and CI. The running extension deliberately has no Python or RDF/SHACL runtime
dependency: it reads only the reviewed bundled profile.

For small, exploratory Wikibases, the Special page can delete at most 25
existing Wikibase properties after an explicit typed confirmation, but only
when no item statements use properties. This is a convenience reset, not a
general-purpose data-reset facility.

## Consequences

The capability preserves the supported choice to start with a Wikibase without
active properties,
while providing a more accessible onboarding path for users who want a
community-curated foundation.

Application is not transactional. A request failure can leave a partially
created bundle, and the capability has no durable run record, retry flow, or
recovery tooling. The reset facility likewise has no maintenance lock or audit
record. These limits are acceptable only for the deliberately narrow,
property-bootstrap use case.

The bundles include the standard Wikibase properties used to describe
external-identifier formatter and canonical RDF URI templates. Configuring
Wikibase to use those properties is deliberately not part of this capability.
A default P7/P8 configuration would improve the normal fresh-instance path,
but could point to unrelated or deleted properties on an instance whose
identifiers had previously been allocated. The feature therefore leaves that
optional configuration to Wikibase operators and its upstream documentation. A
later follow-up may provide a safer configuration workflow or Suite-specific
guidance.

## Explicitly out of scope

- Uploading arbitrary Turtle or OWL files.
- A general RDF/OWL importer, runtime SHACL validation, or network imports.
- Seed data, item creation, and bulk data import.
- Adding or merging bundle properties into a Wikibase with active properties.
- Persistent bootstrap history, source-IRI-to-local-ID run records,
transactional/recoverable import runs, and a general reset workflow.

Those are possible future directions. If pursued, they require a real RDF
parser and SHACL engine, a server-owned import-run model, durable provenance,
and an explicit conflict/recovery policy rather than an extension of this
property-bootstrap path.

## References

- [wikibase-bootstrap community project](https://gitlab.wikimedia.org/olea/wikibase-bootstrap/)
- [T234943: bootstrap Wikibase installation with basic ontology](https://phabricator.wikimedia.org/T234943)
- [T391815: Wikibase bootstrap properties set](https://phabricator.wikimedia.org/T391815)
- [T430204: testable bootstrap ontology spike](https://phabricator.wikimedia.org/T430204)
1 change: 1 addition & 0 deletions development/docs/adr/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ Current ADRs include:
- [22 - WBS Tools foundation](0022-wbs-tools-foundation.md)
- [23 - release preflight checks](0023-release-preflight.md)
- [24 - WBS upgrade command](0024-wbs-upgrade-command.md)
- [25 - bootstrap ontology capability](0025-bootstrap-ontology-capability.md)
12 changes: 12 additions & 0 deletions development/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ export default defineConfigWithVueTs(
globals: globals.browser
}
},
{
// MediaWiki ResourceLoader packages extension Vue modules as CommonJS.
name: 'wikibase-bootstrap/resource-loader',
files: [ 'images/wikibase/runtime/var/www/html/extensions/WikibaseBootstrap/**/*.{js,vue}' ],
languageOptions: {
globals: { ...globals.browser, require: 'readonly' }
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
'vue/block-lang': 'off'
}
},
{
...mocha.configs.recommended,
name: 'wbs/mocha',
Expand Down
13 changes: 13 additions & 0 deletions development/images/wikibase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ using the normal MediaWiki instructions for that extension. A complete
externally managed configuration continues to control its own extension
loading.

### Bootstrap an initial ontology

To get started with a Wikibase without active properties, you can bootstrap an
initial set of properties. These community-curated bundles include properties
mapped to Wikidata and common RDF and OWL vocabularies, providing a shared
starting point for interoperable data.

To apply an initial ontology, visit
`https://<your-wikibase-host>/wiki/Special:OntologyBootstrap` to see the available options.

To configure links from external identifiers created with these properties, see
[Wikibase's configuration guide for external identifiers](https://www.mediawiki.org/wiki/Wikibase/Installation/Advanced_configuration#Define_links_for_external_identifiers).

### Login with Wikimedia

To enable Wikimedia login:
Expand Down
6 changes: 6 additions & 0 deletions development/images/wikibase/build/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@
"source": {
"path": "runtime/var/www/html/extensions/WikibaseSuite"
}
},
{
"name": "WikibaseBootstrap",
"source": {
"path": "runtime/var/www/html/extensions/WikibaseBootstrap"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Bundled bootstrap ontologies

These files are reviewed source assets for the `WikibaseBootstrap` extension
at `/var/www/html/extensions/WikibaseBootstrap/ontologies/`; no runtime network
request is made to obtain them.

Source: [`olea/wikibase-bootstrap`](https://gitlab.wikimedia.org/olea/wikibase-bootstrap/),
commit `40892e31fd812c9b1402506d1ee86cfc215e1dd6` (2026-04-08).

The source ontology data declares CC0 1.0 Universal. The Suite profile
preserves the source property and ontology metadata while replacing fixed local
IDs with stable source IRIs; the server-owned importer then allocates the local
`P…` IDs. Explicit `wbb:claim` entries encode the Wikibase statements that the
upstream converter derives from its `owl:equivalentProperty` mappings.

The minimal and extended variants remain separate user-visible choices.

The same server-owned operation is available without the Special page:

```sh
php extensions/WikibaseBootstrap/maintenance/BootstrapOntology.php \
--bundle extended --user Admin --confirm
```

Run this command from the MediaWiki installation directory. It only applies to
an eligible Wikibase without active properties, just like the Special page.

The feature-local validation assets and pySHACL runner live in
`development/tests/wikibase-bootstrap/`. They are development and CI
dependencies, not runtime dependencies of the extension.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "WikibaseBootstrap",
"version": "0.1.0",
"author": ["Wikibase Suite Team"],
"url": "https://www.mediawiki.org/wiki/Wikibase/Suite",
"namemsg": "wikibasebootstrap-extensionname",
"descriptionmsg": "wikibasebootstrap-desc",
"type": "specialpage",
"license-name": "BSD-3-Clause",
"AutoloadNamespaces": {
"MediaWiki\\Extension\\WikibaseBootstrap\\": "includes/"
},
"ResourceModules": {
"ext.wikibaseBootstrap.apply": {
"class": "MediaWiki\\ResourceLoader\\CodexModule",
"localBasePath": "",
"packageFiles": [
"resources/ext.wikibaseBootstrap/init.js",
"resources/ext.wikibaseBootstrap/OntologyBootstrapApp.vue"
],
"messages": [
"ontologybootstrap-completion-created",
"ontologybootstrap-completion-description",
"ontologybootstrap-reset-completed",
"ontologybootstrap-reset-completion-description",
"ontologybootstrap-bundle-catalog-heading",
"ontologybootstrap-bundle-derived-from",
"ontologybootstrap-bundle-source-label",
"ontologybootstrap-bundle-property-count",
"ontologybootstrap-bundle-item-class-count",
"ontologybootstrap-metadata-version",
"ontologybootstrap-metadata-license",
"ontologybootstrap-metadata-publisher",
"ontologybootstrap-metadata-contributors",
"ontologybootstrap-unavailable",
"ontologybootstrap-apply",
"ontologybootstrap-apply-dialog-title",
"ontologybootstrap-cancel",
"ontologybootstrap-apply-confirmation"
],
"styles": ["resources/ext.wikibaseBootstrap.css"],
"codexComponents": ["CdxButton", "CdxDialog", "CdxMessage", "CdxTextInput"],
"dependencies": ["codex-styles"]
}
},
"SpecialPages": {
"OntologyBootstrap": "MediaWiki\\Extension\\WikibaseBootstrap\\SpecialOntologyBootstrap"
},
"AvailableRights": ["bootstrapontology", "resetwikibaseentities"],
"GroupPermissions": {
"sysop": { "bootstrapontology": true, "resetwikibaseentities": true }
},
"MessagesDirs": { "WikibaseBootstrap": ["i18n"] },
"config": {
"WikibaseBootstrapBundleDirectory": {
"value": "/var/www/html/extensions/WikibaseBootstrap/ontologies",
"public": false
}
},
"manifest_version": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"@metadata": { "authors": ["Wikibase Suite Team"] },
"wikibasebootstrap-extensionname": "Wikibase Bootstrap",
"wikibasebootstrap-desc": "Validates and applies bootstrap ontology bundles to Wikibase instances without active properties",
"ontologybootstrap": "Create initial ontology",
"ontologybootstrap-summary": "Set up a Wikibase with a small, reviewed foundation of properties. Choose a bundle below to create its initial ontology. A bundle can only be applied when Wikibase has no active properties, and nothing changes until you explicitly confirm it.",
"ontologybootstrap-invalid-token": "Your session token was invalid. Please try again.",
"ontologybootstrap-not-empty": "This Wikibase has active properties and cannot be bootstrapped. Reset its properties first; bootstrap bundles are never merged into existing property data.",
"ontologybootstrap-existing-summary": "You can only bootstrap a Wikibase without active properties.",
"ontologybootstrap-reset-invitation": "It looks like your Wikibase is still relatively small with only $1 {{PLURAL:$1|property|properties}}. If you'd like to start over with one of the bootstrapped ontologies below, you need to first delete all existing Wikibase properties.",
"ontologybootstrap-existing-warning": "If you'd like to delete all of your current properties, you can do so below. Items, wiki pages, user accounts, and deletion history will not be deleted.",
"ontologybootstrap-complete": "Bootstrap applied successfully: $1 properties were created.",
"ontologybootstrap-reset-permission": "You do not have permission to reset Wikibase properties.",
"ontologybootstrap-reset-confirm-intro": "To delete all of your existing Wikibase $1 properties, type:",
"ontologybootstrap-reset-confirm-text": "DELETE $1 PROPERTIES",
"ontologybootstrap-reset-confirm-required": "Type DELETE $1 PROPERTIES exactly before deleting this batch.",
"ontologybootstrap-reset-submit": "Delete active Wikibase properties",
"ontologybootstrap-reset-progress": "Deleted up to $1 properties. $2 active properties remain; repeat the confirmed reset if needed.",
"ontologybootstrap-reset-too-many": "Ontology bootstrapping is only available for a Wikibase without active properties. To protect this existing Wikibase, its properties cannot be reset here once it contains more than $1 properties.",
"ontologybootstrap-reset-item-statements": "These properties cannot be reset here because existing items have statements that use Wikibase properties.",
"ontologybootstrap-ready-to-apply": "This Wikibase has no active properties and is eligible. Apply $1 properties from the selected bundle.",
"ontologybootstrap-apply": "Apply bundled ontology",
"ontologybootstrap-completion-created": "Initial ontology created.",
"ontologybootstrap-completion-description": "$1 {{PLURAL:$1|property was|properties were}} created. Bootstrap setup is complete.",
"ontologybootstrap-reset-completed": "Wikibase properties deleted.",
"ontologybootstrap-reset-completion-description": "$1 {{PLURAL:$1|property was|properties were}} deleted.",
"ontologybootstrap-bundle-catalog-heading": "Set of properties",
"ontologybootstrap-bundle-derived-from": "Derived from the community-curated",
"ontologybootstrap-bundle-source-label": "Wikibase bootstrap set",
"ontologybootstrap-bundle-property-count": "$1 {{PLURAL:$1|property|properties}}",
"ontologybootstrap-bundle-item-class-count": "$1 {{PLURAL:$1|item/class|items/classes}}",
"ontologybootstrap-metadata-version": "Version",
"ontologybootstrap-metadata-license": "License",
"ontologybootstrap-metadata-publisher": "Publisher",
"ontologybootstrap-metadata-contributors": "Contributors",
"ontologybootstrap-unavailable": "Unavailable",
"ontologybootstrap-apply-dialog-title": "Apply $1",
"ontologybootstrap-cancel": "Cancel",
"ontologybootstrap-apply-confirmation": "This will create $1 {{PLURAL:$1|property|properties}} in a Wikibase without active properties. It cannot be applied again without first deleting all active Wikibase properties.",
"ontologybootstrap-bundled-minimal": "Minimal set of properties",
"ontologybootstrap-bundled-extended": "Extended set of properties"
}
Loading
Loading