Wikibase/Indexing/RDF Dump Format

From MediaWiki.org
Jump to: navigation, search
Caution! Caution: The Wikibase ontology is still in beta and may change without a version increment.
Changes to the RDF mapping are however 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 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 Wikidat Toolkit by Denny Vrandecic and Markus Krötzsch, see 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.

The following diagram illustrates the data used in the description of a single item:

Rdf mapping.svg

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 & normalization support (see T117031)
0.0.5 Added quantities without bounds. (see T115269)

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 "0.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 0.0.1), 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 "112"^^xsd:integer ;
        wikibase:sitelinks "99"^^xsd:integer .

wikibase:statements specifies how many statements this entity has, 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 capitalized, 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.

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.

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]

The statement node represents 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 a 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.

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 decimal, and the globe as IRI.

Example:

v:a10564107110b2d5739b8fe235cddf73 a wikibase:GlobecoordinateValue ;
    wikibase:geoLatitude "12.933333333333"^^xsd:decimal ;
    wikibase:geoLongitude "35.3"^^xsd:decimal ;
    wikibase:geoPrecision "0.000277778"^^xsd:decimal ;
    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 an 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:

v: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:

v: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> .

Normalized 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 normalized values are intrduced, which represent diverse data in a unified way.

Right now, the only normalization that is supported is converting units for quantities into base units - e.g. length to meters. In the future, more units and more normalizations may be added, which will be documented here.

Normalized quantity[edit]

Normalized 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 normalized 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.wikimedia.org/entity/Q218593> ;
    wikibase:quantityNormalized wdv:85374998f22bda54efb44a5617d76e51.

The normalized value has wikibase:quantityNormalized pointing to itself.

If the value is already normalized - 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 normalizable (have no base unit they can be reduced to) do not have normalized predicates and normalized 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.

Special values[edit]

Wikibase data model has two special values - somevalue (unknown) and novalue, specifying value that is known to exist but its exact value is unknown and the value that is known to not exist.

Somevalue[edit]

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

wd:Q3 a wikibase:Item, p: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 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>

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-beta#[1] 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/>
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 normalized 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 normalized 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 normalized 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 rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX schema: <http://schema.org/>
PREFIX cc: <http://creativecommons.org/ns#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdata: <http://www.wikidata.org/wiki/Special:EntityData/>

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>

PREFIX wds: <http://www.wikidata.org/entity/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdref: <http://www.wikidata.org/reference/>
PREFIX wdv: <http://www.wikidata.org/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX pqn: <http://www.wikidata.org/prop/qualifier/value-normalized/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prv: <http://www.wikidata.org/prop/reference/value/>
PREFIX prn: <http://www.wikidata.org/prop/reference/value-normalized/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>

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: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 Value node representing 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]

Italicized 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
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 normalized value node wikibase:Statement wikibase:Value
prv:P123 Link reference to value node wikibase:Reference wikibase:Value
prn:P123 Link reference to normalized value node wikibase:Reference wikibase:Value
pqv:P123 Link statement to qualifier value node wikibase:Statement wikibase:Value
pqn:P123 Link statement to normalized 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: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 normalized 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 normalized 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 normalized value predicate wikibase:Property prn:P123

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:decimal Latitude component of the coordinate
wikibase:geoLongitude xsd:decimal Longitude component of the coordinate
wikibase:geoPrecision xsd:decimal 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 normalized 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. Ontology prefix on WDQS does not have -beta suffix and is always http://wikiba.se/ontology#
  2. Types (a or rdf:type) for wikibase:Item, wikibase:Statement, wikibase:Reference are currently omitted for performance reasons.
  3. 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.
  4. 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.
  5. Redirects are recorded but currently have no additional semantics implemented.

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

  1. -beta suffix will be removed when going into production