{"id":64,"date":"2018-02-21T01:41:06","date_gmt":"2018-02-21T01:41:06","guid":{"rendered":"http:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/?p=64"},"modified":"2018-02-21T14:12:59","modified_gmt":"2018-02-21T14:12:59","slug":"practical-personalising-a-sparql-query-and-mass-edits","status":"publish","type":"post","link":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/practical-personalising-a-sparql-query-and-mass-edits\/","title":{"rendered":"Practical &#8211; Personalising a SPARQL query and mass edits"},"content":{"rendered":"<p>We&#8217;ve created some SPARQL queries recently which demonstrate the information Wikidata possesses about alumni from the University of Edinburgh.<\/p>\n<p><a href=\"https:\/\/query.wikidata.org\/embed.html#PREFIX%20psv%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fstatement%2Fvalue%2F%3E%0APREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0A%0A%23defaultView%3AMap%0ASELECT%20%3Fperson%20%3FpersonLabel%20%3Fdob%20%3Fprecision%20%3Fcoords%20%3FGender%20%3FOccupation%20%3FPlace_of_Birth%20%3Fimage%20(COUNT(DISTINCT%20%3Farticle)%20AS%20%3Fcount)%20WHERE%20%7B%0A%20%20%3Fperson%20wdt%3AP69%20wd%3AQ160302.%0A%20%20%3Fperson%20wdt%3AP31%20wd%3AQ5.%0A%20%20%3Fperson%20wdt%3AP21%20%3Fgender.%0A%20%20%3Fperson%20(p%3AP569%2Fpsv%3AP569)%20%3FdobNode.%0A%20%20%3FdobNode%20wikibase%3AtimeValue%20%3Fdob.%0A%20%20%3FdobNode%20wikibase%3AtimePrecision%20%3Fprecision.%0A%20%20%3Fperson%20wdt%3AP19%20%3FbirthPlace.%0A%20%20%3FbirthPlace%20wdt%3AP625%20%3Fcoords.%0A%20%20OPTIONAL%20%7B%20%3Fperson%20wdt%3AP18%20%3Fimage.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Farticle%20schema%3Aabout%20%3Fperson.%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%0A%20%20%20%20%3Fperson%20rdfs%3Alabel%20%3FpersonLabel.%0A%20%20%20%20%3FbirthPlace%20rdfs%3Alabel%20%3FPlace_of_Birth.%0A%20%20%20%20%3Foccupation%20rdfs%3Alabel%20%3FOccupation.%0A%20%20%20%20%3Fgender%20rdfs%3Alabel%20%3FGender.%0A%20%20%7D%0A%7D%0AGROUP%20BY%20%3Fperson%20%3FpersonLabel%20%3Fdob%20%3Fprecision%20%3Fcoords%20%3FGender%20%3FOccupation%20%3FPlace_of_Birth%20%3Fimage%0AORDER%20BY%20DESC(%3Fcount)\">Map of University of Edinburgh alumni by place of birth.<\/a><\/p>\n<p><a href=\"http:\/\/histropedia.com\/showcase\/wikidata-viewer.html?q=%23Timeline%20of%20University%20of%20Edinburgh%20Alumni%20%0A%0ASELECT%20?Person%20?personLabel%20?dob%20?Gender%20?Country%20?article?precision%20?image%20?Occupation%20?rank%0AWHERE%20%7B%0A%0A%0A%20%20%20%20?person%20wdt:P31%20wd:Q5%20.%20%23%20human%0A%20%20%20%20?person%20wdt:P69%20wd:Q160302%20.%20%23PlaceOfEducation%0A%20%20%20%20?person%20wdt:P19%20?birthPlace%20.%0A%20%20%20%20OPTIONAL%20%7B%20?person%20wdt:P18%20?image%20.%7D%20%23image%0A%20%20%20%20OPTIONAL%20%7B%20?person%20wdt:P106%20?occupation%20.%7D%20%23occupation%0A%20%20%20%20OPTIONAL%20%7B%20?person%20wdt:P21%20?gender%20.%7D%20%23gender%0A%20%20%20%20OPTIONAL%20%7B%20?birthPlace%20wdt:P17%20?country%20%7D%20%23place%20of%20birth%0A%20%20%20%20?person%20p:P569\/psv:P569%20?dobNode%20.%20%23date%20of%20birth%0A%20%20%20%20?dobNode%20wikibase:timeValue%20?dob%20.%0A%20%20%20%20?dobNode%20wikibase:timePrecision%20?precision%20.%0A%20%20%20%20?article%20schema:about%20?person%20.%0A%20%20%20%20?article%20schema:isPartOf%20%3Chttps:\/\/en.wikipedia.org\/%3E.%0A%0A%20%20%20?person%20wikibase:sitelinks%20?rank%20.%0A%0A%20%20%20%20SERVICE%20wikibase:label%20%7B%0A%20%20%20%20%20%20%20bd:serviceParam%20wikibase:language%20%22en%22.%0A?gender%20rdfs:label%20?Gender%20.%0A?person%20rdfs:label%20?Person%20.%0A?country%20rdfs:label%20?Country%20.%0A?occupation%20rdfs:label%20?Occupation.%0A%20%20%20%20%7D%0A%7D%0A%0AORDER%20BY%20DESC%20(?rank)&amp;md=true&amp;g=article&amp;l=article&amp;t=Person&amp;s=dob&amp;sp=precision&amp;i=image&amp;c=Country,Occupation,%20Gender&amp;f=Country,Occupation,%20Gender&amp;v=t#\">Timeline of University of Edinburgh alumni by date of birth.<\/a><\/p>\n<p><a href=\"http:\/\/histropedia.com\/showcase\/wikidata-viewer.html?q=SELECT%20?book%20?label%20?date%20?precision%20?image%20?Genre%20?Author%20?Country%20?articleEn%20(COUNT%20(distinct%20?article)%20as%20?rank)%0AWHERE%20%7B%0A%0A%20%20%7B?book%20wdt:P31%20wd:Q571%20.%7D%0A%20%20UNION%0A%20%20%7B%20?book%20wdt:P31%20wd:Q7725634%20.%7D%0A%20%20UNION%0A%20%20%7B%20?book%20wdt:P31%20wd:Q49084%20.%7D%0A%20UNION%0A%20%7B%20?book%20wdt:P31%20wd:Q191067%20.%7D%0A%20%20UNION%0A%20%20%7B%20?book%20wdt:P31%20wd:Q20540385%20.%7D%0A%20%20UNION%0A%20%20%7B%20?book%20wdt:P31%20wd:Q3331189%20.%7D%0A%0A%20%20?book%20wdt:P50%20wd:Q1512%20.%0A%20%20?book%20p:P577\/psv:P577%20%5B%0A%20%20%20%20wikibase:timeValue%20?date%20;%0A%20%20%20%20wikibase:timePrecision%20?precision%20;%0A%20%20%5D%20.%0A%20%20%0A%20%20?book%20wdt:P136%20?genre%20.%0A%20%20?book%20wdt:P50%20?author%20.%0A%20%20OPTIONAL%20%7B?book%20wdt:P495%20?country%20%7D%0A%20%20OPTIONAL%20%7B?book%20wdt:P18%20?image%20.%7D%0A%20%20?article%20schema:about%20?book%20.%0A%20%20OPTIONAL%20%7B?articleEn%20schema:about%20?book%20.%20?articleEn%20schema:isPartOf%20%3Chttps:\/\/en.wikipedia.org\/%3E%20%7D%0A%20%20SERVICE%20wikibase:label%20%7B%20%0Abd:serviceParam%20wikibase:language%20%22en%22.%0A?genre%20rdfs:label%20?Genre%20.%0A?author%20rdfs:label%20?Author%20.%0A?country%20rdfs:label%20?Country%20.%0A?book%20rdfs:label%20?label.%0A%7D%0A%7D%20%0AGROUP%20BY%20?book%20?label%20?date%20?precision%20?image%20?Genre%20?Author%20?Country%20?articleEn%20%0AORDER%20BY%20DESC%20(?rank)&amp;md=true&amp;g=articleEn&amp;l=articleEn&amp;t=label&amp;s=date&amp;sp=precision&amp;i=image&amp;c=Genre,Country,Author,rank&amp;f=Genre,Country,Author&amp;v=t\">Timeline of works by Robert Louis Stevenson.<\/a><\/p>\n<p>It is very easy to amend these queries to display different results by virtue of changing one aspect; the institution.<\/p>\n<ol>\n<li>You will each be allocated a university from the list below. Look up the unique Q number for the institution you have been allocated on <a href=\"https:\/\/www.wikidata.org\/wiki\/Wikidata:Main_Page\">Wikidata<\/a>. Copy the Q number.<\/li>\n<li>Then click on the map link above to swap out the University of Edinburgh&#8217;s unique Q number (Q160302) with the new Q number. Hit run.<\/li>\n<li>Copy the link to export the result onto the<a href=\"https:\/\/etherpad.wikimedia.org\/p\/Wikidata_Hackathon_at_the_University_of_Edinburgh\"> Etherpad sheet<\/a>. Give it a name e.g <em>University of York &#8211; map of alumni<\/em>.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li>University of York (Q967165) \u2013 Petscan. <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301937\">https:\/\/petscan.wmflabs.org\/?psid=3301937<\/a><\/li>\n<li>University of Bristol \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301940\">https:\/\/petscan.wmflabs.org\/?psid=3301940<\/a><\/li>\n<li>University of Oxford \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301942\">https:\/\/petscan.wmflabs.org\/?psid=3301942<\/a><\/li>\n<li>University of Cambridge \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301946\">https:\/\/petscan.wmflabs.org\/?psid=3301946<\/a><\/li>\n<li>University of Glasgow \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301953\">https:\/\/petscan.wmflabs.org\/?psid=3301953<\/a><\/li>\n<li>University of St. Andrews \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301954\">https:\/\/petscan.wmflabs.org\/?psid=3301954<\/a><\/li>\n<li>University of Teesside \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301958\">https:\/\/petscan.wmflabs.org\/?psid=3301958<\/a><\/li>\n<li>University of Trinity College, Dublin \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301961\">https:\/\/petscan.wmflabs.org\/?psid=3301961<\/a><\/li>\n<li>University of Dundee \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301994\">https:\/\/petscan.wmflabs.org\/?psid=3301994<\/a><\/li>\n<li>University of Heriot-Watt \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301996\">https:\/\/petscan.wmflabs.org\/?psid=3301996<\/a><\/li>\n<li>University of Edinburgh Napier \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3301999\">https:\/\/petscan.wmflabs.org\/?psid=3301999<\/a><\/li>\n<li>Queen\u2019s University Belfast \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302001\">https:\/\/petscan.wmflabs.org\/?psid=3302001<\/a><\/li>\n<li>University of Strathclyde \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302003\">https:\/\/petscan.wmflabs.org\/?psid=3302003<\/a><\/li>\n<li>Glasgow Caledonian University \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302004\">https:\/\/petscan.wmflabs.org\/?psid=3302004<\/a><\/li>\n<li>University of Stirling \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302006\">https:\/\/petscan.wmflabs.org\/?psid=3302006<\/a><\/li>\n<li>University of Manchester \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302007\">https:\/\/petscan.wmflabs.org\/?psid=3302007<\/a><\/li>\n<li>University of Plymouth \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302008\">https:\/\/petscan.wmflabs.org\/?psid=3302008<\/a><\/li>\n<li>University of Northampton \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302009\">https:\/\/petscan.wmflabs.org\/?psid=3302009<\/a><\/li>\n<li>London Metropolitan University \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302010\">https:\/\/petscan.wmflabs.org\/?psid=3302010<\/a><\/li>\n<li>University of Liverpool \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302012\">https:\/\/petscan.wmflabs.org\/?psid=3302012<\/a><\/li>\n<li>University of Leeds \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302014\">https:\/\/petscan.wmflabs.org\/?psid=3302014<\/a><\/li>\n<li>University of East Anglia \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302017\">https:\/\/petscan.wmflabs.org\/?psid=3302017<\/a><\/li>\n<li>University of Exeter \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302018\">https:\/\/petscan.wmflabs.org\/?psid=3302018<\/a><\/li>\n<li>University of Sheffield \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302020\">https:\/\/petscan.wmflabs.org\/?psid=3302020<\/a><\/li>\n<li>Cardiff University \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302021\">https:\/\/petscan.wmflabs.org\/?psid=3302021<\/a><\/li>\n<li>Aberystwyth University \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302022\">https:\/\/petscan.wmflabs.org\/?psid=3302022<\/a><\/li>\n<li>Bath Spa University \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302024\">https:\/\/petscan.wmflabs.org\/?psid=3302024<\/a><\/li>\n<li>Swansea University \u2013 Petscan <a href=\"https:\/\/petscan.wmflabs.org\/?psid=3302040\">https:\/\/petscan.wmflabs.org\/?psid=3302040<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><strong>Mass editing Wikidata.<\/strong><\/p>\n<p>Petscan is a very useful tool. In the above links, I have asked Petscan to show me Wikipedia articles on that exist in a Wikipedia category of <strong>&#8216;Alumni of xxxxxxx&#8217;. <\/strong>I have then filtered the result to show me only those Wikipedia pages from that category where there is a Wikidata item for that person BUT no <strong>Place of Education (P69)<\/strong> statement.<\/p>\n<p>&nbsp;<\/p>\n<p>Using this information, I can copy the resulting information into a <a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1Z-sdg5HaDxPcoTGt3YOREns7SNqOoKYeMlwRTm_cDwM\/edit?usp=sharing\">Google spreadsheet<\/a> and arrange it in a format that Wikidata can import via the <a href=\"https:\/\/tools.wmflabs.org\/quickstatements\/\">QuickStatements<\/a> tool. So that&#8217;s exactly what we&#8217;re going to do.<\/p>\n<p><strong>It&#8217;s graduation day all over again for the alumni above!<\/strong><\/p>\n<p>(<a href=\"https:\/\/media.ed.ac.uk\/media\/1_whznh2og\">Video tutorial 1<\/a>) (<a href=\"https:\/\/media.ed.ac.uk\/media\/1_a26vivqq\">Video tutorial 2<\/a>). (<a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1myTqwthe2dPEopklERnA2Pc5JW3OYiLDnqXCBqUGyrg\/edit?usp=sharing\">Exemplar sheet<\/a>).<\/p>\n<p>The syntax you need is explained in <u><a href=\"http:\/\/tools.wmflabs.org\/wikidata-todo\/quick_statements.php\">QuickStatements <\/a><\/u><u><a href=\"http:\/\/tools.wmflabs.org\/wikidata-todo\/quick_statements.php\">v.1<\/a><\/u> and you can use the <u><a href=\"https:\/\/chrome.google.com\/webstore\/detail\/wikipedia-and-wikidata-to\/aiilcelhmpllcgkhhpifagfehbddkdfp?hl=en\">Wikidata plug-in<\/a><\/u> for Google Sheets to make wrangling the data in Google Sheets easier.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve created some SPARQL queries recently which demonstrate the information Wikidata possesses about alumni from the University of Edinburgh. Map of University of Edinburgh alumni by place of birth. Timeline of University of Edinburgh alumni by date of birth. Timeline of works by Robert Louis Stevenson. It is very easy to amend these queries to [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":65,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-64","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":3,"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/posts\/64\/revisions\/68"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/media\/65"}],"wp:attachment":[{"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thinking.is.ed.ac.uk\/wikidata-basics\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}