Repository navigation
Conversation
#1193, as decided on 2026-11-15: WikibaseIntegrator(config=...) takes the options of wbi_config that differ for this instance, and reads the others from wbi_config when they're used. wbi.config is read-only. The entities of an instance use its MEDIAWIKI_API_URL, USER_AGENT and MAX_REQUEST_SIZE for their requests, its WIKIBASE_URL for get_entity_url(), its DEFAULT_LEXEME_LANGUAGE for new lexemes, and its SPARQL_ENDPOINT_URL and WIKIBASE_URL for write_required(). The fast run containers are told apart by their Wikibase URL and MediaWiki API URL too, and wbi_fastrun.clear_fastrun_store() empties the store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1193, as decided on 2026-11-15: a Quantity unit, a Time calendar model or a GlobeCoordinate globe given as a bare ID (unit='Q11573') without wikibase_url keeps it, and Snak.get_json() completes it with the WIKIBASE_URL of the instance of the entity serializing itself, else wbi_config's. The entity sets it in a context variable while it serializes its claims, and the forms and senses of a lexeme. A bare ID equals the IRI of this entity, so Claims.add() still finds the claims read from the instance. The claims copied into qualifiers or references keep it, and fast run completes it with the Wikibase URL of its container, on copies of the claims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/source/guide/installation.md # test/integration/test_wikibase_fastrun.py # wikibaseintegrator/entities/lexeme.py
Wikibase only accepts the calendar models of the times and the globes of the coordinates of Wikidata, whatever the instance: their IRIs must start with http://www.wikidata.org/entity/ (the hardcoded $wikidataBaseUri of ValidatorBuilders, REL1_45), other prefixes are rejected with bad-prefix. Only the units use the concept base URI of the instance. So Time and GlobeCoordinate complete a bare ID with the Wikidata prefix at once, and only the units of Quantity are completed when serialized. The wikibase_url argument of Time and GlobeCoordinate is ignored and deprecated, to remove in 1.0. format2wbi() no longer passes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1193 together with #1227 (merged). This is part 2: the datatype IRIs, as you chose. It was updated after checking how Wikibase validates calendar models and globes.
What Wikibase accepts (REL1_45,
repo/includes/ValidatorBuilders.php)calendarmodel$wikidataBaseUri = 'http://www.wikidata.org/entity/', hardcoded, on every instanceglobeunitItemVocabularyBaseUri), or"1"A value with any other prefix is rejected with
bad-prefix(EntityUriValidator). The source comment calls it a TODO: "use a configurable vocabulary for calendars and reference globes, instead of hardcoding wikidata".Behavior
Units follow the instance:
Quantity(unit='Q11573')withoutwikibase_urlkeeps the bare ID in the datavalue.Snak.get_json()completes it with:WIKIBASE_URLof theWikibaseIntegratorinstance of the entity, when an entity serializes itself (get_json(),write(), the forms and senses of a lexeme,write_form()/edit_form()/write_sense()/edit_sense());wbi_config['WIKIBASE_URL'], read when serialized.With
wikibase_url=, the IRI is built at once, as before.Calendar models and globes are Wikidata items:
Time(calendarmodel='Q1985786')andGlobeCoordinate(globe='Q2')gethttp://www.wikidata.org/entity/…at once, whatever the instance. Before, they were completed withwbi_config['WIKIBASE_URL'], which Wikibase rejects on any instance other than Wikidata.globe='Q2'is now the Earth, with its latitude and longitude ranges.wikibase_urlargument ofTimeandGlobeCoordinate, and of theirset_value(), is ignored and emits aDeprecationWarning. It's removed in 1.0, and I'll add it to Remove the deprecated APIs in 1.0 #1192 after the merge.format2wbi()no longer passes it.Quantity(unit='Q11573')written throughworld.itemwbi_config(wrong instance)world.config['WIKIBASE_URL']Quantity(unit='Q11573').mainsnak.datavalue['value']['unit']'Q11573'(breaking)Time(calendarmodel='Q1985786')on a custom instancehttp://custom/entity/Q1985786, rejectedhttp://www.wikidata.org/entity/Q1985786GlobeCoordinate(globe='Q2')on a custom instancehttp://custom/entity/Q2, rejectedhttp://www.wikidata.org/entity/Q2How
models/snak.py), set by the entities around the serialization of their claims, forms and senses. This is instead of adding awikibase_urlargument to around 15get_json()methods, which would all be frozen in 1.0. It's thread- and async-safe._same_datavalue()treats a bare unit as equal to the IRI of that entity on any instance.SnakandClaimuse it. SoClaims.add()doesn't duplicate a claim read from the instance. Two full IRIs are still compared exactly.get_json().write_required(),get_entities()andload_statements()work on copies of the claims, resolved with the container's Wikibase URL. Claims without a bare unit aren't copied.Docs
upgrading.mdhas two breaking-change entries (the units, and the calendar models and globes) and one deprecation entry (wikibase_urlofTime/GlobeCoordinate).installation.mddescribes both rules.Tests
test/test_entity_iris.py, 35 tests:wbi_config, and built at once withwikibase_url;wbi_config, and with the Earth ranges;format2wbi()not warning;test_calendar_model_idnow expects the Wikidata IRI, and the Mars fast run test has the Wikidata globe IRI in its WKT literal.test_instance_configurationwrites a quantity with a bare unit,Time(calendarmodel='Q1985786')andGlobeCoordinate(globe='Q2')whilewbi_configpoints elsewhere. It reads back the instance's IRI for the unit and the Wikidata IRIs for the calendar model and the globe.-W error::DeprecationWarning.🤖 Generated with Claude Code