Study Vault Search notes, aliases and full text
Graph
ConceptDBISAI-written · not yet proofread

Wikidata Prefix System

Wikidata writes the same property Pxxx with different prefixes (wdt:, p:, ps:, pq:) depending on whether the triple skips the statement node, leads to it, or leads from it to the main value or to a qualifier; entities use wd:.

Properties#

  • wdt:P166, p:P166, ps:P166, pq:P166 are technically different IRIs; the common suffix P166 says that they express the same relation.
  • Path structure:
    entity ──p:Pxxx──▶ statement node ──ps:Pxxx──▶ value
                                      ──pq:Pyyy──▶ qualifier value
    

When to use which:

NeedUse
reference a known entitywd:Qxxx
simple property value, no qualifierswdt:Pxxx
value with qualifiers (year, for work, start time, …)p:Pxxx → ps:Pxxx + pq:Pyyy
filter by type (“instance of”)wdt:P31 on the value, not on the statement node
English namerdfs:label + FILTER (LANG(?x) = "en")

Example#

Which Oscars did Meryl Streep win, and for which movies?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?movie ?award WHERE {
  wd:Q873   p:P166    ?mediator .        # Meryl Streep → award statement node
  ?mediator ps:P166   ?award_id .        # which award
  ?mediator pq:P1686  ?movie_id .        # qualifier: for work
  ?award_id wdt:P31   wd:Q19020 .        # award is an instance of Academy Award
  ?award_id rdfs:label ?award . FILTER (LANG(?award) = "en")
  ?movie_id rdfs:label ?movie . FILTER (LANG(?movie) = "en")
}

p:P166 “won award” (awardee → statement node), ps:P166 “won award” (statement node → award), pq:P1686 “for work” (statement node → movie), wdt:P31 “instance of” (instance → class).

Sources#

Search

Type In
↑ ↓ move ↵ open ⇥ next section Ctrl↵ results page Prefix # to search text only