Extension:WikibaseMediaInfo

This page is a translated version of the page Extension:WikibaseMediaInfo and the translation is 68% complete.
MediaWiki 拡張機能マニュアル
WikibaseMediaInfo
リリースの状態: 安定
説明 メディアファイルの構造化メタデータを管理するウィキベース拡張機能
作者 構造化データチーム
最新バージョン 継続的な更新
MediaWiki master
データベースの変更 はい
Composer wikibase/media-info
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
readme
  • $wgMediaInfoMediaSearchProfiles
  • $wgMediaInfoSupportedDataTypes
  • $wgMediaInfoProperties
  • $wgMediaInfoExternalEntitySearchBaseUri
  • $wgMediaInfoCustomMatchFeature
  • $wgMediaInfoHelpUrls
  • $wgMediaInfoMediaSearchTitleMatchBaseUri
  • mediainfo-term
Quarterly downloads 2 (Ranked 146th)
WikibaseMediaInfo 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

WikibaseMediaInfoWikibase の拡張機能で、マルチメディア ファイルについての MediaInfo 形式を付与し構造化データのエントリを管理できるようにします。

この拡張機能はファイル記述ページにフックします。 メディア情報エンティティ MediaInfo Entity のファイル情報に補足的なメタデータ(キャプションと題材)を収載します。 利用者はこのデータの作成、閲覧、編集、削除ができます。


要件


インストール

  • Ensure CirrusSearch, Wikibase (client and repo) and WikibaseCirrusSearch are set up properly.
  • ダウンロードして、ファイルをextensions/フォルダー内のWikibaseMediaInfoという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseMediaInfo
  • Gitでのインストールの場合のみ、PHPの依存関係をインストールするためComposerを実行します。 (合併症の可能性についてはタスク T173141を参照。)
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'WikibaseMediaInfo' );
    
  • 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベーステーブルを自動的に作成します。
  •   完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
  • Add configuration.

MediaInfo UI

MediaInfo エンティティの表示と編集は、対応する ファイルページ経由、またはアップロードウィザード経由でファイルを処理する時に作業します。

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

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.

用語集

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

(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).

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 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 P123.

Item

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 Q123.

Qualifier

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

検索

キャプションから検索

通常の検索と同じ感覚で、MediaInfo のキャプション文字列を使ってファイルを検索できます。例えばエッフェル塔の画像をアップロードするとき多言語キャプションに「エッフェル塔」のほか「Tour Eiffel」 (フランス語) 「Eiffel Tower」 (英語) と記入すると、検索する人は「Eiffel Tower」「Tour Eiffel」「エッフェル塔」 のどれを入力しても、その画像がヒットします。

文を指定した検索

Searching for claims/statements happens via WikibaseCirrusSearch keywords, for details see:

Help:WikibaseCirrusSearch

検索の実装

ファイルページの保存時に以下の MediaInfo データを Elasticsearch 索引に書き込みます(例文はいずれもウィキデータの属性と項目識別子を示しています。)

  • キャプション情報は何語であれopening_text 欄に収載
  • 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 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, eg. '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 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' ])

注意事項として、クレームを量的に保存するには、クレームは上記のすべての規定に合致しさらに数量修飾子のプロパティIDは、設定可能なプロパティIDのリスト ($wgWBRepoSettings[ 'searchIndexQualifierPropertiesForQuantity' ]) に含まれる必要があります。

MediaSearch の検索範囲

構造化データ(キャプションと説明文)は、検索対象がNS_FILE 名前空間(に限定した場合)に、既定の検索プロファイルに組み込まれました。 検索語にたとえば "dog" を入力すると、検索範囲にファイルのキャプションが含まれ(利用者の指定言語で)"dog" があるかどうか、あるいは文(statement)P180=Q144 (depicts=dog) を含むか探します。

For a more elaborate (technical) writeup up the MediaSearch search profile, see the Extension:WikibaseMediaInfo/MediaSearch subpage.

設定

拡張機能設定の属性は、キー対設定値のペアです。 They are documented in more detail in WikibaseMediaInfo/extension.json. All config variables are added toLocalSettings.php.

この拡張機能には、以下の設定オプションが利用でまきます。

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. 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']
  • $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.

開発

テスト

PHPUnit tests are located in tests/phpunit. You can run tests not requiring the MediaWiki framework (located in tests/phpunit/composer) by running composer test. このコマンドは PHPCS を採用してコード書式の検証を行います。

MediaWiki のフレームワークに依拠するテスト(tests/phpunit/mediawiki配下)は必ず MediaWiki コアのcomposer phpunit:entrypoint エンドポイントを使って実行します。

JavaScript のテストは tests/node-qunitにあります。 端末からテストするには npm run test:unitを開いてください。 ノードは必ずバージョン 6.x を使用します。

関連項目