WikibaseManifest#

class wikibaseintegrator.wbi_manifest.WikibaseManifest(name, root_script_url, main_page_url, mediawiki_api_url, mediawiki_rest_url, max_lag=None, sparql_endpoint_url=None, external_services=dict(), equiv_entities=dict(), local_rdf_namespaces=dict(), local_entities=dict(), oauth_registration_page=None, raw=dict())[source]#

Bases: object

The manifest of a Wikibase instance, as returned by get_manifest(). The optional parts of the format are omitted by the instances which don’t have them (e.g. no query service): their attribute is then None or empty.

classmethod from_json(json_data)[source]#

Build the manifest from the JSON returned by the instance.

Parameters:

json_data (dict[str, Any]) – The decoded JSON of the manifest

Return type:

WikibaseManifest

Returns:

The manifest

apply(target=None)[source]#

Set the wbi_config values of this instance (see config()), the other options are kept.

Parameters:

target (dict[str, Any] | None, default: None) – The configuration to update. wbi_config by default.

Return type:

None

config()[source]#

The wbi_config values to use this instance: MEDIAWIKI_API_URL, MEDIAWIKI_REST_URL, MEDIAWIKI_INDEX_URL, WIKIBASE_URL and SPARQL_ENDPOINT_URL. The last two are left out when the manifest doesn’t give them.

Return type:

dict[str, str]

local_id(entity_id, hub='wikidata.org')[source]#

The local ID of an entity of another Wikibase instance, from the equivalences of the manifest.

Parameters:
  • entity_id (str) – The ID on the other instance, e.g. ‘P31’

  • hub (str, default: 'wikidata.org') – The other instance, as named by the manifest. Wikidata by default, the only one of the format.

Return type:

str | None

Returns:

The local ID, e.g. ‘P3’, or None without a known equivalent

equiv_entities: dict[str, dict[str, dict[str, str]]]#

The local IDs of entities of other Wikibase instances, e.g. {‘wikidata.org’: {‘properties’: {‘P31’: ‘P1’}}}

external_services: dict[str, str]#

The external services: queryservice, queryservice_ui, quickstatements, openrefine_reconcile…

local_entities: dict[str, dict[str, Any]]#

The entity types of the instance and their namespace, e.g. {‘item’: {‘namespace_id’: 120, ‘namespace_name’: ‘Item’}}

local_rdf_namespaces: dict[str, str]#

The RDF namespaces of the instance, by prefix (’’ for the entities, ‘p’, ‘ps’, ‘wdt’…)

main_page_url: str#

The URL of the main page

max_lag: int | None = None#

The maxlag recommended by the administrators, in seconds

mediawiki_api_url: str#

The MediaWiki Action API (api.php)

property mediawiki_index_url: str#

The index.php of the instance.

mediawiki_rest_url: str#

The MediaWiki REST API (rest.php)

name: str#

The name of the instance, e.g. ‘Wikibase World’

oauth_registration_page: str | None = None#

The page to register an OAuth consumer, if the OAuth extension is installed

raw: dict[str, Any]#

The manifest, as returned by the instance

root_script_url: str#

The URL of the MediaWiki scripts (index.php, api.php…), e.g. ‘https://wikibase.world/w’

sparql_endpoint_url: str | None = None#

The SPARQL endpoint of the Wikibase query service, if any

property wikibase_url: str | None#

The Wikibase URL, as wbi_config[‘WIKIBASE_URL’] expects it: the concept URI of the entities without ‘/entity/’, e.g. ‘https://wikibase.world’ for ‘https://wikibase.world/entity/’. None if the concept namespace doesn’t end with ‘/entity/’.