Advertisement
Tooster

Untitled

Feb 28th, 2018
2,960
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SPARQL 1.93 KB | None | 0 0
  1. 1. List motto texts (wdt:P1451) of ALL states of the United States.
  2.  
  3. SELECT ?state ?stateLabel ?motto WHERE {
  4.   ?state wdt:P31 wd:Q35657;
  5.          wdt:P1451 ?motto.
  6.   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  7. }
  8.  
  9.  
  10.  
  11. 2. List Q-numbers and (english) names of ALL Noble Prize winners that were born IN Wrocław.
  12.  
  13. SELECT ?winner ?winnerLabel WHERE {
  14.   ?winner wdt:P19 wd:Q1799;
  15.           wdt:P166 [wdt:P31 wd:Q7191].
  16.   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  17. }
  18.  
  19.  
  20.  
  21. 3. List ALL persons that were born IN Poland and died at a place at the elevation above 8000 metres above sea level (be careful WITH units!).
  22.  
  23. SELECT ?ppl ?pplLabel ?hM
  24. WHERE
  25. {
  26.   ?ppl wdt:P19 [wdt:P17 wd:Q36].
  27.   ?ppl wdt:P20 ?place.
  28.  
  29.   ?place         p:P2044                     ?stmnode.    # height above sea lvl
  30.   ?stmnode       psv:P2044                   ?valuenode.
  31.   ?valuenode     wikibase:quantityAmount     ?height.
  32.   ?valuenode     wikibase:quantityUnit       ?unit.
  33.  
  34.   # conversion to SI unit
  35.   ?unit          p:P2370                 ?unitstmnode.   # conversion to SI unit
  36.   ?unitstmnode   psv:P2370               ?unitvaluenode.
  37.   ?unitvaluenode wikibase:quantityAmount ?conversion.
  38.   ?unitvaluenode wikibase:quantityUnit   wd:Q11573.      # meter
  39.   BIND(?height * ?conversion AS ?hM).
  40.   FILTER(?hM>8000)
  41.  
  42.  
  43.   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  44. }
  45. LIMIT 10
  46.  
  47.  
  48.  
  49. 4. List 10 polish cities WITH the biggest number of scientists (according TO their place of birth). Show the names of the cities and the number of scientists. Sort the cities IN descending ORDER.
  50.  
  51. SELECT ?city ?cityLabel (COUNT(DISTINCT ?person) AS ?COUNT)
  52. WHERE {
  53.   ?person wdt:P19 ?city.
  54.   ?city wdt:P31 wd:Q515; wdt:P17 wd:Q36.
  55.   ?person wdt:P106 [wdt:P279 wd:Q901].
  56.   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  57. }
  58. GROUP BY ?city ?cityLabel
  59. ORDER BY DESC(?COUNT)
  60. LIMIT 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement