Wikibase/Indexing/RDF Dump Format

From mediawiki.org
Changes to the RDF mapping are subject to the Stable Interface Policy.

This page describes the RDF dump and export format produced by Wikidata and used for export and indexing purposes. Note that while it is close to the format used by the Wikidata Toolkit , it is not the same code and not the same format. While we strive to keep divergence to a minimum, there may be differences and one should use documentation only for the format that is actually being consumed.

This document describes the RDF dump as can be downloaded from Wikimedia dump source, and while it can be used to create queries for Wikidata query service, the service can have small differences in how the data there look like. See the WDQS data differences chapter for the full list.

The canonical URI of the Wikibase RDF ontology is http://wikiba.se/ontology. The current version can be found at http://wikiba.se/ontology-1.0.owl.

Changes to the RDF mapping are subject to the Stable Interface Policy.

Data model[edit]

the data used in the description of a single item

The RDF format is a binding for on the Wikibase data model and represents an export format for it. That means, in particular, that if/when the data model changes, the export format will be changed accordingly. This document will be updated for such changes. The following description assumes familiarity with the data model and the terminology used.

This RDF binding is based on the one designed for the Wikidata Toolkit by Denny Vrandecic and Markus Krötzsch, see https://web.archive.org/web/20190313052004/http://korrekt.org/papers/Wikidata-RDF-export-2014.pdf.

The following description uses prefixes to describe the IRIs of the RDF resources mentioned. See the Prefixes chapter for the full description. All examples below are given in Turtle format.

Versions[edit]

The version of the data model is specified by schema:softwareVersion predicate of the schema:Dataset node, which is either dump node for the dump or entity data node (wdata:) for single entity page. Released versions:

Version Description
0.0.1 Initial version.
0.0.2 Changed WKT coordinate order (see T130049)
0.0.3 Added page props option to wdata: (see T129046)
0.0.4 Added unit conversion & normalisation support (see T117031)
0.0.5 Added quantities without bounds. (see T115269)
0.1.0 Changed link encoding (see T131960)
1.0.0 Removed -beta from the ontology prefix (see T112127). The RDF mapping is now considered stable.

Header[edit]

For the RDF dump, there is the header node wikibase:Dump containing information about the license, the software version of the generator and the date the data was produced. In single-entity export, this data is attached to the data node (see below).

Example header:

 wikibase:Dump a schema:Dataset ;
     cc:license <http://creativecommons.org/publicdomain/zero/1.0/> ;
     schema:softwareVersion "1.0.1" ;
     schema:dateModified "2015-03-21T06:03:55Z"^^xsd:dateTime .
  • cc:license - specifies the IRI of the license that applies to the whole RDF document.
  • schema:softwareVersion - specifies which version of the dump format is being used (currently 1.0.0), will be updated when format changes, once the format is out of the beta period. The version updates will be done along the lines of semantic versioning, with major changes being BC breaking ones, minor being major BC-compatible changes and patch part changes on minor tweaks.
  • schema:dateModified - specifies the date of the dump's data validity. Some data that is contained in a dump may be more recent than this date, but it is guaranteed that no data in the dump is older than this date. The date should be close to the time of the oldest data contained in the dump, but for technical reasons may not be exactly the same as the time of the oldest data in the dump.

Entity representation[edit]

The entity is described in two nodes - data node and entity node. For entity Q1, data node is wdata:Q1 and entity node is wd:Q1.

Data node describes the metadata about the entity record in the Wikibase - i.e. data which are not part of the entity's information but instead describe the status of the entity inside Wikibase. It has type of schema:Dataset and contains the following metadata:

  • Information about the entity revision (schema:version) - this is a counter that increases with each modification of the entity data
  • Last modification time of the entity data (schema:dateModified) - as an xsd:dateTime timestamp
  • Link to the entity node with schema:about predicate

Example:

 wdata:Q2 schema:version "59"^^xsd:integer ;
     schema:dateModified "2015-03-18T22:38:36Z"^^xsd:dateTime ;
     a schema:Dataset ;
     schema:about wd:Q2 .

Entity node describes the actual entity data and has type wikibase:Item or wikibase:Property depending on the kind of entity. Other entity types can be introduced in the future.

Entity description includes the following:

  • Entity labels - the main name of the entity. Labels are defined as schema:name, rdfs:label and skos:prefLabel predicates with objects being language-tagged string literals.
  • Entity aliases - the secondary names of the entity. Aliases are defined as skos:altLabel predicates with objects being language-tagged string literals.
  • Entity description - the longer description of the entity. Defined as schema:description predicates with objects being language-tagged string literals.
  • Truthy statements (see below)
  • Predicates linking it to full statements

Example of the entity definition:

 wd:Q3 a wikibase:Item ;
     rdfs:label "The Universe"@en ;
     skos:prefLabel "The Universe"@en ;
     schema:name "The Universe"@en ;
     schema:description "The Universe is big"@en ;
     skos:altLabel "everything"@en ;
     wdt:P2 wd:Q3 ;
     wdt:P7 "value1", "value2" ;
     p:P2 wds:Q3-4cc1f2d1-490e-c9c7-4560-46c3cce05bb7 ;
     p:P7 wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37,
          wds:Q3-45abf5ca-4ebf-eb52-ca26-811152eb067c .

Page properties[edit]

Entity node can also carry additional information about the entity, such as number of links or statements.

The data is sourced from page properties and can be specified in config file. For example:

 wdata:Q42 a schema:Dataset ;
 	schema:about wd:Q42 ;
 	wikibase:statements "275"^^xsd:integer ;
    wikibase:identifiers "206"^^xsd:integer ;
 	wikibase:sitelinks "116"^^xsd:integer .

wikibase:statements specifies how many statements this entity has, wikibase:identifiers specifiers the number of statements with External Id values, and wikibase:sitelinks specifies the number of sitelinks. Additional statements can be introduced in the future.


Items[edit]

Entities that represent items have the common entity data as described above, plus can have sitelinks attached to them, as described below.

Properties[edit]

Entities that represent properties additionally feature the property type using wikibase:propertyType predicate. The object of the predicate is the property type described in Value representation below, with wikibase: prefix and each word capitalised, with no separators. I.e., wikibase-item becomes wikibase:WikibaseItem.

Each property is also linked to the predicates that are derived from it. Example:

 wd:P22 a wikibase:Property ;
     rdfs:label "Item property"@en ;
     wikibase:propertyType wikibase:WikibaseItem ;
     wikibase:directClaim wdt:P22 ;
     wikibase:claim p:P22 ;
     wikibase:statementProperty ps:P22 ;
     wikibase:statementValue psv:P22 ;
     wikibase:qualifier pq:P22 ;
     wikibase:qualifierValue pqv:P22 ;
     wikibase:reference pr:P22 ;
     wikibase:referenceValue prv:P22 ;
     wikibase:novalue wdno:P22 .

The property predicates also have type definitions:

 prv:P22 a owl:ObjectProperty .
 wdt:P22 a owl:DatatypeProperty .

The type depends on the type of the original property - whether its value is literal (DatatypeProperty) or IRI (ObjectProperty). However, p:, psv: , pqv: and prv: predicates would always be owl:ObjectProperty.

Note that wdno:P22 mentioned above is not a predicate, unlike others, but a class. See the full description of it in Novalue section.

Lexemes[edit]

Please see full description at Lexeme RDF mapping.

Lexemes are represented according to Lexeme RDF mapping. Example:

wd:L64723 a ontolex:LexicalEntry ;
     # lemma
     wikibase:lemma "hard"@en ;

     # language
     dct:language wd:Q1860 ;

     # lexical category
     wikibase:lexicalCategory wd:Q34698 ;

     # statements
     wdt:P2 wd:Q3 ;
     wdt:P7 "value1" , "value2" ;
     p:P2 wds:Q3-4cc1f2d1-490e-c9c7-4560-46c3cce05bb7 ;
     p:P7 wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 ,
          wds:Q3-45abf5ca-4ebf-eb52-ca26-811152eb067c ;

     # forms
     ontolex:lexicalForm wd:L64723-F1 ;

     # senses
     ontolex:sense wd:L64723-S1 .

MediaInfo[edit]

Please see full description at MediaInfo RDF mapping.

MediaInfo entities are represented according to MediaInfo RDF mapping. Example:

@prefix sdc: <https://commons.wikimedia.org/entity/> .
@prefix sdcdata: <https://commons.wikimedia.org/wiki/Special:EntityData/> .
@prefix sdcs: <https://commons.wikimedia.org/entity/statement/> .
@prefix sdcref: <https://commons.wikimedia.org/reference/> .
@prefix sdcv: <https://commons.wikimedia.org/value/> .

sdcdata:M6661797 a schema:Dataset ;
	schema:about sdc:M6661797 ;
	cc:license <http://creativecommons.org/publicdomain/zero/1.0/> ;
	schema:softwareVersion "1.0.0" ;
	schema:version "407884644"^^xsd:integer ;
	schema:dateModified "2020-03-29T15:25:01Z"^^xsd:dateTime .

sdc:M6661797 a wikibase:Mediainfo,
		schema:MediaObject,
		schema:ImageObject ;
	schema:encodingFormat "image/jpeg" ;
	schema:contentUrl <https://upload.wikimedia.org/wikipedia/commons/6/64/Douglas_adams_portrait.jpg> ;
	schema:contentSize "38890"^^xsd:integer ;
	schema:height "386"^^xsd:integer ;
	schema:width "600"^^xsd:integer ;
	schema:caption "Photo de Douglas Adams."@fr ;
	rdfs:label "Photo de Douglas Adams."@fr ;
	schema:caption "Douglas Adams' portrait"@en ;
	rdfs:label "Douglas Adams' portrait"@en ;
	schema:caption "Foto di Douglas Adams"@it ;
	rdfs:label "Foto di Douglas Adams"@it ;
	wdt:P180 wd:Q42 ;
	p:P180 sdcs:M6661797-25026d3f-444c-1915-1d5b-c29dbad8cbec .

sdcs:M6661797-25026d3f-444c-1915-1d5b-c29dbad8cbec a wikibase:Statement,
		wikibase:BestRank ;
	wikibase:rank wikibase:PreferredRank ;
	ps:P180 wd:Q42 .

This example demonstrates the MediaInfo data on wikimedia commons when used in federation with wikidata.

Statement types[edit]

The RDF format represents statements in two forms - truthy and full statements.

Truthy statements[edit]

Truthy statements represent statements that have the best non-deprecated rank for given property. Namely, if there is a preferred statement for property P2, then only preferred statements for P2 will be considered truthy. Otherwise, all normal-rank statements for P2 are considered truthy.

Truthy statement predicates have prefix wdt: with the property name (e.g. wdt:P2) and the object is the simple value (see below) for the statement. The qualifiers are ignored.

If the value has simple value normalisation (currently true only for external ID), normalised value is listed under wdtn: prefix, e.g. wdtn:P2.

Full statements[edit]

Full statements represent all data about the statement in the system. Full statement is represented as separate node, with prefix wds: with the id of the statement (e.g. wds:Q3-4cc1f2d1-490e-c9c7-4560-46c3cce05bb7). There is no guaranteed format or meaning to the statement id.

The statements are linked to the entity with the predicate with prefix p: and the name of the property (e.g. p:P2).

Statement representation[edit]

Warning Warning: It is possible that a statement refers to a property or item that no longer exists. Therefore you should not assume the predicates and objects are always defined.

The statement node represents a single statement about the entity. It has type wikibase:Statement. The statement can contain the rank, the simple value (see below) of the statement, the link to the full value, the qualifiers and the references.

The statement rank is represented by the predicate wikibase:rank and the object being one of:wikibase:NormalRank , wikibase:PreferredRank, wikibase:DeprecatedRank.

The statement that has the best rank for the property (i.e., preferred if there are any preferred statements in the property, otherwise normal) is also has type of wikibase:BestRank.

The simple value is represented by the predicate with prefix ps: and the name of the property (e.g. ps:P2) and the object being the simple value.

The full value (if required by the type) is represented by the predicate with prefix psv: (e.g. psv:P2) and the object being the full value node.

The statement always has no more than one value, but can have multiple qualifiers and references.

Qualifiers[edit]

The qualifiers are represented by predicates with prefix pq: and the name of the property (e.g. pq:P2) and the object being the simple value of the qualifier.

The full value (if required by the type) is represented by the predicate with prefix pqv: (e.g. pqv:P2) and the object being the full value node.

References[edit]

References are represented by the predicate prov:wasDerivedFrom with the object being the reference node (see below).

Example of the statement:

 wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 a wikibase:Statement, wikibase:BestRank ;
     ps:P2 wd:Q3 ;
     wikibase:rank wikibase:PreferredRank ;
     pq:P8 "-13000000000-01-01T00:00:00Z"^^xsd:dateTime ;
     pqv:P8 wdv:382603eaa501e15688076291fc47ae54 ;
     prov:wasDerivedFrom wdref:87d0dc1c7847f19ac0f19be978015dfb202cf59a,   
         wdref:d95dde070543a0e0115c8d5061fce6754bb82280 .

Reference representation[edit]

References represent provenance information about statements.

Reference is represented as node, with prefix wdref: and the local name being the hash derived from the reference contents (e.g. wdref:d95dde070543a0e0115c8d5061fce6754bb82280). The exact value of the hash is not guaranteed beyond the fact that the same references (i.e. ones with identical content) will generate the same hash, and the different one will generate the different one. The same reference (i.e. reference having the same properties with the same values) will be usually represented with single node, though duplicate reference nodes are possible in the data.

The type of the node is a wikibase:Reference.

The reference values are represented the same as statement values, with simple values using predicates with pr: prefix (e.g. pr:P2) and full values with prefix prv: (e.g. prv:P2) and the object being the full value node. Unlike statements, references can have any number of values.

Example of the reference node:

 wdref:d95dde070543a0e0115c8d5061fce6754bb82280 a wikibase:Reference ;
     pr:P7 "Some data" ;
     pr:P8 "1976-01-12T00:00:00Z"^^xsd:dateTime ;
     prv:P8 wdv:b74072c03a5ced412a336ff213d69ef1 .

Value representation[edit]

In the RDF format, the values are represented as two forms - simple value and full value. Simple value is always a literal or IRI, and is used as direct value that is convenient to search, index and match. The full value contains additional information about the value, such as ranges, precision, calendar used, etc. Note that while for many queries simple values will be enough, for other, more complex values, only full values will be adequate.

If the statement has a value (i.e. is not set to novalue) then the simple value will always be present.

Full values are represented as nodes having prefix wdv: and the local name being the hash of the value contents (e.g. wdv:382603eaa501e15688076291fc47ae54). There is no guarantee of the value of the hash except for the fact that different values will be represented by different hashes, and same value mentioned in different places will have the same hash. Value node has type wikibase:Value. The content of the node is defined by the type of the value (see below).

Example of the value node:

 wdv:b74072c03a5ced412a336ff213d69ef1 a wikibase:TimeValue ;
     wikibase:timeValue "+1976-01-12T00:00:00Z"^^xsd:dateTime ;
     wikibase:timePrecision "11"^^xsd:integer ;
     wikibase:timeTimezone "0"^^xsd:integer ;
     wikibase:timeCalendarModel <http://www.wikidata.org/entity/Q1985727> .

The following describes the handling of each kind of value, depending on the type of the value and the type of the property. Note that not all aspects of the data model are represented in RDF currently, some aspects that are currently unused (such as units or before/after values for dates) are omitted since they currently do not carry any useful information. This may change in the future if/when these aspects come into use by Wikidata.

String[edit]

Strings have value type string and property type string.

String is represented as a string literal. Strings only have simple value.

Commons media[edit]

Media on commons: have value type string and property type commonsMedia.

Commons media is represented as an IRI with the full Commons resource URL, derived from the Commons filename in the underlying data item. E.g.: <http://commons.wikimedia.org/wiki/Special:FilePath/Universe%20Photo.svg>. It has only simple value.

URL[edit]

URL values have value type string and property type url.

URL is represented as a an IRI matching the URL string (e.g. <http://www.wikidata.org/>). It has only simple value.

External Id[edit]

External Id values have value type string and property type external-id. They are represented by a string literal. It has only simple value.

If the property has a formatter URI for RDF configured (on Wikidata: formatter URI for RDF resource (P1921)), the RDF will also have normalised value, e.g.:

 wd:Q123 wdt:P234 "External-ID" ; 
         wdtn:P234 <http://external.example.com/reference/External-ID>


Wikibase Entity Id[edit]

Wikibase Entity Id values have value type wikibase-entityid and property type wikibase-item.

The entity is represented by its IRI, e.g. wd:Q2. It has only simple value.

Monolingual text[edit]

Monolingual text values have value type monolingualtext and property type monolingualtext.

The text is represented as a string literal with language tag. It has only simple value.

Globe coordinate[edit]

Coordinate text values have value type globecoordinate and property type globe-coordinate.

The simple value of the coordinate is the WKT string with the coordinates, with type geo:wktLiteral, e.g.: "Point(35.3 12.93)"^^geo:wktLiteral. The order of the coordinates in WKT is longitude, latitude (since format version 0.0.2).

The full value has latitude, longitude and precision as double, and the globe as IRI.

Example:

 wdv:a10564107110b2d5739b8fe235cddf73 a wikibase:GlobecoordinateValue ;
     wikibase:geoLatitude "12.933333333333"^^xsd:double ;
     wikibase:geoLongitude "35.3"^^xsd:double ;
     wikibase:geoPrecision "0.000277778"^^xsd:double ;
     wikibase:geoGlobe <http://www.wikidata.org/entity/Q2> .

Quantity[edit]

Quantity values have value type quantity and property type quantity.

The simple value of the quantity is the specified amount, as a decimal literal.

The full value includes amount, unit URI (the default for unit-less values being http://www.wikidata.org/entity/Q199), and optionally upper and lower bound. If no upper and lower bound are given, the uncertainty of the quantity is undefined. Exact values are represented by quantities that have the same value for amount, upper bound and lower bound.

Example:

wdv:cb213eea7a0b90d1d7f65c6eabfab9da a wikibase:QuantityValue ;
  wikibase:quantityAmount "+123"^^xsd:decimal ;
  wikibase:quantityUpperBound "+124"^^xsd:decimal ;
  wikibase:quantityLowerBound "+122"^^xsd:decimal ;
  wikibase:quantityUnit <http://www.wikimedia.org/entity/Q199> .


Time[edit]

Time values have value type time and property type time.

The simple value of the time value is either datetime value of type xsd:dateTime, if the value can be converted to Gregorian date in ISO format, or a string as represented in the database, if not. The xsd:dateTime dates follow XSD 1.1 standard, which uses the proleptic Gregorian calendar, and represents the year 1 BCE as +0000. This is in contrast the JSON representation of Julian and Gregorian dates, which follows the traditional year numbering, representing the year 1 BCE as -0001.

The full value includes the simple value above under wikibase:timeValue, precision and timezone as integers and calendar model as IRI. Note that the calendar model is the original values calendar model even if wikibase:timeValue was converted to Gregorian.

Example:

 wdv:85374678f22bda99efb44a5617d76e51 a wikibase:Time ;
     wikibase:timeValue "+1948-04-12T00:00:00Z"^^xsd:dateTime ;
     wikibase:timePrecision "11"^^xsd:integer ;
     wikibase:timeTimezone "0"^^xsd:integer ;
     wikibase:timeCalendarModel <http://www.wikidata.org/entity/Q1985727> .

Normalised values[edit]

Some values can be represented in several forms, depending on the purpose. For example, length can be expressed in different units - feet, inches, meters, miles, etc. In order to provide means to unify these forms and thus make data more friendly for automatic processing, the normalised values are introduced, which represent diverse data in a unified way.

Right now, the only value normalisation that is supported is converting units for quantities into base units - e.g. length to meters. In the future, more units and more normalisations may be added, which will be documented here. The conversion table is available on the Mediawiki gerrit if needed.

The only normalised simple values are external IDs (see below).

Normalised quantity[edit]

Normalised quantity values are value nodes that are parallel to the original data nodes but represented in base units. They are connected to their parent nodes by predicates with prefix having "v" replaced with "n" - i.e. psn:, prn: and pqn:, for example:

 wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 a wikibase:Statement, wikibase:BestRank ;
     ps:P8 "123"^^xsd:decimal ;
     psv:P8 wdv:382603eaa501e15688076291fc47ae54 ;
     psn:P8 wdv:85374998f22bda54efb44a5617d76e51 .

Original quantity value is connected to the normalised value by wikibase:quantityNormalized predicate:

 wdv:382603eaa501e15688076291fc47ae54 a wikibase:QuantityValue ;
     wikibase:quantityAmount "+123"^^xsd:decimal ;
     wikibase:quantityUpperBound "+124"^^xsd:decimal ;
     wikibase:quantityLowerBound "+122"^^xsd:decimal ;
     wikibase:quantityUnit <http://www.wikidata.org/entity/Q218593> ;
     wikibase:quantityNormalized wdv:85374998f22bda54efb44a5617d76e51.

The normalised value has wikibase:quantityNormalized pointing to itself.

If the value is already normalised - i.e. is expressed in base units - then both "v" and "n" predicates point to the same value, and wikibase:quantityNormalized for this value points to itself.

Quantities with no units or with units that are not normalisable (have no base unit they can be reduced to) do not have normalised predicates and normalised values and do not include wikibase:quantityNormalized.

The recommendation is to have no more than one base unit per property. Base units depend on Wikibase configuration and usually are chosen to represent universally accepted standard units, such as SI units.

Normalised External ID[edit]

For external IDs, normalisation converts string value to URL, if the URL formatter for that purpose is defined in property data (via canonicalUriProperty setting), then the normalised value will be listed as wdtn: value for truthy values, and as normalised value for the statements in psn:, prn: and pqn: predicates, depending on the context where the value appears.

Special values[edit]

Wikibase data model has two special kinds of snaks - PropertySomeValueSnak, specifying a value that exists but whose identity or value is unknown, and PropertyNoValueSnak, specifying that a value does not exist.

Somevalue[edit]

Unknown value is represented as RDF blank node in both simplified and full statements:

 wd:Q3 a wikibase:Item, wdt:P2 _:genid1 .
 wds:Q3-45abf5ca-4ebf-eb52-ca26-811152eb067c a wikibase:Statement ;
     ps:P2 _:genid2 ;
     wikibase:rank wikibase:NormalRank .

Novalue[edit]

Novalue is represented not by a regular value but as a class of the entity or statement or reference, with prefix wdno: and the name of the property. Example:

 wd:Q3 a wikibase:Item, wdno:P7 .
 
 wds:Q3-45abf5ca-4ebf-eb52-ca26-811152eb777c a wikibase:Statement,  wdno:P7 ;
     wikibase:rank wikibase:NormalRank .

The entity has a wdno: class if it has a truthy novalue statement for that property. Novalue in the main snak or qualifiers of a statement corresponds to a wdno: class on the statement node, and novalue in a reference snak corresponds to a wdno: class on the reference node.

The classes for wdno: are defined as follows:

 wdno:P2 a owl:Class ;
    owl:complementOf _:genid1 .
 
 _:genid1 a owl:Restriction ;
    owl:onProperty wdt:P2 ;
    owl:someValuesFrom owl:Thing .

Sitelinks[edit]

The links are represented as set of predicates describing the link URL. The type of the node is schema:Article and it linked with the entity via schema:about predicate.

Badges are described with wikibase:badge predicates. schema:name predicate holds the plain-text name of the article, in the language of the linked wiki.

Example:

 <https://en.wikipedia.org/wiki/Duck> a schema:Article ;
     schema:about wd:Q3 ;
     schema:inLanguage "en" ;
     schema:isPartOf <https://en.wikipedia.org/> ;
     schema:name "Duck"@en ;
     wikibase:badge wd:Q5 .

 <https://en.wikipedia.org/> wikibase:wikiGroup "wikipedia" .

The subject URL is composed from the language site prefix and the article name, URL-encoded according to RFC 3986, e.g.:

<https://ru.wikipedia.org/wiki/%D0%A3%D1%82%D0%BA%D0%B0>

More specifically, encoding used is as follows:

  1. Normalise the title by replacing spaces with underscores (_).
  2. Apply wfUrlencode() function, which percent-encodes all non-alphanumeric characters except ";:@$!*(),/-_~".

Redirects[edit]

Redirected entities are implemented as owl:sameAs predicates, for example if Q6 redirects to Q1, the dump would be:

 wd:Q6 owl:sameAs wd:Q1 .


Prefixes used[edit]

The prefixes are used in RDF formats that allow short prefixes (such as Turtle and RDF). For other formats, the full URL is used.

All prefix URLs that do not contain hostname are prefixed with the hostname of the generating wiki. All prefix URLs that contain hostname are fixed and do not depend on generating wiki.

Prefix Full URL Usage Example
wikibase: http://wikiba.se/ontology# Wikibase ontology
 wd:Q2 a wikibase:Item
Nodes
wdata: /Special:EntityData/ Data set describing certain entity
wdata:Q2 schema:about wd:Q2 .
wd: /entity/ Wikibase entity - item or property.
wd:Q2 p:P9 wds:Q2-82a6e009-4f93-28dc-3555-38bbfc3afe6a
wds: /entity/statement/ Statement node, describes claim about entity.
wds:Q2-a4078553-4ec1-a64a-79e7-c5b5e17b2782
  a wikibase:Statement
wdv: /value/ Value node
wdv:87d0dc1c7847f19ac0f19be978015dfb202cf59a a wikibase:Value
wdref: /reference/ Reference node
wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 prov:wasDerivedFrom wdref:87d0dc1c7847f19ac0f19be978015dfb202cf59a .
wdref:87d0dc1c7847f19ac0f19be978015dfb202cf59a a wikibase:Reference .
Predicates
wdt: /prop/direct/ Truthy assertions about the data, links entity to value directly.
wd:Q2  wdt:P9 <http://acme.com/>
wdtn: /prop/direct-normalized/ Truthy assertions about the data, links entity to normalised value directly.
wd:Q2  wdtn:P9 <http://acme.com/ABCDE>
p: /prop/ Links entity to statement
wd:Q2 p:P9 wds:Q2-82a6e009-4f93-28dc-3555-38bbfc3afe6awd
wdno: /prop/novalue/ Class to use when the entity has novalue for this property.
wd:Q2 a wdno:P9 .
ps: /prop/statement/ Links value to statement
wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 ps:P8 "-13000000000-01-01T00:00:00Z"^^xsd:dateTime
psv: /prop/statement/value/ Links deep value to statement
wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 psv:P8 wdv:87d0dc1c7847f19ac0f19be978015dfb202cf59a
psn: /prop/statement/value-normalized/ Links normalised value to statement node
wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 psn:P8 wdv:87d0dc1c7847f19ac0f19be978015dfb202cf59a
pq: /prop/qualifier/ Links qualifier to statement node
wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 pq:P8 "-13000000000-01-01T00:00:00Z"^^xsd:dateTime
pqv: /prop/qualifier/value/ Links qualifier deep value to statement node
wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 pqv:P8 wdv:87d0dc1c7847f19ac0f19be978015dfb202cf59a
pqn: /prop/qualifier/value-normalized/ Links normalised qualifier value to statement node
 wds:Q3-24bf3704-4c5d-083a-9b59-1881f82b6b37 pqn:P8 wdv:87d0dc1c7847f19ac0f19be978015dfb202cf59a
pr: /prop/reference/ Links reference to value
 wdref:87d0dc1c7847f19ac0f19be978015dfb202cf59a pr:P8 "-13000000000-01-01T00:00:00Z"^^xsd:dateTime
prv: /prop/reference/value/ Links reference to deep value
 wdref:87d0dc1c7847f19ac0f19be978015dfb202cf59a prv:P8 wdv:87d0dc1c7847f19ac0f19be978015dfb202cf59a
prn: /prop/reference/value-normalized/ Links reference to normalised value
 wdref:87d0dc1c7847f19ac0f19be978015dfb202cf59a prn:P8 wdv:87d0dc1c7847f19ac0f19be978015dfb202cf59a

Standard prefixes used:

Prefix Full URL
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: http://www.w3.org/2000/01/rdf-schema#
xsd: http://www.w3.org/2001/XMLSchema#
owl: http://www.w3.org/2002/07/owl#
skos: http://www.w3.org/2004/02/skos/core#
schema: http://schema.org/
prov: http://www.w3.org/ns/prov#
geo: http://www.opengis.net/ont/geosparql#


Full list of prefixes[edit]

This list can be used for queries in SPARQL:

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX cc: <http://creativecommons.org/ns#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX hint: <http://www.bigdata.com/queryHints#> 
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <http://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX pqn: <http://www.wikidata.org/prop/qualifier/value-normalized/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prn: <http://www.wikidata.org/prop/reference/value-normalized/>
PREFIX prv: <http://www.wikidata.org/prop/reference/value/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdata: <http://www.wikidata.org/wiki/Special:EntityData/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wdref: <http://www.wikidata.org/reference/>
PREFIX wds: <http://www.wikidata.org/entity/statement/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wdtn: <http://www.wikidata.org/prop/direct-normalized/>
PREFIX wdv: <http://www.wikidata.org/value/>
PREFIX wikibase: <http://wikiba.se/ontology#>


Ontology[edit]

This compiles the list of all objects and predicates that are internal to the format. For the meaning of the prefixes, see the prefixes list.

Objects[edit]

Name Usage Context
wikibase:Item Wikibase item Type for wd:Q123 describing item
wikibase:Property Wikibase property Type for wd:P123 describing property
wikibase:Lexeme Wikibase lexeme Type for wd:L123 describing lexeme
wikibase:Form Wikibase lexeme form Type for wd:L123-F1 describing form
wikibase:Sense Wikibase lexeme sense Type for wd:L123-S1 describing sense
wikibase:Statement Statement about the entity Type for wds:1234 describing statement
wikibase:Reference Reference node Type for wdref:1234 describing reference
wikibase:TimeValue Value node representing time value Type for wdv:1234 describing time value
wikibase:QuantityValue Value node representing quantity value Type for wdv:1234 describing quantity value
wikibase:GlobecoordinateValue Value node representing coordinate value Type for wdv:1234 describing coordinate value
wikibase:Dump Node describing the dump datatset Used in dump header to describe metadata for whole dump
wikibase:PreferredRank Represents preferred rank for the statement Used as object of wikibase:rank
wikibase:NormalRank Represents normal rank for the statement Used as object of wikibase:rank
wikibase:DeprecatedRank Represents deprecated rank for the statement Used as object of wikibase:rank
wikibase:BestRank Represents statement that has best rank for the property - i.e. suitable for inclusion as truthy statement Used as type of wikibase:Statement
wikibase:WikibaseItem Entity reference type Used as object of wikibase:propertyType
wikibase:CommonsMedia Commons media reference type Used as object of wikibase:propertyType
wikibase:GlobeCoordinate Geo coordinate type Used as object of wikibase:propertyType
wikibase:Monolingualtext Single language text value Used as object of wikibase:propertyType
wikibase:Quantity Quantity type Used as object of wikibase:propertyType
wikibase:String String value Used as object of wikibase:propertyType
wikibase:Time Time value Used as object of wikibase:propertyType
wikibase:Url URL reference type Used as object of wikibase:propertyType

Predicates[edit]

Italicised names mean that any property name can be substituted instead of example name P123.

Name Usage Domain Range
wdt:P123 Link entity to truthy statement value wikibase:Item|wikibase:Property Simple value
wdtn:P123 Link entity to normalised truthy statement value wikibase:Item|wikibase:Property Simple value
p:P123 Link entity to statement wikibase:Item|wikibase:Property wikibase:Statement
ps:P123 Link statement to simple value wikibase:Statement Simple value
pr:P123 Link reference to simple value wikibase:Reference Simple value
pq:P123 Link statement to qualifier value wikibase:Statement Simple value
psv:P123 Link statement to value node wikibase:Statement wikibase:Value
psn:P123 Link statement to normalised value node wikibase:Statement wikibase:Value
prv:P123 Link reference to value node wikibase:Reference wikibase:Value
prn:P123 Link reference to normalised value node wikibase:Reference wikibase:Value
pqv:P123 Link statement to qualifier value node wikibase:Statement wikibase:Value
pqn:P123 Link statement to normalised qualifier value node wikibase:Statement wikibase:Value
wikibase:rank Specifies rank of the statement wikibase:Statement One of the rank objects above
wikibase:badge Badge attached to a sitelink schema:Article wikibase:Item - URL of the badge
wikibase:propertyType Property type of the property entity wikibase:Property One of the property type objects above
wikibase:directClaim Links property entity to direct claim predicate wikibase:Property wdt:P123
wikibase:directClaimNormalized Links property entity to normalised direct claim predicate wikibase:Property wdtn:P123
wikibase:claim Links property entity to claim/statement predicate wikibase:Property p:P123
wikibase:statementProperty Links property entity to statement simple value predicate wikibase:Property ps:P123
wikibase:statementValue Links property entity to statement full value predicate wikibase:Property psv:P123
wikibase:statementValueNormalized Links property entity to statement normalised value predicate wikibase:Property psn:P123
wikibase:qualifier Links property entity to qualifier simple value predicate wikibase:Property pq:P123
wikibase:qualifierValue Links property entity to qualifier full value predicate wikibase:Property pqv:P123
wikibase:qualifierValueNormalized Links property entity to qualifier normalised value predicate wikibase:Property pqn:P123
wikibase:reference Links property entity to reference simple value predicate wikibase:Property pr:P123
wikibase:referenceValue Links property entity to reference full value predicate wikibase:Property prv:P123
wikibase:referenceValueNormalized Links property entity to reference normalised value predicate wikibase:Property prn:P123
wikibase:hasViolationForConstraint Links statement violating a constraint to the constraint statement wikibase:Statement wikibase:Statement
wikibase:lemma Links Wikibase lexeme with the lemma text wikibase:Lexeme Simple string value
wikibase:lexicalCategory Links Wikibase lexeme with its lexical category item wikibase:Lexeme wikibase:Item
wikibase:grammaticalFeature Links Wikibase lexeme form with its grammatical features wikibase:Form/ontolex:Form wikibase:Item

The following predicates are used in deep values for the values of specific types. All these predicates have the domain of wikibase:Value and the range depending on type below.

Predicates for Globecoordinate[edit]

Name Type Meaning
wikibase:geoLatitude xsd:double Latitude component of the coordinate
wikibase:geoLongitude xsd:double Longitude component of the coordinate
wikibase:geoPrecision xsd:double Precision of the coordinates
wikibase:geoGlobe IRI The URL of the globe, e.g. http://www.wikidata.org/entity/Q2 (Earth)

Predicates for Quantity[edit]

Name Type Meaning
wikibase:quantityAmount xsd:decimal The specified amount
wikibase:quantityUpperBound xsd:decimal The upper limit of the value range
wikibase:quantityLowerBound xsd:decimal The lower limit of the value range
wikibase:quantityUnit IRI The unit of measurement, for unit-less quantities is http://www.wikidata.org/entity/Q199 (i.e. "1")
wikibase:quantityNormalized IRI Points to the normalised value, if exists.

Predicates for Time[edit]

Name Type Meaning
wikibase:timeValue xsd:dateTime|string Gregorian time or string if the value can not be represented as Gregorian time
wikibase:timePrecision xsd:integer Time precision constant
wikibase:timeTimezone xsd:integer Timezone offset from UTC in minutes
wikibase:timeCalendarModel IRI URL of the calendar used, e.g. http://www.wikidata.org/entity/Q1985727 (Gregorian)

WDQS data differences[edit]

The Wikidata query service has the data in the format described above, but there are small differences that can be important while writing SPARQL queries:

  1. Types (a or rdf:type) for wikibase:Item, wikibase:Statement, wikibase:Reference , wikibase:Lexeme, wikibase:Form, wikibase:Sense are currently omitted for performance reasons.
    • To filter for items, you can use wikibase:sitelinks [] instead of a wikibase:Item (only items have a number of sitelinks).
    • To filter for statements, you can use wikibase:rank [] instead of a wikibase:Statement (only statements have a rank).
    • To filter for references, you can use [] prov:wasDerivedFrom ?reference instead of ?reference a wikibase:Reference, but note that this may return a reference more than once. (Usually, you’ll get references via prov:wasDerivedFrom from a statement anyway.)
    • To filter for senses, you can use ontolex:LexicalSense instead of wikibase:Sense.
    • To filter for forms, you can use ontolex:Form instead of wikibase:Form.
  2. Data nodes (wdata:Q2) are not stored, all the information like version, revision and page props is stored in the entity node (wd:Q2) instead. This is done for performance reasons.
  3. For labels, only rdfs:label is stored but not schema:name or skos:prefLabel. Since they all have the same data, storing all three is redundant.
  4. Redirects are recorded but currently have no additional semantics implemented.
  5. WDQS now uses local IRIs (Skolem IRIs) instead of blank nodes to represent somevalue. These can be tested with FILTER wikibase:isSomeValue(?node) rather than FILTER isBlank(?node)

See also SPARQL query examples for how to query the data using WDQS service.