WikibaseMediaInfo è un'estensione per Wikibase per aggiungere una tipologia di entità chiamata MediaInfo per la gestione di dati strutturati dei file multimediali.
L'estensione si collega in una pagina di descrizione del file. It stores supplemental metadata (captions and depicts statements) about the file in a MediaInfo Entity. The user can view, create, edit, and delete this data.
- Wikibase (follow instructions for both client and repo)
- Ensure CirrusSearch, Wikibase (client and repo) and WikibaseCirrusSearch are set up properly.
- Download and place the file(s) in a directory called
- Solo durante l'installazione da git eseguire Composer per installare le dipendenze PHP, immettendo
composer install --no-devnella directory dell'estensione. (Vedere task T173141 per potenziali complicazioni.)
- Aggiungi il seguente codice al tuo $LocalSettings (preferibilmente alla fine):
wfLoadExtension( 'WikibaseMediaInfo' );
- Esegui lo script di aggiornamento, che creerà automaticamente nel database le tavole necessarie a questa estensione.
- Done – Naviga in Special:Version nella tua wiki per verificare che l'estensione sia stata installata correttamente.
- Add configuration.
MediaInfo entities are shown on, and can be edited from, their associated File page and while uploading a file via UploadWizard.
An editing interface for is always shown for default properties (defaults are defined in config). On live commons depicts is the only default property - users are encouraged to say what is depicted by an image. Statements with other properties can be added by the user at will.
A Wikibase entity that contains structured data about media files. It is stored in a slot on a File page and consists of
- an ID in the form Mxxx, where xxx is the id of the associated wiki page
- any number of captions (one per language)
- any number of statements
(Note: if there is no caption or statement data then the entity is not stored in the database - in this case it is known as a 'virtual entity')
A short piece of text describing a media file, plus its language. Used to provide a short description of the file (the same as 'labels' in Wikibase).
A single fact about a media file consisting of a key-value pair such as
Strictly, a wikibase 'statement' means a key-value pair (a 'claim') plus a rank (
deprecated) and zero or more documentary references.
We don't typically have documentary references for descriptions of files, and all statements have a
normal rank by default, so in MediaInfo we prefer to use the term 'statement' instead of 'claim'.
A property is a property of a file that can have a value - for example 'depicts' (what an image is a picture of), 'resolution', 'created by', 'license'.
Each property has a unique id in wikibase in the form
Pxxx such as
An item is a concept, topic, or object with an id - for example on Wikidata the CC0 licence is Q6938433, physics is Q413 and the planet Earth is Q2.
Each item has a unique id in wikibase in the form
Qxxx such as
A qualifier is a secondary statement that modifies the primary statement. For example an image might have a tree in the foreground and the sea in the background, in which case it could have 2 'depicts' claims associated with it - 'depicts=tree(applies to part=foreground)' and 'depicts=sea(applies to part=background)'.
Users can search for files by their MediaInfo captions just as they would search for anything else. For example, if a user uploads a picture of the Eiffel Tower, and enters 'Tour Eiffel' (French) and 'Eiffel Tower' (English) as multilingual file captions, the picture is findable by another user searching for either 'Eiffel Tower' or 'Tour Eiffel'.
Searching for claims/statements
Searching for claims/statements happens via WikibaseCirrusSearch keywords, for details see:
When the File page is saved, the following MediaInfo data is written to the Elasticsearch index (all examples use Wikidata Property and Item ids):
- Captions data in every language is stored in the
- Claims are stored in the format
propertyID=valueas array elements in the
statement_keywordsfield using the wikibase property ID (and item id, if value is an item)
- e.g. 'depicts house cat' is stored as
- Claims with qualifiers are stored in the
statement_keywordsfield along with their qualifiers in the format
propertyID=value[qualifierPropertyID=qualifierValue]. For example, the Mona Lisa painting (Wikidata item Q12418) depicts a sky (Q13217555) in the background (Wikidata property P518). If we arrange this data in a Wikibase claim, it would be: 'depicts sky, applies to part background', which would be stored as
- Note that claims with qualifiers are also stored without the qualifier, to increase their findability. So, for example, if someone entered the above claim-plus-qualifier, the claim
P180=Q12418is also stored, so that someone can find the file by searching for 'depicts sky' alone, as well as by searching for 'depicts sky, applies to part background'.
- Claims data with qualifiers where the qualifier value is a quantity is stored in the
statement_quantityfield in the format
propertyID=value|quantity, eg. 'depicts human, quantity 1' is stored as
Note that not all claims are stored. A claim will be indexed in ElasticSearch only if ALL of the following conditions are true:
- The claim has a real value (i.e. its value is not 'no value' or 'unknown value') AND
- We know how to process its value for indexing. More value processors may be added in future, but currently we require the claim's value to be either a Q item ID, a string (alphanumeric), or a quantity (numeric) AND
- the claims's Wikidata property ID is NOT in a configurable list of excluded IDs (
$wgWBRepoSettings[ 'searchIndexPropertiesExclude' ]) AND either its property ID is in a configurable list of property IDs that should be indexed (
$wgWBRepoSettings[ 'searchIndexProperties' ]) OR its property type is in a configurable list of property types that should be indexed (
$wgWBRepoSettings[ 'searchIndexTypes' ])
Note that for a claim's quantities to be stored, the claim must meet all the criteria above AND the property ID for the quantity qualifier must be present in a configurable list of property IDs (
$wgWBRepoSettings[ 'searchIndexQualifierPropertiesForQuantity' ]).
MediaSearch search profile
Structured data (captions and statements) are now also included in the default search profile when searching (only) in the
Search terms like "dog" will also include files where the caption (in the user's language) contains "dog", or contains a statement
For a more elaborate (technical) writeup up the MediaSearch search profile, see the Extension:WikibaseMediaInfo/MediaSearch subpage.
Extension configuration variables are sets of key-value pairs.
They are documented in more detail in
All config variables are added to
The following config options are available for this extension:
Config (in LocalSettings.php)
$wgMediaInfoPropertiesDefault wikibase properties that will always be shown, allowing users to add/edit/delete values for them, on the File page/UploadWizard, regardless or not they already have a value. On live Commons this is the depicts (P180) property, as we want to encourage users to fill in values for this in particular. Value is an array of key-value pairs connecting a label name to an existing wikibase database id.
['depicts' => 'P180']
$wgMediaInfoHelpUrlsURLs for pages where a user can learn more about particular wikibase properties - if there is a help URL for a particular property then there will be a "learn more" link for that property that leads to the URL from the config.
['P180' => 'https://www.wikidata.org/wiki/Property:P180']
$wgUploadWizardConfig['wikibase']['enabled']Enables MediaInfo data on UploadWizard when set to
PHPUnit tests are located in
You can run tests not requiring the MediaWiki framework (located in
tests/phpunit/composer) by running
This command also runs code style checks using PHPCS.
Tests relying on the MediaWiki framework (located in
tests/phpunit/mediawiki) must be run using MediaWiki core’s
composer phpunit:entrypoint endpoint.
You can run tests from a terminal with
npm run test:unit.
Node version 6.x should be used.
|Questa estensione viene utilizzata su uno o più progetti Wikimedia. Ciò probabilmente significa che l'estensione è stabile e funziona abbastanza bene da essere utilizzata da siti Web ad alto traffico. Cerca il nome di questa estensione nei file di configurazione CommonSettings.php e InitialiseSettings.php di Wikimedia per vedere dove è installato. Un elenco completo delle estensioni installate su un particolare wiki può essere visto sulla pagina Special:Version del wiki.|
|This extension is included in the following wiki farms/hosts and/or packages:|