User:Philbarker

From Wikidata
Jump to navigation Jump to search

Phil Barker

wikipedia user Philbarker

wikisource user Philbarker

Interesting(?) queries[edit]

Hillforts in order of distance from where I live[edit]

Inspired by Martin Poulter and the Atlas of Hillforts

SELECT ?hillfort ?hillfortLabel ?hillfortLoc (?distance AS ?kilometers)
WHERE {
  ?hillfort wdt:P31 [ wdt:P279* wd:Q744099 ] ; # is an instance of (a subclass) of hillfort 
            wdt:P17 wd:Q145 ;                  # is in UK
            wdt:P625 ?hillfortLoc .
  wd:Q17811764 wdt:P625 ?homeLoc .             # Location of Morningside Library
  BIND(geof:distance(?hillfortLoc, ?homeLoc) AS ?distance) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDERBY ( ?distance )
LIMIT 100

run it

Female UK MPs (past & present) whose ancestors were MPs[edit]

(with help from @generalising to include 'members of the Xth parliament')

# Female UK MPs (past & present) whose ancestors were MPs 
SELECT distinct ?mp ?mpLabel ?ancestor ?ancestorLabel
WHERE {
  ?mp wdt:P39 [ wdt:P279* wd:Q16707842 ] ;         #subject is/was a UK MP
                                                   #this approach includes the "members of Xth Parliament" form
      wdt:P21 wd:Q6581072 ;                        #subject is female
      (wdt:P25|wdt:P22)+ ?ancestor .               #find subject's ancestors
 { ?ancestor wdt:P39 [ wdt:P279* wd:Q16707842 ]  } 
 UNION { ?ancestor wdt:P39 [ wdt:P279* wd:Q18015642 ]  } 
 UNION { ?ancestor wdt:P39 [ wdt:P279* wd:Q18018860 ] }
  # ancestor was a UK MP (1801 onwards); or a British MP (1707-1801); or an English MP (to 1707)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}


Maternal ancestors of Queen Victoria[edit]

SELECT distinct ?ancestor ?ancestorLabel ?dob ?dod ?pob ?pod ?image
WHERE {
  wd:Q9439 wdt:P25+ ?ancestor .         # maternal line of Queen Victoria
                                        # change Q9439 to chenge person
WHERE {
  wd:Q9439 wdt:P25+ ?ancestor .         # maternal line of Queen Victoria
                                      # change Q9439 to chenge person
  OPTIONAL {
    ?ancestor wdt:P569 ?dob .
  }
  OPTIONAL {
    ?ancestor wdt:P570 ?dod .
  }
  OPTIONAL {
    ?ancestor wdt:P19 ?pob .
  }
  OPTIONAL {
    ?ancestor wdt:P20 ?pod .
  }
  OPTIONAL {
    ?ancestor wdt:P18 ?image .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY desc(?dob)