Wikidata:London workshop February 2018

From Wikidata
Jump to navigation Jump to search

This is a chance to share anything you've learned or made during the Wikidata training workshop at Newspeak House, London.

Add your queries or links here by clicking "Edit" at the top. Enclose your query in {{SPARQL|query= }}.

Short URL for this page: tinyurl.com/newspeakwd

Presentation materials

[edit]

Queries

[edit]

See Wikidata:SPARQL_query_service/queries/examples for the showcase queries, User:MartinPoulter/queries for some of Martin's queries. You can use your user space here on Wikidata to share and version your queries.

Actors who have played a given character

[edit]
SELECT ?actor ?actorLabel ?filmLabel
WHERE {
      ?film p:P161 [
        ps:P161 ?actor;
        pq:P453 wd:Q2009573 # <- substitute the Q number of the character you are interested in
      ].
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Try it!

Birthplace of all the descendants of Queen Victoria

[edit]
#defaultView:Map
select ?childLabel ?dobLabel ?cord ?pobLabel
where{
  
  wd:Q9439 wdt:P40* ?child .
  ?child wdt:P569 ?dobLabel.
  ?child wdt:P19 ?pob.
  ?pob wdt:P625 ?cord.
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }
Try it!

100 Most Populated Cities

[edit]
#defaultView:Map
select ?itemLabel ?popLabel ?cord

where{
  ?item wdt:P31 wd:Q1637706.
  ?item wdt:P1082 ?pop.
  ?item wdt:P625 ?cord
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
        
  }
Order by DESC (?pop)

limit 100
Try it!

Population of London from 1801

[edit]
#defaultView:LineChart
SELECT  ?populationLabel ?yearLabel
WHERE
{
     wd:Q84 p:P1082 ?stmt.
     ?stmt ps:P1082 ?population.
     ?stmt pq:P585 ?year.

     SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Try it!
[edit]

Histropedia timeline of works by Margaret Atwood (links to Wikipedia articles).

Artworks tagged 'public art' after 1970:

[edit]
SELECT ?item ?itemLabel ?image ?date ?genreLabel WHERE {
  ?item wdt:P31 wd:Q838948 .
  ?item wdt:P571 ?date .
  OPTIONAL{ ?item wdt:P18 ?image} .
  ?item wdt:P136 ?genre .
  ?item wdt:P136 wd:Q557141 .
  FILTER (year(?date) > 1970)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

ORDER BY year(?date)
Try it!

.

Number of awards received by movies made in USA

[edit]
SELECT ?film ?filmLabel
(COUNT(?award) AS ?awardsWon) 

WHERE {
  #country of origin
  ?film wdt:P495 wd:Q30.
  #instanceof film
  ?film wdt:P31 wd:Q11424.
  #award recieved
  ?film wdt:P166 ?award.
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?film ?filmLabel ?date
ORDER BY DESC(?awardsWon)
Try it!

Organised list of paintings with the most images on Wikidata

[edit]
SELECT ?paintingLabel ?painting (COUNT(?image) as ?imageCount)
                  WHERE {
  
                    ?painting wdt:P31 wd:Q3305213.
                    ?painting wdt:P18 ?image.
  
                    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
                  }

                  GROUP BY ?painting ?paintingLabel 
                  ORDER BY DESC(?imageCount)
                  LIMIT 100
Try it!

Add your query here

[edit]