{"id":723,"date":"2020-01-23T15:24:16","date_gmt":"2020-01-23T15:24:16","guid":{"rendered":"http:\/\/wikidata.wwwnlsrc4.supercp.com\/?p=723"},"modified":"2020-12-07T11:46:58","modified_gmt":"2020-12-07T11:46:58","slug":"statements-with-qualifiers","status":"publish","type":"post","link":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/simple-queries\/qualifiers\/statements-with-qualifiers\/","title":{"rendered":"Statements with Qualifiers"},"content":{"rendered":"\n<h2>Query statements with Qualifiers<\/h2>\n\n\n\n<p>Many statements in Wikidata are not just simple triplets in the form of Item-Property-Value, but may also include a <strong>qualifier<\/strong>. Qualifiers allow statements to be expanded on, annotated, or contextualized beyond what can be expressed in just a simple property-value pair. Qualifiers are used in order to further describe or refine the value of a property given in a statement. Note that a statement should still provide useful data even without a qualifier; the qualifier is just there to provide additional information.<\/p>\n\n\n\n<p>Take for example the property \u201cpublication date\u201d (P577). The following query retrieves the publication date for each of the films in the Star Wars series:<\/p>\n\n\n\n<iframe class=\"\" src=\"https:\/\/query.wikidata.org\/#%23Star%20Wars%20films%0A%0ASELECT%20%3Fitem%20%20%3FitemLabel%20%3FdirectorLabel%20%3Fdate%0AWHERE%20%0A%7B%20%0A%20%20%3Fitem%20wdt%3AP179%20wd%3AQ22092344.%20%23%20item%20is%20part%20of%20the%20series%20Star%20Wars%20%28film%20series%29%0A%20%20%3Fitem%20wdt%3AP57%20%3Fdirector.%20%20%20%20%20%23%20item%E2%80%99s%20director%20property%E2%80%99s%20value%20is%20collected%20by%20the%20director%20variable%0A%20%20%3Fitem%20wdt%3AP577%20%3Fdate.%20%20%20%20%20%20%20%20%23%20item%27s%20publication%20date%20is%20collected%20by%20the%20date%20variable%0ASERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%20%7D%0A%7D%0A\" style=\"width:100%;max-width:100%;height:450px\" frameborder=\"0\"><\/iframe>\n\n\n\n<p>Although there are 9 films in the series, we get 32 results. Why?<br><br>As we have seen <a href=\"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/simple-queries\/adding-variables\/multiple-values\/\">before<\/a>, a property can have multiple values. In this case, there are several values for \u201cpublication date\u201d per film. Why? Because there are different release dates for different countries. For each value there is a qualifier indicating the property \u201cplace of publication\u201c (P291) and its value. For example, for the item Star Wars Episode IV: A New Hope (Q17738):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" width=\"923\" height=\"420\" src=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/01\/release-date.png\" alt=\"\" class=\"wp-image-730\" srcset=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/01\/release-date.png 923w, https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/01\/release-date-300x137.png 300w, https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/01\/release-date-768x349.png 768w\" sizes=\"(max-width: 923px) 100vw, 923px\" \/><figcaption>Publication date (P577) has the property place of publication (P291) as qualifier  <\/figcaption><\/figure><\/div>\n\n\n\n<p>How can our query retrieve only the publication date in the USA?<\/p>\n\n\n\n<p>To do this we need to understand how this data is represented.<\/p>\n\n\n\n<h2>Qualifiers explained<\/h2>\n\n\n\n<p>Until now we had statements such as:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"582\" height=\"64\" src=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/direct-property.png\" alt=\"\" class=\"wp-image-2018\" srcset=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/direct-property.png 582w, https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/direct-property-300x33.png 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/figure>\n\n\n\n<p>This link between the item and its value is a \u201cdirect property\u201d. In our queries we referred to it with the prefix <strong>wdt<\/strong>.<\/p>\n\n\n\n<p>In the Wikidata data model, for every direct property linking an item and a value, there is also a simple property (p) that connects the item to a statement node. That statement node is then linked to the value of the direct property by a property statement (ps), as shown in this graphic view:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"666\" height=\"317\" src=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/qualifer-1.png\" alt=\"\" class=\"wp-image-2025\" srcset=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/qualifer-1.png 666w, https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/qualifer-1-300x143.png 300w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/figure>\n\n\n\n<p>Another way of describing this data is through statements:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Item<\/strong><\/td><td><strong>Property<\/strong><\/td><td><strong>Value<\/strong><\/td><\/tr><tr><td>Q17738<\/td><td>wdt:P577<\/td><td>1977-05-25<\/td><\/tr><tr><td>Q17738<\/td><td>p:P577<\/td><td>Q17738-statement node<\/td><\/tr><tr><td>Q17738-statement node<\/td><td>ps:P577<\/td><td>1977-05-25<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>In the last row, the statement node serves as the \u201cItem\u201d in an Item-Property-Value statement.<\/p>\n\n\n\n<p>Statements that have a qualifier have an additional link from the statement node&nbsp; \u2013 a property qualifier (pq) \u2013 as shown in the following diagram:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"892\" height=\"317\" src=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/qualiferpq.png\" alt=\"\" class=\"wp-image-2014\" srcset=\"https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/qualiferpq.png 892w, https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/qualiferpq-300x107.png 300w, https:\/\/wdqs-tutorial.toolforge.org\/wp-content\/uploads\/2020\/12\/qualiferpq-768x273.png 768w\" sizes=\"(max-width: 892px) 100vw, 892px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>We can now formulate a query to get the publication date (P577) of the films in the Star Wars series if the place of publication (P291) is the USA:<\/p>\n\n\n\n<iframe class=\"\" src=\"https:\/\/query.wikidata.org\/#%23Star%20Wars%20films%0A%0ASELECT%20%3Fitem%20%20%3FitemLabel%20%3FdirectorLabel%20%3Fdate%20%0AWHERE%20%0A%7B%20%0A%20%20%3Fitem%20wdt%3AP179%20wd%3AQ22092344.%20%23%20item%20is%20part%20of%20the%20series%20Star%20Wars%20%28film%20series%29%0A%20%20%3Fitem%20wdt%3AP57%20%3Fdirector.%20%20%20%20%20%23%20item%E2%80%99s%20director%20property%E2%80%99s%20value%20is%20collected%20by%20the%20director%20variable%0A%20%20%3Fitem%20p%3AP577%20%3Fstatement.%20%20%20%20%20%23%20item%20has%20a%20property%20P577%20%28publication%20date%29%20linking%20a%20statement%20node%20which%20we%20collect%20with%20the%20%3Fstatement%20variable%0A%20%20%3Fstatement%20ps%3AP577%20%3Fdate.%20%20%20%20%23%20the%20value%20of%20the%20statement%20node%27s%20property%20statement%20%28ps%29%20is%20collected%20by%20variable%20date%0A%20%20%3Fstatement%20pq%3AP291%20wd%3AQ30%20.%20%20%23%20the%20statement%20node%20has%20a%20qualifier%20with%20a%20P291%20property%20%28pq%29%20that%20has%20a%20value%20Q30%20%28USA%29%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%22.%20%7D%0A%7D%0A\" style=\"width:100%;max-width:100%;height:450px\" frameborder=\"0\"><\/iframe>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Query statements with Qualifiers Many statements in Wikidata are not just simple triplets in the form of Item-Property-Value, but may also include a qualifier. Qualifiers allow statements to be expanded on, annotated, or contextualized beyond what can be expressed in just a simple property-value pair. Qualifiers are used in order to further describe or refine [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":""},"categories":[15],"tags":[],"_links":{"self":[{"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/posts\/723"}],"collection":[{"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/comments?post=723"}],"version-history":[{"count":41,"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/posts\/723\/revisions"}],"predecessor-version":[{"id":2027,"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/posts\/723\/revisions\/2027"}],"wp:attachment":[{"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/media?parent=723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/categories?post=723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wdqs-tutorial.toolforge.org\/index.php\/wp-json\/wp\/v2\/tags?post=723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}