LocalMedia#

class wikibaseintegrator.datatypes.extra.localmedia.LocalMedia(value=None, **kwargs)[source]#

Bases: String

Implements the Wikibase data type for Wikibase Local Media extension. More info at https://www.mediawiki.org/wiki/Extension:Wikibase_Local_Media

Constructor, calls the superclass BaseDataType

Parameters:

value (str | None, default: None) – The string to be used as the value

from_sparql_value(sparql_value)[source]#

Parse data returned by a SPARQL endpoint and set the value to the object

The extension writes the URL of the file page on the instance (e.g. https://wiki.example.org/wiki/File:Bunny_rabbit.jpg, or index.php?title=File:Bunny_rabbit.jpg), only the file name is kept: without the namespace, which can be localized (Fichier:…), and with spaces instead of underscores.

The partial load of the fast run mode (without cache) still queries the file name as a literal, which matches nothing: building the URL needs the article path of the instance.

Parameters:

sparql_value (dict) – A SPARQL value composed of type and value

Return type:

Self

Returns:

The object itself

DTYPE = 'localMedia'#
PTYPE = 'http://wikiba.se/ontology#LocalMedia'#