Jump to content

Extension:WikibaseMediaInfo

From mediawiki.org
This page is a translated version of the page Extension:WikibaseMediaInfo and the translation is 17% complete.
Outdated translations are marked like this.
Manuel des extensions MediaWiki
WikibaseMediaInfo
État de la version : stable
Description Extension Wikibase pour gérer les métadonnées structurées des fichiers multimédia.
Auteur(s) Structured Data team
Dernière version mises à jour continues
MediaWiki master
Modifie la base
de données
Oui
Licence Licence publique générale GNU v2.0 ou supérieur
Téléchargement
readme
  • $wgMediaInfoMediaSearchProfiles
  • $wgMediaInfoSupportedDataTypes
  • $wgMediaInfoProperties
  • $wgMediaInfoExternalEntitySearchBaseUri
  • $wgMediaInfoCustomMatchFeature
  • $wgMediaInfoHelpUrls
  • $wgMediaInfoMediaSearchTitleMatchBaseUri
  • mediainfo-term
Téléchargements trimestriels 11 (Ranked 126th)
Traduire l’extension WikibaseMediaInfo
Problèmes Tâches ouvertes · Signaler un bogue

WikibaseMediaInfo est une extension de Wikibase permettant d'ajouter une entité de type MediaInfo facilitant la gestion des données structurées des fichiers multimédia.

The extension hooks into the File Page. 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.

Requirements

Installation

  • Ensure these extensions are installed and set up properly: CirrusSearch, Wikibase (Client and Repository), and WikibaseCirrusSearch.
  • Téléchargez et placez le(s) fichier(s) dans un répertoire appelé WikibaseMediaInfo dans votre dossier extensions/.
    Les développeurs et les contributeurs au code doivent à la place installer l'extension à partir de Git en utilisant:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseMediaInfo
  • Seulement lorsque vous installez à partir de Git, exécutez Composer pour installer les dépendances PHP, en entrant composer install --no-dev après vous être positionné dans le répertoire de l'extension. (Voir tâche T173141 pour des complications potentielles.)
  • Ajoutez le code suivant à la fin de votre fichier LocalSettings.php  :
    wfLoadExtension( 'WikibaseMediaInfo' );
    
  • Exécutez le script de mise à jour qui va créer automatiquement les tables de base de données dont cette extension a besoin.
  • Configure as reqiured.
  • Yes Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.

Interface MediaInfo

Les entités MediaInfo sont visibles sur la page Fichier associée et peuvent être modifiées à partir de celle-ci. Les légendes sont affichées séparément des déclarations et celles-ci sont divisées en déclarations de type 'description' et en déclarations 'autres', car une déclaration 'description' est une sorte particulière d'"étiquette" relative au sujet de l'image, simlaire aux étiquettes utilisées avec Wordpress ou flickr.

There are separate sections in the UI for editing captions and statements.

An editing interface is always shown for default properties (defaults are defined in config). On live Commons, depicts is the only default property — users are encouraged to describe what an image depicts. Statements with other properties can be added by the user at will.

Glossary

MediaInfo Entity

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
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'

Caption

A short text describing a media file, plus its language. Used to provide a short description of the file (the same as 'labels' in Wikibase).

Statement

A single fact about a media file consisting of a key-value pair such as Licence=CC-BY-SA or Depicts=Dog.

Keys are always a property. Values can be any wikibase datatype.

Strictly, a wikibase 'statement' means a key-value pair (a 'claim') plus a rank (preferred, normal, or 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'.

Property

A property is a file's property 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 P123.

Item

An item is a concept, topic, or object with an ID - for example, on Wikidata, the CC0 license 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 Q123.

Qualificatifs

Un qualificatif est une déclaration secondaire qui précise la déclaration principale. Par exemple une image peut comporter un arbre au premier plan et la mer en arrière-plan, et dans ce cas elle peut être associée à deux déclarations 'description=arbre (partie concernée=arrière-plan)' et 'description=mer (partie concernée=premier plan)'.

Recherche

Recherche par légende

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:

Help:WikibaseCirrusSearch

Search implementation

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 opening_text field
  • Claims are stored in the format propertyID=value as array elements in the statement_keywords field using the Wikibase property ID (and item ID, if the value is an item)

- , e.g., 'depicts house cat' is stored as P180=Q146

  • Claims with qualifiers are stored in the statement_keywords field 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 P180=Q12418[P518=Q13217555]
  • 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=Q12418 is 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_quantity field in the format propertyID=value|quantity, e.g., 'depicts human, quantity 1' is stored as P180=Q5|1.

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 the 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 NS_FILE namespace. Search terms like "dog" will also include files where the caption (in the user's language) contains "dog", or contains a statement P180=Q144 (depicts=dog).

The Extension: WikibaseMediaInfo/MediaSearch subpage provides a more elaborate (technical) writeup of the MediaSearch search profile.

Configuration

Extension configuration variables are sets of key-value pairs. They are documented in more detail in WikibaseMediaInfo/extension.json. All config variables are added toLocalSettings.php.

The following config options are available for this extension:

Config (in LocalSettings.php)

  • $wgMediaInfoProperties Default 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. This is the depicts (P180) property on live Commons, 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']
  • $wgMediaInfoHelpUrls URLs 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']

Other Config

  • $wgUploadWizardConfig['wikibase']['enabled'] Enables MediaInfo data on UploadWizard when set to true.

Development

Tests

PHPUnit tests are in tests/phpunit. You can run tests not requiring the MediaWiki framework (located in tests/phpunit/composer) by running composer test. 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.

JavaScript tests are located in tests/node-qunit. You can run tests from a terminal with npm run test:unit. Node version 6.x should be used.

Voir aussi