Wikidata:Bagaimana hendak menggunakan data di projek Wikimedia

From Wikidata
Jump to navigation Jump to search
This page is a translated version of the page Wikidata:How to use data on Wikimedia projects and the translation is 53% complete.
Outdated translations are marked like this.

Data from Wikidata can be directly displayed on Wikimedia projects, with different methods. With the parser function or Lua code, it is possible to display labels, descriptions, values, references, and a lot of other information stored on Wikidata.

For an overview of uses on Wikidata on Wikimedia projects see Wikidata:Wikidata in Wikimedia projects.

On this page, you will learn how to use Wikidata data on your wiki. You can also learn more about what is Wikidata, how the information is organized, or browse the glossary.

Bolehkah saya mencapai data Wikidata daripada wiki saya?

The two main client functionalities, parser function and access via Lua, can be enabled together on the wikis of the Wikimedia projects. This is the case for almost all Wikimedia projects now.

To check if these functionalities are activated on a wiki, you can access the page Special:Version. In the section "Parser function hooks", if "statements" appears in the list, that means that you can use it on this wiki.

The access to Wikidata data is currently restricted to the Wikimedia projects, because of technical limitations. If you have your own instance of MediaWiki, you can't use Wikidata's data using these features. However, you can set up your own Wikibase instance and use data from there in the same way.

Fungsi penghurai

The first way to access data is to use the #statements parser function. This function will allow you to display the value of any statement included in an item.

Gambar rajah model data Wikidata.

Capaian terus

On a page that is connected to a Wikidata item via the interwiki links, you can use the function by adding the label of the property you want in your language or the P-number of the property. The code has to be added in the wikicode.

Examples:

  • {{#statements:member of political party}} or {{#statements:P102}} will return the "member of political party" value.
  • {{#statements:discoverer or inventor}} or {{#statements:P61}} will return the "discoverer or inventor" value.
  • On w:en:Douglas Adams, the code {{#statements:country of citizenship}} will display "United Kingdom".

Capaian sebarangan

You can also display data from an item that is not connected via an interwiki link. For this, you use the same function, adding a parameter from= followed by the Q-id of the item.

Contoh:

  • {{#statements:birth name|from=Q42}} akan memaparkan "Douglas Noël Adams"
  • {{#statements:country of citizenship|from=Q42}} akan memaparkan "United Kingdom".
  • {{#statements:P1476|from=Q191380}} akan memaparkan "Notre-Dame de Paris"
  • {{#statements:author|from=Q191380}} akan memaparkan "Victor Hugo"
  • {{#statements:publication date|from=Q191380}} akan memaparkan "1831"

Nilai-nilai pelbagai

When a statements has multiple values, the parser function will show the "best" value(s), which means:

Where there are multiple values, they are shown in a comma-separated list.

Contoh: {{#statements:occupation|from=Q42}} memaparkan "playwright, screenwriter, novelist, children's writer, science fiction writer, comedian, writer, musician" (terdapat pekerjaan lain di Douglas Adams (Q42) tetapi hanya beberapa yang lebih disukai)

Nilai-nilai terformat

Untuk beberapa sifat, fungsi penghurai #statements (pernyataan) akan memaparkan nilai dalam format yang tertentu.

Imej-imej Commons

Fungsi penghurai memaparkan satu pratonton lakaran kenit imej, mensaizkannya kepada 200 piksel. Ia dipautkan kepada laman penerangan fail di Wikimedia Commons.

{{#statements:image|from=Q42}} memaparkan

Koordinat geografi

Fungsi penghurai memaparkan koordinat dalam format darjah-minit-saat.

{{#statements:coordinate location|from=Q243}} memaparkan 48°51′30″N 2°17′40″E

Monolingual text

Text values are displayed as they are, with no formatting.

{{#statements:native label|from=Q31}} memaparkan "Koninkrijk België, Royaume de Belgique, Königreich Belgien".

Tarikh

Nilai tarikh akan diformatkan dalam format hari-bulan-tahun.

{{#statements:date of birth|from=Q42}} memaparkan 11 March 1952

Pautan

Pautan boleh diklik.

{{#statements:official website|from=Q243}} memaparkan https://www.toureiffel.paris, https://www.toureiffel.paris/en

External IDs

An external ID will provide a direct link to the external website.

{{#statements:IMDb ID|from=Q42}} memaparkan nm0010930

Item

{{#statements:capital|from=Q142}} displays Paris

Nilai mentah

Untuk memaparkan nilai yang tidak berpaut, gunakan #property.

Contoh:

{{#property:IMDb ID|from=Q42}} memaparkan nm0010930

Modul

Data can also be accessed with Lua modules, which are much more flexible. Modules that access data from Wikidata should be organized as instance of Wikimedia module using Wikidata (Q59259626). For instance, Module:Wikidata (Q12069631) is available on many wikis, see w:Module:Wikidata#Usage for usage instruction. If your wiki does not contain a module you can copy it from another wiki and add documentation.

For a full technical reference of Lua functions for accessing Wikidata, see mw:Extension:Wikibase Client/Lua.

Templat

Some templates use modules to access Wikidata data. They are as simple to use as regular templates. Moreover, using Wikidata, some parameters become unnecessary. For instance, some infoboxes are able to retrieve data from Wikidata, so you just have to insert the template and all the data will magically appear (if the needed information is present on the Wikidata item, of course). For templates using Wikidata see Category:Templates using data from Wikidata (Q11985372).

If you want to create a template on your wiki, check your documentation page about Module:Wikidata and already existing templates.

Senarai

Senarai yang dikemas kini secara kerap

Daily updated lists based on SPARQL queries can be configured using Template:Wikidata list (Q19860885). Content is replaced daily.

There are essentially two uses:

  • Work lists: lists with topics to be covered in project namespace. Results can be limited to topics that don't exist.
  • Reference list: lists for a specific topic in article namespace.

This is currently the most efficient way of doing lists.

Senarai dinamik

Content is displayed from various items based on a selection done in a Lua module.

Senarai manual

A series of items are selected and their properties displayed in an article. Content from Wikidata can be completed with locally edited text.

Examples of use cases

Magic infobox

A call of the general cheese infobox template fr:Modèle:Infobox Fromage without any parameters, on an article about a type of cheese, for example fr:Reblochon, produces an infobox with details about that type of cheese, using data from the Wikidata item linked to the article.

Commons

Commons creator template uses Wikidata with arbitrary access to provide information about the creators of the works.

Graf

Model kewibawaan

Wikisumber

Bagaimana untuk mendapatkan bantuan?

You will find contributors on the Wikidata project chat which exists in different languages. Moreover, some wikis have projects dedicated to Wikidata : see Project:WikiProject Wikidata (Q20855878).


See also