Jump to content

Help:Wikidata

From Wikifunctions

One of the key facets of Wikifunctions is to make use of Wikidata's broad repository of data. This page is an overview of where and how you can do that today, hopefully understandable with only an intermediate knowledge of Wikifunctions.

Wikidata represents things—physical objects, big and small, as well as collectives, classes, and concepts—as Items, giving each a unique identifier like Q42 or Q104587954 (the Item's 'QID').
Separately, it represents the words from the world's languages as Lexemes, with identifiers like L100000. These will be invaluable for the natural language generation goals of Abstract Wikipedia.

Statement model

Information about Items (and other entities) is given as a list of Statements, a.k.a. subject–predicate–object triples. (Though when you browse Wikidata, statements with the same predicate Property are grouped, and the subject is omitted since it's clear from the page you're on.) These are represented in Wikifunctions with the Wikidata statement (Z6003) type.
The subject is always (a reference to) an Item/Lexeme/etc., the predicate is always (a reference to) a Property, and the value can be of different Types depending on what Wikidata datatype it uses. Wikidata also has the concepts of 'unknown value' and 'no value', which are represented on a Z6003 with the Wikidata claim subtype (Z6020) enum.

Statements have a rank, and can have qualifiers which either clarify the predicate or provide additional "sub-values". For example, the question "When was Wikifunctions started?" has multiple answers, and so you'll find multiple Statements on its Item with the predicate inception (P571). They have applies to part (P518) qualifiers to distinguish in what way their value is the inception date. (You can also call this Function to get the list and inspect them.)

Identifiers

For efficiency, most operations will return just a reference to an Item/Property/etc. and not a representation of the whole entity, which may be quite large even without considering nested Items. The full entity, or part of it, can then be 'fetched' or 'resolved' as necessary with specialised Functions.

Type for referencesType for resolved entities
Property Wikidata property reference (Z6092)
(PID)
Wikidata property (Z6002)
Entity Schema ——
Item Wikidata item reference (Z6091)
(QID)
Wikidata item (Z6001)
Lexeme Wikidata lexeme reference (Z6095)
(LID)
Wikidata lexeme (Z6005)
Lexeme Sense Wikidata lexeme sense reference (Z6096)
(LSID)
Wikidata lexeme sense (Z6006)
Lexeme Form Wikidata lexeme form reference (Z6094)
(LFID)
Wikidata lexeme form (Z6004)
Sitelink —Wikidata sitelink (Z6039)
Statement
(triple w/ all 'optionals')
—Wikidata statement (Z6003)
Claim
(triple w/o 'optionals')
—also Z6003
Snak
(predicate–value pair)
—Wikidata property claim (Z6007)
Reference
(citation)
—Wikidata reference (Z6008)

Data types

Main page: d:Help:Data type

The Wikibase software powering Wikidata has 2 concepts for the "type" of a Property: its 'data type', and the underlying 'value type'. Any particular 'data type' always corresponds to the same 'value type', but some 'value types' (string and wikibase-entityid) are used for multiple 'data types'. The 'value type' determines how the value is entered and stored, while the 'data type' determines how it's displayed.
As it applies to Wikifunctions: When statements are fetched from Wikidata, the Types used to represent their values roughly correspond with the predicate Property's 'value type'. The exact mappings from 'data type' to WF Type are given in the table below. These are used for both a statement's main value Z6003K3 and qualifier/reference values Z6007K2.

Data typeFetched asNotes
String
example: taxon name (P225)
String (Z6)
example
URL
example: official website (P856)
String (Z6)
example
External identifier
example: CAS Registry Number (P231)
String (Z6)
example
You can get the full URL with format external ID-typed Wikidata statement as URL (Z43211).
Commons media
example: image (P18)
String (Z6)
example
Represents a Wikimedia Commons media file name (Q141554480) (Wikimedia Commons namespace (P2307)=File:).

As of 2026-09, the media files cannot be fetched or embedded by filename, making this useless; see phab:T428224.

Geographic shape
example: geoshape (P3896)
String (Z6)
example
Represents a MediaWiki page title (Q83336425) (Wikimedia Commons namespace (P2307)=Data:).

As of 2026-09, the data files cannot be fetched or embedded by filename, making this useless.

Tabular data
example: tabular population (P4179)
String (Z6)
example
Represents a MediaWiki page title (Q83336425) (Wikimedia Commons namespace (P2307)=Data:).

As of 2026-09, the data files cannot be fetched by filename, making this useless.

Mathematical expression
example: defining formula (P2534)
String (Z6)
example
With no <math/> equivalent available, these can't be displayed in articles as mathematical notation.
Musical Notation
example: LilyPond notation (P6883)
String (Z6)
example
With no <score/> equivalent available, these can't be displayed in articles as musical notation.
Monolingual text
example: official name (P1448)
Monolingual text (Z11)
example
Quantity
example: mass (P2067)
Wikidata quantity (Z6010)
example
Globe coordinate
example: coordinate location (P625)
Wikidata geo-coordinate (Z6011)
example
Values for globe other than Earth (Q2) are supported (example), but most geospatial Functions will assume Q2. And convention dictates that Q2 is to be interpreted as World Geodetic System 1984 (Q11902211).
Time
example: point in time (P585)
Wikidata time (Z6064)
example
Includes Gregorian dates and, as of 2026-09, Julian dates.
Item
example: instance of (P31)
Wikidata item reference (Z6091)
example
Property
example: related Wikidata property (P1659)
Wikidata property reference (Z6092)
example
Form
example: homophone form (P10822)
Wikidata lexeme form reference (Z6094)
example
Lexeme
example: combines lexemes (P5238)
Wikidata lexeme reference (Z6095)
example
Sense
example: translation (P5972)
Wikidata lexeme sense reference (Z6096)
example
Entity Schema
example: EntitySchema for this class (P12861)
N/A
example
Statements with this data type are omitted from the objects returned by fetching Functions.

Lightweight enumerations

Some Types on Wikifunctions are 'enumerations' (lists of options) where the valid elements are defined in terms of QIDs. You can find these on WF:Type, and the Functions for working with them in the Catalogue.

Creating such enumeration Types currently requires submitting a proposal, which will be fulfilled by someone with Type creation permissions once it gains the support of the community.

Datetime

Main page: WF:Time in Wikidata

Natural language generation