Extension:ActiveAbstract

From mediawiki.org
This page is a translated version of the page Extension:ActiveAbstract and the translation is 18% complete.
MediaWiki 拡張機能マニュアル
ActiveAbstract
リリースの状態: 安定
実装 拡張構文
説明 Generate an XML feed for Yahoo's Active Abstracts project
作者 Brooke Vibberトーク
互換性の方針 MediaWiki とともにリリースされるスナップショット。 master には後方互換性がありません。
MediaWiki 1.25+
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
Quarterly downloads 9 (Ranked 133rd)
translatewiki.net で翻訳を利用できる場合は、ActiveAbstract 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

This extension is used with XML dumps to pull a formatted copy of an article's initial text and its organizational structure. It is one of the filters available for the backup system.

It will pull the first two sentences of the article along with each section heading and wrap them in XML tags and trim the entry to be no longer than 1024 characters.

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のActiveAbstractという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ActiveAbstract
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'ActiveAbstract' );
    
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

パラメーター

ActiveAbstract is run as a plugin for dumpBackup.php:

 php dumpBackup.php \
   --plugin=AbstractFilter:extensions/ActiveAbstract/AbstractFilter.php \
   --current \
   --output=gzip:/dumps/abstract.xml.gz \
     --filter=namespace:NS_MAIN \
     --filter=noredirect \
     --filter=abstract

Where

  • current - pulls only the latest article revision
  • output - sets where the output stream will go
  • filters
    • namespace - only pull documents from this namespace
    • noredirect - don't show redirects
    • abstract - registers the abstracts filter and runs it from within dumpBackup.php
    • variants - if variants exist, pull all latest copies and output them to a separate abstracts file

It can optionally convert output text to a given language variant:

   --filter=abstract:variant=zh-cn

A possible way to run this in production would be

/usr/bin/php -q /apache/common/php-1.5/maintenance/dumpBackup.php   --wiki='quwiki' \
   --plugin=AbstractFilter:/apache/common/php-1.5/extensions/ActiveAbstract/AbstractFilter.php \
   --current   --report=1000   --force-normal   --server='x.x.x.x'  \
   --output=file:/mnt/dumps/public/quwiki/20090613/quwiki-20090613-abstract.xml  \
   --filter=namespace:NS_MAIN     --filter=noredirect     --filter=abstract
force-normal is added for better UTF-8 conversion.

整形

The required tags for each entry are:

  • doc
  • title
  • url
  • abstract
  • links
  • sublink

Example Listing

<doc>
	<title>Wikipedia: An American in Paris</title>
	<url>http://en.wikipedia.org/wiki/An_American_in_Paris</url>
	<abstract>An American in Paris is a symphonic composition by American composer George Gershwin, composed in 1928. Inspired .. </abstract>
	<links>
		<sublink linktype="nav"><anchor>Instrumentation</anchor><link>http://en.wikipedia.org/wiki/An_American_in_Paris#Instrumentation</link></sublink>
		<sublink linktype="nav"><anchor>Recordings</anchor><link>http://en.wikipedia.org/wiki/An_American_in_Paris#Recordings</link></sublink>
		<sublink linktype="nav"><anchor>Film</anchor><link>http://en.wikipedia.org/wiki/An_American_in_Paris#Film</link></sublink>
	</links>
</doc>
The ‎<abstract> text is trimmed to not run off this wiki page.