Wikibase Module API
Overview
The gkc.wikibase module is the package-facing access layer for package-owned Wikibase runtime contracts.
It exposes the canonical datatype registry used to normalize datatype semantics across validation, payload shaping, and ontology initialization flows.
Quick Start
from gkc.wikibase import (
build_wikibase_init_index,
get_wikibase_datatype_spec,
list_wikibase_datatypes,
)
spec = get_wikibase_datatype_spec("wikibase-item")
init_index = build_wikibase_init_index()
print(spec.ontology_uri)
print(spec.datavalue_type)
print(spec.entity_value_kind)
print(list_wikibase_datatypes())
print(init_index.properties["instance_of"].datatype)
print(init_index.items["entity_profile"].subclass_of)
The module now exposes both package-owned datatype registry helpers and package-owned Wikibase init helpers.
API Reference
gkc.wikibase
Wikibase-specific runtime helpers and package-owned registries.
MetaWikibaseCompiledEntity
dataclass
Compiled symbolic Wikibase payload for one init-fixture entity.
Source code in gkc/wikibase.py
76 77 78 79 80 81 82 83 84 85 86 | |
MetaWikibaseInitEntity
dataclass
Normalized entity entry from the package-owned Meta-Wikibase init fixture.
Source code in gkc/wikibase.py
32 33 34 35 36 37 38 39 40 41 42 43 44 | |
MetaWikibaseInitIndex
dataclass
Indexed access surface for the package-owned Meta-Wikibase init fixture.
Source code in gkc/wikibase.py
47 48 49 50 51 52 53 54 55 | |
MetaWikibaseInitMetadata
dataclass
Package-owned metadata for the Meta-Wikibase init fixture.
Source code in gkc/wikibase.py
21 22 23 24 25 26 27 28 29 | |
MetaWikibaseSeedCompilation
dataclass
Compiled symbolic Wikibase payload set derived from the init fixture.
Source code in gkc/wikibase.py
89 90 91 92 93 94 95 | |
MetaWikibaseSeedPlan
dataclass
Dry-run baseline plan for the package-owned Meta-Wikibase seed.
Source code in gkc/wikibase.py
113 114 115 116 117 118 | |
MetaWikibaseSeedPlanEntry
dataclass
One dry-run baseline action derived from the compiled init fixture.
Source code in gkc/wikibase.py
98 99 100 101 102 103 104 105 106 107 108 109 110 | |
MetaWikibaseSemanticAnchorContract
dataclass
Compiled required semantic-anchor contract derived from the init fixture.
Source code in gkc/wikibase.py
68 69 70 71 72 73 | |
MetaWikibaseSemanticAnchorRequirement
dataclass
Required internal semantic anchor compiled from the init fixture.
Source code in gkc/wikibase.py
58 59 60 61 62 63 64 65 | |
WikibaseDatatypeSpec
dataclass
Canonical runtime specification for one Wikibase datatype.
Source code in gkc/wikibase.py
121 122 123 124 125 126 127 | |
build_wikibase_init_index(document=None)
Build a typed index over the package-owned Meta-Wikibase init fixture.
Source code in gkc/wikibase.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
build_wikibase_semantic_anchor_contract(document=None, *, internal_name_identifier_prefix=None)
Compile the package-owned init fixture into a required anchor contract.
Source code in gkc/wikibase.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
canonicalize_wikibase_datatype(datatype, *, strict=False)
Normalize a Wikibase datatype token to its canonical runtime spelling.
Source code in gkc/wikibase.py
228 229 230 231 232 233 234 235 236 237 238 239 | |
compare_wikibase_entity_views(required_view, current_view, *, issues=None)
Compare canonical required and current views and return changed-field codes.
Source code in gkc/wikibase.py
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | |
compile_wikibase_seed(document=None, *, label_language=None)
Compile the init fixture into symbolic Wikibase JSON payloads.
The compiled payloads use internal name identifiers such as _instance_of
as unresolved placeholders for entity references. This keeps the output in a
deterministic dry-run form that can be inspected before any live baseline
orchestration resolves or writes entities.
Source code in gkc/wikibase.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
get_wikibase_datatype_spec(canonical_name)
Return the registry entry for one canonical datatype token.
Source code in gkc/wikibase.py
200 201 202 203 204 205 206 207 208 | |
get_wikibase_init_contract_digest(document=None)
Return a stable digest for the normalized Meta-Wikibase init contract.
Source code in gkc/wikibase.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |
get_wikibase_init_entity(entity_key)
Return one normalized entity entry from the package-owned init fixture.
Source code in gkc/wikibase.py
424 425 426 427 428 429 430 431 | |
is_known_wikibase_datatype(datatype)
Return whether a datatype token resolves to a known registry entry.
Source code in gkc/wikibase.py
242 243 244 245 246 247 248 | |
is_wikibase_item_datatype(datatype)
Return whether a datatype token resolves to the Wikibase item datatype.
Source code in gkc/wikibase.py
251 252 253 254 255 256 | |
list_wikibase_datatypes()
Return the canonical runtime datatype tokens in stable order.
Source code in gkc/wikibase.py
211 212 213 214 | |
load_wikibase_datatype_registry()
cached
Load the package-owned Wikibase datatype registry.
Returns:
| Type | Description |
|---|---|
dict[str, WikibaseDatatypeSpec]
|
Mapping from canonical Wikibase datatype token to typed registry entry. |
Source code in gkc/wikibase.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
load_wikibase_datatype_registry_json()
Return the raw JSON-compatible registry mapping.
Source code in gkc/wikibase.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
load_wikibase_init_document()
Load the package-owned Meta-Wikibase init document and normalize it.
Source code in gkc/wikibase.py
193 194 195 196 197 | |
normalize_wikibase_current_entity_view(entity, *, entity_id_to_internal_name_identifier, label_language, required_value_language, required_monolingualtext_properties, expected_property_ids)
Return the canonical comparable view for one current Wikibase entity.
Source code in gkc/wikibase.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
normalize_wikibase_init_document(document)
Normalize a Meta-Wikibase init document to canonical runtime datatypes.
Source code in gkc/wikibase.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
normalize_wikibase_required_entity_view(payload)
Return the canonical comparable view for one compiled seed payload.
Source code in gkc/wikibase.py
634 635 636 637 638 639 | |
plan_wikibase_seed_baseline(document=None, *, current_entities_by_internal_name_identifier=None, entity_id_to_internal_name_identifier=None, label_language=None, required_value_language='mul')
Return a dry-run baseline plan for the package-owned init fixture.
Source code in gkc/wikibase.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |