User:AllyD/sandbox
Food and drink[edit]
Scottish food query[edit]
The following query uses these:
- Items: food (Q2095) , drink brand (Q114392939) , dessert (Q182940) , soup (Q41415) , smoked haddock (Q3125526) , potato dish (Q10514020) , confection (Q5159627) , sausage (Q131419) , Scotland (Q22)
- Properties: instance of (P31) , subclass of (P279) , country of origin (P495) , product certification (P1389) , image (P18)
Features: Graph (Q24515287)
#defaultView:Graph
SELECT DISTINCT ?food ?foodLabel ?foodgenreLabel ?foodURI ?protfoodLabel WHERE { {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?foodTypes {
wd:Q2095
wd:Q114392939
wd:Q182940
wd:Q41415
wd:Q3125526
wd:Q10514020
wd:Q5159627
wd:Q131419
}
{{?food wdt:P31 ?foodTypes.} UNION {?food wdt:P279 ?foodTypes.}.
?food wdt:P495 wd:Q22.}.
OPTIONAL {?food wdt:P279 ?foodgenre.}
OPTIONAL {?food wdt:P1389 ?protfood.}
optional { ?food wdt:P18 ?foodURI } .
}}
Also stored.
Tried building drink conditions but results are not very interesting - some brands but other articles are distillery-based:
VALUES ?foodTypes { wd:Q6744642 wd:Q1479546 wd:Q40050 wd:Q15075508 wd:Q114392939 }.
Shanxi food query[edit]
The following query uses these:
- Items: food (Q2095) , dessert (Q182940) , soup (Q41415) , smoked haddock (Q3125526) , potato dish (Q10514020) , confection (Q5159627) , sausage (Q131419) , noodle dish (Q98826752) , dish (Q746549) , China (Q29520) , People's Republic of China (Q148) , Taiwan (Q865) , Shanxi cuisine (Q7489130)
- Properties: instance of (P31) , subclass of (P279) , part of (P361) , country of origin (P495) , native label (P1705) , product certification (P1389) , image (P18)
Features: Graph (Q24515287)
#defaultView:Graph
SELECT DISTINCT ?food ?foodLabel ?ownName ?foodgenreLabel ?foodareaLabel ?foodURI ?protfoodLabel WHERE { {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?foodTypes {
wd:Q2095
wd:Q182940
wd:Q41415
wd:Q3125526
wd:Q10514020
wd:Q5159627
wd:Q131419
wd:Q98826752
wd:Q746549
}
VALUES ?ZhPlaces {
wd:Q29520
wd:Q148
wd:Q865
}
{{?food wdt:P31 ?foodTypes.} UNION {?food wdt:P279 ?foodTypes.}.
?food wdt:P361 wd:Q7489130.}. #?food wdt:P495 ?ZhPlaces.} is too crowded
OPTIONAL {?food wdt:P1705 ?ownName.}
OPTIONAL {?food wdt:P279 ?foodgenre.}
OPTIONAL {?food wdt:P361 ?foodarea.}
OPTIONAL {?food wdt:P1389 ?protfood.}
optional { ?food wdt:P18 ?foodURI }
}}
Expandable to broader Chinese cuisines but diagram too crowded.
Lakes in Wales[edit]
The following query uses these:
- Items: Wales (Q25) , lake (Q23397) , reservoir (Q131681)
- Properties: located in the administrative territorial entity (P131) , instance of (P31) , coordinate location (P625) , image (P18)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT ?place (?waterLabel as ?layer) ?placeURI ?loc WHERE { { ?cooncil wdt:P131 wd:Q25} ?cooncil rdfs:label ?cooncilName. FILTER(LANG(?cooncilName) = "en").
{{?place wdt:P31 wd:Q23397 } UNION {?place wdt:P31 wd:Q131681 }}
?place wdt:P31 ?watertype.
?place wdt:P131 ?cooncil .
?place wdt:P625 ?loc .
?place wdt:P31 ?placeDescQ. ?placeDescQ rdfs:label ?placeDesc. FILTER(LANG(?placeDesc) = "en").
?place rdfs:label ?placeLabel. FILTER(LANG(?placeLabel) = "en").
?watertype rdfs:label ?waterLabel. FILTER(LANG(?waterLabel) = "en").
optional { ?place wdt:P18 ?placeURI } .
}
Also stored.
Small settlements in Scotland[edit]
The following query uses these:
- Items: town (Q3957) , city (Q515) , village (Q532) , small burgh (Q7543008) , Scottish civil parish (Q5124673) , United Kingdom (Q145) , Scottish council area (Q15060255)
- Properties: instance of (P31) , subclass of (P279) , country (P17) , located in the administrative territorial entity (P131) , population (P1082) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT ?loc ?city ?cityLabel ?cityauthLabel ?population WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?typesOfPlaces {
wd:Q3957
wd:Q515
wd:Q532
wd:Q7543008
wd:Q5124673
}
?city (wdt:P31/(wdt:P279*)) ?typesOfPlaces;
wdt:P17 wd:Q145. #Q22
?city wdt:P131 ?cityauth. ?cityauth wdt:P31 wd:Q15060255.
OPTIONAL { ?city wdt:P1082 ?population. }
FILTER (?population > 100). FILTER (?population < 1500).
OPTIONAL { ?city wdt:P625 ?loc .}
}
ORDER BY ?cityauthLabel ?population
Football leagues in Scotland[edit]
Working on basic view of history, but lacks many of the team links which would allow geographical and timelayer mapping
The following query uses these:
- Properties: instance of (P31) , inception (P571) , dissolved, abolished or demolished date (P576) , operating area (P2541) , coordinate location (P625) , league (P118) , home venue (P115) , start time (P580) , end time (P582)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?compyrLabel AS ?layer) ?teamLabel ?teamplace ?tgrstart ?tgrend ?tcompstart ?tcompout ?clow ?ctop ?team WHERE {
?team wdt:P31 wd:Q476028.
optional { ?team wdt:P571 ?tbegan. }
optional { ?team wdt:P576 ?tdisband. } BIND(COALESCE(?tdisband, now()) AS ?tgrend).
?team p:P118 ?tcomp.
?tcomp ps:P118 ?wcomp.
optional {?tcomp pq:P580 ?tcompstart.} optional {?tcomp pq:P582 ?tcompout.}
?wcomp wdt:P2541 wd:Q22.
optional { ?wcomp rdfs:label ?compLabel. FILTER(LANG(?compLabel) = "en").}
optional { ?wcomp wdt:P571 ?compbegan. }
BIND (COALESCE(?tcompstart, ?compbegan) AS ?tcompstart).
BIND(year(?tcompstart) AS ?joinedcompyr).
optional { ?team wdt:P625 ?teamloc. }
?team rdfs:label ?teamLabel. FILTER(LANG(?teamLabel) = "en").
?team p:P115 ?tpark.
?tpark ps:P115 ?teampark.
optional {?teampark wdt:P625 ?teamparkloc.}.
optional {?tpark pq:P580 ?tgrst1. ?tpark pq:P582 ?tgrend1. FILTER (?tgrend1 > ?tcompstart && ?tgrst1 < ?tcompout ).} .
BIND(COALESCE(?tgrst1,?tbegan) AS ?tgrst1). BIND(COALESCE(?tgrend,?tdisband) AS ?tgrend).
BIND(COALESCE(?teamparkloc,?teamloc) AS ?teamplace).
FILTER (?joinedcompyr < 1950 )
BIND ( IF (?wcomp = wd:Q2261276,
IF(?joinedcompyr>1922,"1923",
IF(?joinedcompyr>1892,"1893","1890")),
STR(year(?compbegan))) AS ?compband).
BIND(IF(BOUND(?compband),(CONCAT (?compLabel, " from ", ?compband) ), ?compLabel ) AS ?compyrLabel).
}
ORDER BY ?teamLabel ?compyrLabel ?tcompstart ?layeryr
Retrieve article titled in the former league category:
The following query uses these:
- Properties: instance of (P31)
#defaultView:Table SELECT ?item ?itemLabel ?itype ?articleEN WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "en.wikipedia.org"; wikibase:api "Generator"; mwapi:generator "categorymembers"; mwapi:gcmtitle "Category:Defunct football leagues in Scotland";. ?item wikibase:apiOutputItem mwapi:item. } FILTER BOUND (?item) ?item wdt:P31 ?itype. ?articleEN schema:about ?item . ?articleEN schema:isPartOf <https://en.wikipedia.org/> . }
Original railways in Scotland[edit]
Working on basic view of history, but lacks many of the company-station links which would allow geographical and timelayer mapping
The following query uses these:
- Properties: instance of (P31) , subclass of (P279) , located in the administrative territorial entity (P131) , operating area (P2541) , date of official opening (P1619) , date of official closure (P3999) , operator (P137) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?railcoyLabel AS ?layer) ?railcoy ?railstatLabel ?statloc ?railstat WHERE {
{{?railcoy wdt:P31/wdt:P279* wd:Q249556.} UNION {?railcoy wdt:P31/wdt:P279* wd:Q728937.}}. #Q22667 for underdefined
{{?railcoy wdt:P131 wd:Q22.} UNION {?railcoy wdt:P2541 wd:Q22.}}.
OPTIONAL {?railcoy wdt:P1619 ?rcoystart.}
OPTIONAL {?railcoy wdt:P3999 ?rcoyfinish.}
?railstat wdt:P137 ?railcoy.
?railstat wdt:P625 ?statloc.
optional { ?railcoy rdfs:label ?railcoyLabel. FILTER(LANG(?railcoyLabel) = "en").}
optional { ?railstat rdfs:label ?railstatLabel. FILTER(LANG(?railstatLabel) = "en").}
#SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?railcoyLabel
Current network for comparison:
The following query uses these:
- Properties: instance of (P31) , date of official opening (P1619) , date of official closure (P3999) , operator (P137) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?railcoyLabel AS ?layer) ?railcoy ?railstatLabel ?statloc ?railstat WHERE {
{?railcoy wdt:P31 wd:Q17102188.}.
FILTER (?railcoy = wd:Q18208626).
OPTIONAL {?railcoy wdt:P1619 ?rcoystart.}
OPTIONAL {?railcoy wdt:P3999 ?rcoyfinish.}
?railstat wdt:P137 ?railcoy.
?railstat wdt:P625 ?statloc.
optional { ?railcoy rdfs:label ?railcoyLabel. FILTER(LANG(?railcoyLabel) = "en").}
optional { ?railstat rdfs:label ?railstatLabel. FILTER(LANG(?railstatLabel) = "en").}
#SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?railcoyLabel
Nearest current station to a previous one:
The following query uses these:
- Items: Mid Clyth railway station (Q6840942) , railway station (Q55488) , ScotRail Trains (Q107980329) , Abellio ScotRail (Q18208626)
- Properties: coordinate location (P625) , instance of (P31) , operator (P137)
#defaultView:Table SELECT DISTINCT ?place ?placeLabel ?location ?dist WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } wd:Q6840942 wdt:P625 ?loc . SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center ?loc . bd:serviceParam wikibase:radius "20" . } ?place wdt:P31 wd:Q55488. {?place wdt:P137 wd:Q107980329.} UNION {?place wdt:P137 wd:Q18208626.}. BIND(geof:distance(?loc, ?location) as ?dist) } ORDER BY ?dist LIMIT 1
Rail accidents:
{{SPARQL2|query=
- defaultView:BarChart
SELECT DISTINCT ?label ?loc ?subj ?deaths ?injured ?when
WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?subj wdt:P31/wdt:P279* wd:Q1078765 ; wdt:P625 ?loc ; p:P625/psv:P625 ?coord; rdfs:label ?label filter (lang(?label) = "en"). OPTIONAL {?subj wdt:P1120 ?deaths } OPTIONAL {?subj wdt:P1339 ?injured } OPTIONAL {?subj wdt:P585 ?when } OPTIONAL {?subj wdt:P131 ?area } VALUES ?scotmarks { wd:Q22 wd:Q15060255 } {?subj wdt:P131 ?scotmarks.} UNION {?subj wdt:P131 ?orgloc1. ?orgloc1 wdt:P31/wdt:P131 ?scotmarks.} UNION {?subj wdt:P159 ?orgpl. {{?orgpl wdt:P31/wdt:P131 ?scotmarks.} .} UNION {?orgpl wdt:P131 ?orgl2. {{?orgl2 wdt:P31/wdt:P131 ?scotmarks} }}}. FILTER (?deaths >0) }
}}
Persecuted witches in Scotland[edit]
Currently based on using the Survey of Scottish Witchcraft ID
The following query uses these:
- Properties: Survey of Scottish Witchcraft - Accused witch ID (P4478) , cause of death (P509) , date of death (P570) , place of death (P20) , residence (P551) , coordinate location (P625) , country (P17) , significant event (P793) , head of state (P35) , point in time (P585) , start time (P580) , end time (P582)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (CONCAT(STR(YEAR(?rulest))," ", ?deadBandLab) AS ?layer) ?loc ?accper ?accperLabel ?dateDied ?placeDied ?causeDied ?locatorLabel ?accusedURI WHERE {
## Inner query for basic case/person data
{
SELECT DISTINCT ?accper ?accperLabel ?accused ?dateDied ?loc ?locator ?locatorLabel ?deadBand ?deadBandLab ?rulest ?rgb ?accusedURI WHERE
{
{ ?accper wdt:P4478 ?accused.}
?accper rdfs:label ?accperLabel. FILTER((LANG(?accperLabel)) = "en").
BIND(URI (CONCAT ("https://witches.shca.ed.ac.uk/index.cfm?fuseaction=home.accusedrecord&accusedref=", ?accused, "&search_string=lastname") ) AS ?accusedURI).
##temp filter down to only Youngs
## FILTER (CONTAINS(?accperLabel, "Young")).
##
#OPTIONAL { ?accper wdt:P509 ?causeDiedQ. ?causeDiedQ rdfs:label ?causeDied. FILTER((LANG(?causeDied)) = "en"). }
### Date ###
OPTIONAL {?accper wdt:P570 ?dateDied }.
OPTIONAL {?accper p:P793 / pq:P585 ?accdate. BIND (?accdate AS ?dateDied).}.
OPTIONAL {?accper p:P793 / pq:P580 ?accdate2. BIND (?accdate2 AS ?dateDied).}.
#FILTER (BOUND(?dateDied1)). ##Optional filter for known death (though some died during so process never concluded)
### Location ###
OPTIONAL {?accper wdt:P20 ?placeDiedQ. }
OPTIONAL {?accper wdt:P551 ?res}.
BIND(COALESCE(?res, ?placeDiedQ, wd:Q22) AS ?locator).
OPTIONAL {?locator wdt:P625 ?loc. ?locator rdfs:label ?locatorLabel. FILTER((LANG(?locatorLabel)) = "en").}
##Time period
?ruler wdt:P17 wd:Q230791.
?ruler p:P35 ?ruleper. ?ruleper ps:P35 ?deadBand. ?ruleper pq:P580 ?rulest. ?ruleper pq:P582 ?rulestop. FILTER (?dateDied > ?rulest && ?dateDied < ?rulestop ).
?deadBand rdfs:label ?deadBandLab. FILTER((LANG(?deadBandLab)) = "en").
## Add colour when generating Graph only
## BIND("3CB0FD" AS ?rgb).
} LIMIT 6000
}
}
Period scatter chart by monarch - also gives useful graph:
The following query uses these:
- Properties: Survey of Scottish Witchcraft - Accused witch ID (P4478) , cause of death (P509) , date of death (P570) , place of death (P20) , residence (P551) , historic county (P7959) , coordinate location (P625) , country (P17) , significant event (P793) , head of state (P35) , point in time (P585) , start time (P580) , end time (P582)
#defaultView:ScatterChart SELECT DISTINCT ?locCounty ?locCountyLabel ?rgb ?deadBand (CONCAT(STR(YEAR(?rulest))," ", ?deadBandLab) AS ?deadBandLabel) (COUNT(?accperLabel) AS ?count) WHERE { ## Inner query for basic case/person data { SELECT DISTINCT ?accper ?accperLabel ?accused ?causeDied ?accwhen ?accstart ?dateDied ?placeDiedQ ?res ?locator ?locCounty ?locCountyLabel ?deadBand ?deadBandLab ?rulest ?rgb WHERE { { ?accper wdt:P4478 ?accused.} ?accper rdfs:label ?accperLabel. FILTER((LANG(?accperLabel)) = "en"). ##temp filter down to only Youngs ## FILTER (CONTAINS(?accperLabel, "Young")). ## #OPTIONAL { ?accper wdt:P509 ?causeDiedQ. ?causeDiedQ rdfs:label ?causeDied. FILTER((LANG(?causeDied)) = "en"). } ### Date ### OPTIONAL {?accper wdt:P570 ?dateDied }. OPTIONAL {?accper p:P793 / pq:P585 ?accdate. BIND (?accdate AS ?dateDied).}. OPTIONAL {?accper p:P793 / pq:P580 ?accdate2. BIND (?accdate2 AS ?dateDied).}. #FILTER (BOUND(?dateDied1)). ##Optional filter for known death (though some died during so process never concluded) ### Location ### OPTIONAL {?accper wdt:P20 ?placeDiedQ. } OPTIONAL {?accper wdt:P551 ?res}. BIND(COALESCE(?res, ?placeDiedQ, wd:Q22) AS ?locator). OPTIONAL {?locator wdt:P7959 ?locCounty. ?locCounty wdt:P625 ?loc. ?locCounty rdfs:label ?locCountyLabel. FILTER((LANG(?locCountyLabel)) = "en").} ##Time period ?ruler wdt:P17 wd:Q230791. ?ruler p:P35 ?ruleper. ?ruleper ps:P35 ?deadBand. ?ruleper pq:P580 ?rulest. ?ruleper pq:P582 ?rulestop. FILTER (?dateDied > ?rulest && ?dateDied < ?rulestop ). ?deadBand rdfs:label ?deadBandLab. FILTER((LANG(?deadBandLab)) = "en"). ## Add colour when generating Graph only ## BIND("3CB0FD" AS ?rgb). } LIMIT 6000 } } GROUP BY ?locCounty ?locCountyLabel ?rgb ?deadBand ?rulest ?deadBandLab ?accperLabel
A useful way to roll dates up, in lieu of a DECADE command:
- BIND( CONCAT(str(FLOOR(YEAR(?dateDied)/10)*10),"s") as ?dateDiedYr).
FV map by settlement (secondary query to avoid timeout):
The following query uses these:
- Items: North Queensferry (Q1009725) , Milnathort (Q1009891) , Clackmannan (Q1010098) , Kinghorn (Q1010266) , Inverkeithing (Q1010422) , Kincardine (Q1011221) , Burntisland (Q1011521) , Falkland (Q1012069) , Dunning (Q1012257) , Airth (Q1012333) , Linlithgow (Q1016911) , Leith (Q1018540) , Dollar (Q1235672) , Cramond (Q1249896) , Holyrood (Q1625364) , Dalgety Bay (Q1984807) , Fife (Q201149) , Aberdour (Q2014221) , Dunfermline (Q211950) , Abercorn (Q2188248) , Kirkliston (Q239193) , Culross (Q2424554) , Heriot (Q3304653) , Crook of Devon (Q3307907) , Blackhall (Q3640797) , Cowgate (Q3752621) , Hillend (Q3785636) , Torryburn (Q3995788) , West Port (Q4019090) , The Canongate (Q4251125) , Corstorphine (Q5173194) , Dalmeny (Q5211552) , Balwearie (Q59244052) , Bonhard (Q64735066) , Chapelbarn (Q64828012) , Brinstoun (Q64934564) , Canongate (Q64947484) , Niddry (Q64947494) , Grangepans (Q64947496) , North Leith (Q64947498) , Upper Kinneil (Q64947526) , Glendevon (Q64947529) , Potterrow (Q64947545) , Carriden (Q64947575) , Pothill (Q64947581) , Masterton (Q64947596) , Newhalls (Q65515723) , Finnock Bog (Q65561359) , Kirkcaldy (Q691685) , Auchterarder (Q758623) , Auchtermuchty (Q758624) , Kinross (Q781885) , Bo'ness (Q896424) , Edinburgh (Q23436) , Scotland (Q22)
- Properties: Survey of Scottish Witchcraft - Accused witch ID (P4478) , residence (P551) , place of death (P20) , date of death (P570) , coordinate location (P625) , significant event (P793) , point in time (P585) , start time (P580)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?lBand AS ?layer) ?loc ?accper ?accperLabel ?dateDied ?placeDied ?causeDied ?locatorLabel ?accusedURI WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
{
SELECT DISTINCT ?accper ?accused ?loc ?dateDied ?locator ?locatorLabel ?coord ?dYr WHERE
{
VALUES ?place {wd:Q1009725 wd:Q1009891 wd:Q1010098 wd:Q1010266 wd:Q1010422 wd:Q1011221 wd:Q1011521 wd:Q1012069 wd:Q1012257 wd:Q1012333 wd:Q1016911 wd:Q1018540 wd:Q1235672 wd:Q1249896 wd:Q1625364 wd:Q1984807 wd:Q201149 wd:Q2014221 wd:Q211950 wd:Q2188248 wd:Q239193 wd:Q2424554 wd:Q3304653 wd:Q3307907 wd:Q3640797 wd:Q3752621 wd:Q3785636 wd:Q3995788 wd:Q4019090 wd:Q4251125 wd:Q5173194 wd:Q5211552 wd:Q59244052 wd:Q64735066 wd:Q64828012 wd:Q64934564 wd:Q64947484 wd:Q64947494 wd:Q64947496 wd:Q64947498 wd:Q64947526 wd:Q64947529 wd:Q64947545 wd:Q64947575 wd:Q64947581 wd:Q64947596 wd:Q65515723 wd:Q65561359 wd:Q691685 wd:Q758623 wd:Q758624 wd:Q781885 wd:Q896424 wd:Q23436}
?accper wdt:P4478 ?accused.
{?accper wdt:P551 ?place.} #UNION {?accper wdt:P20 ?place}.
OPTIONAL {?accper wdt:P570 ?dateDied.}.
OPTIONAL {?accper p:P793 / pq:P585 ?accdate. BIND (?accdate AS ?dateDied).}.
OPTIONAL {?accper p:P793 / pq:P580 ?accdate2. BIND (?accdate2 AS ?dateDied).}.
BIND(YEAR(?dateDied) AS ?dYr).
OPTIONAL {?accper wdt:P20 ?placeDiedQ. }
OPTIONAL {?accper wdt:P551 ?res}.
BIND(COALESCE(?res, ?placeDiedQ, wd:Q22) AS ?locator).
OPTIONAL {?locator wdt:P625 ?loc; p:P625/psv:P625 ?coord. }
} LIMIT 4500
}
BIND(URI (CONCAT ("https://witches.shca.ed.ac.uk/index.cfm?fuseaction=home.accusedrecord&accusedref=", ?accused, "&search_string=lastname") ) AS ?accusedURI).
BIND(IF (?dYr < 1600,"1 pre 1600",IF (?dYr < 1660,"2 1600-1660",IF (?dYr < 1700,"3 1660-1699",IF (?dYr < 1760,"4 1700 on","5 Unknown date")))) AS ?lBand).
}
Category A listed buildings[edit]
Lacking images in a place; filter (inactivated) example is Perth.
The following query uses these:
- Items: category A listed building (Q10729054) , category B listed building (Q10729125) , Perth (Q68816359) , Perth and Kinross (Q207679) , Clackmannanshire (Q207268)
- Properties: heritage designation (P1435) , located in the administrative territorial entity (P131) , image (P18) , instance of (P31) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?mapcolour AS ?layer) ?towndescLabel ?monmntLabel ?monmnt ?placedesc ?statloc ?articleDE WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
{?monmnt wdt:P1435 wd:Q10729054} UNION {?monmnt wdt:P1435 wd:Q10729125}.
?monmnt wdt:P1435 ?listAB.
?monmnt wdt:P131 ?towndesc. #wd:Q68816359.
##FILTER (?towndesc=wd:Q207679).#Clacks wd:Q207268, Stirling Q182923
optional {?monmnt wdt:P18 ?gotimg.}.
?monmnt wdt:P31 ?placedesc.
?monmnt wdt:P625 ?statloc.
?sitelink schema:about ?monmnt .
FILTER NOT EXISTS {
?article schema:about ?monmnt .
?article schema:isPartOf <https://en.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
}
OPTIONAL {?articleDE schema:about ?monmnt . ?articleDE schema:isPartOf <https://de.wikipedia.org/> .}.
BIND (IF(?listAB = wd:Q10729054, IF (BOUND(?gotimg), IF (BOUND(?articleDE),"Category A with image and article on DE but not EN", "Category A with image"), "Category A without image"), "Category B") AS ?mapcolour).
}
ORDER BY ?towndescLabel ?monmntLabel
Randomised area map:
The following query uses these:
- Properties: heritage designation (P1435) , located in the administrative territorial entity (P131) , image (P18) , instance of (P31) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?mapcolour AS ?layer) ?towndescLabel ?monmntLabel ?placedesc ?statloc ?article ?gotimg WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
{
SELECT DISTINCT ?townrand ?tmpmon ?monmntrand WHERE {
?tmpmon wdt:P1435 wd:Q10729054.
?tmpmon wdt:P131 ?townrand.
BIND(SHA256(CONCAT(STR(RAND()), STR(?tmpmon))) AS ?monmntrand) .
}
ORDER BY ?monmntrand
LIMIT 1
}
{?monmnt wdt:P131 ?townrand; wdt:P1435 wd:Q10729054.}
?monmnt wdt:P1435 ?listAB.
?monmnt wdt:P131 ?towndesc.
#FILTER (?towndesc=?townrand).
optional {?monmnt wdt:P18 ?gotimg.}.
?monmnt wdt:P31 ?placedesc.
?monmnt wdt:P625 ?statloc.
?sitelink schema:about ?monmnt .
OPTIONAL {?articleEN schema:about ?monmnt . ?articleEN schema:isPartOf <https://en.wikipedia.org/> .}.
OPTIONAL {?articleDE schema:about ?monmnt . ?articleDE schema:isPartOf <https://de.wikipedia.org/> .}.
BIND (IF (BOUND(?articleEN), ?articleEN, (IF (BOUND(?articleDE), ?articleDE,?null))) AS ?article).
BIND (IF (BOUND(?gotimg), IF (BOUND(?article),"Category A with image and article", "Category A with image"), "Category A without image") AS ?mapcolour).
}
Also link to result map.
Glasgow architects buildings:
The following query uses these:
- Items: category A listed building (Q10729054) , category B listed building (Q10729125) , Perth (Q68816359) , Glasgow City (Q55934339) , Clackmannanshire (Q207268)
- Properties: heritage designation (P1435) , architect (P84) , located in the administrative territorial entity (P131) , image (P18) , instance of (P31) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?mapcolor as?layer) ?monmntLabel ?monmnt ?gotimg ?placedescLabel ?statloc ?articleEN WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
{?monmnt wdt:P1435 wd:Q10729054}.# UNION {?monmnt wdt:P1435 wd:Q10729125}.
?monmnt wdt:P1435 ?listAB.
?monmnt wdt:P84 ?architect.
?monmnt wdt:P131 ?towndesc. #wd:Q68816359.
FILTER (?towndesc=wd:Q55934339).#Clacks wd:Q207268, Stirling Q182923
optional {?monmnt wdt:P18 ?gotimg.}.
optional {?monmnt wdt:P31 ?placedesc.}
?monmnt wdt:P625 ?statloc.
?sitelink schema:about ?monmnt .
OPTIONAL {?articleEN schema:about ?monmnt . ?articleEN schema:isPartOf <https://en.wikipedia.org/> .}.
?architect rdfs:label ?mapcolor. FILTER(LANG(?mapcolor) = "en").
}
Cat A across Scotland scattered by architect (de minimis applied):
The following query uses these:
- Items: category A listed building (Q10729054) , category B listed building (Q10729125) , Perth (Q68816359) , Dundee (Q68826051) , Clackmannanshire (Q207268)
- Properties: heritage designation (P1435) , architect (P84) , located in the administrative territorial entity (P131) , image (P18) , instance of (P31) , coordinate location (P625)
#defaultView:ScatterChart SELECT DISTINCT (?mapcolor as ?architect) ?towndescLabel (?buildings AS ?count) ?statloc WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } FILTER (?buildings > 5). { SELECT DISTINCT ?towndesc ?statloc ?mapcolor (COUNT(?monmnt) AS ?buildings) WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } {?monmnt wdt:P1435 wd:Q10729054}.# UNION {?monmnt wdt:P1435 wd:Q10729125}. ?monmnt wdt:P1435 ?listAB. ?monmnt wdt:P84 ?architect. ?monmnt wdt:P131 ?towndesc. #wd:Q68816359. #FILTER (?towndesc=wd:Q68826051).#Clacks wd:Q207268, Stirling Q217838 Glasgow Q55934339 Edinburgh Q2379199 Aberdeen Q62274582 optional {?monmnt wdt:P18 ?gotimg.}. optional {?monmnt wdt:P31 ?placedesc.} ?towndesc wdt:P625 ?statloc. ?sitelink schema:about ?monmnt . OPTIONAL {?articleEN schema:about ?monmnt . ?articleEN schema:isPartOf <https://en.wikipedia.org/> .}. ?architect rdfs:label ?mapcolor. FILTER(LANG(?mapcolor) = "en"). } GROUP BY ?towndesc ?statloc ?mapcolor } } ORDER BY ?mapcolor ?towndesc
Moderators of the General Assembly[edit]
Data in enwiki probably needs to be scraped and used to enhance: not yet done
The following query uses these:
- Properties: position held (P39) , place of birth (P19) , residence (P551) , coordinate location (P625) , educated at (P69) , date of death (P570) , place of death (P20)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?Era as ?layer) ?loc ?modLabel ?mod ?bornwhereLabel ?livewhereLabel ?diedwhen WHERE {
?mod wdt:P39 wd:Q6888514.
optional {?mod wdt:P19 ?bornwhere.}
optional {?mod wdt:P551 ?livewhere. ?livewhere wdt:P625 ?lloc.}
optional {?mod wdt:P69 ?edwhere. ?edwhere wdt:P625 ?eloc.}
?mod wdt:P570 ?diedwhen.
BIND(year(?diedwhen) AS ?dyr).
optional {?mod wdt:P20 ?diedwhere. ?diedwhere wdt:P625 ?dloc.}.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
BIND (COALESCE(?lloc, COALESCE(?dloc, ?eloc)) AS ?loc).
BIND( IF (?dyr < 1700, "1 pre-1700", IF (?dyr < 1800, "2 18th century", IF (?dyr < 1900, "3 19th century", IF (?dyr < 2000, "4 20th century",
"5 Recent")))) AS ?Era).
} LIMIT 900
Artworks in galleries in Scotland[edit]
Various queries, now ported to User:AllyD/GalleryArtworks.
See also commons:User:AllyD/ScottishPainting.
Working on graphical view of exhibiting spaces:
The following query uses these:
- Items: Scotland (Q22) , Scottish council area (Q15060255) , art museum (Q207694) , art gallery (Q1007870) , not-for-profit arts organization (Q7062022) , art institution (Q20897549)
- Properties: located in the administrative territorial entity (P131) , instance of (P31) , coordinate location (P625) , image (P18)
Features: Graph (Q24515287)
#defaultView:Graph
SELECT DISTINCT ?place ?placeLabel ?placeURI WHERE { {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?cooncil wdt:P131 wd:Q22} ?cooncil wdt:P31 wd:Q15060255.
{ {?place wdt:P31 wd:Q207694 } UNION { ?place wdt:P31 wd:Q1007870} UNION { ?place wdt:P31 wd:Q7062022} UNION { ?place wdt:P31 wd:Q20897549} }
?place wdt:P131 ?cooncil . ?place wdt:P625 ?loc .
?place wdt:P31 ?placeDescQ.
optional { ?place wdt:P18 ?placeURI } .
}
List of paintings in galleries outwith Edinburgh with label falling back to description:
The following query uses these:
- Items: Scotland (Q22) , Scottish council area (Q15060255) , art museum (Q207694) , museum (Q33506) , City of Edinburgh (Q2379199) , painting (Q3305213)
- Properties: located in the administrative territorial entity (P131) , instance of (P31) , coordinate location (P625) , collection (P195) , location (P276)
#defaultView:Table SELECT DISTINCT ?cooncilLabel ?placeLabel ?pic ?picTitle WHERE { { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?cooncil wdt:P131 wd:Q22} ?cooncil wdt:P31 wd:Q15060255. { {?place wdt:P31 wd:Q207694 } UNION { ?place wdt:P31 wd:Q33506} } { ?place wdt:P131 ?cooncil MINUS { ?place wdt:P131 wd:Q2379199.} }. ?place wdt:P625 ?loc . { ?pic wdt:P195 ?place } UNION { ?pic wdt:P276 ?place } ?pic wdt:P31 wd:Q3305213 . OPTIONAL { ?pic rdfs:label ?picLabel. FILTER(LANG(?picLabel) = "en"). } OPTIONAL { ?pic schema:description ?picDesc. FILTER(LANG(?picDesc) = "en"). } BIND(IF(BOUND(?picLabel),?picLabel,?picDesc) AS ?picTitle). } GROUP BY ?cooncilLabel ?placeLabel ?pic ?picTitle
Artists involved in performance[edit]
Now in User:AllyD/ArtistsActivities#Graph_of_artists_whose_activites_involve_performance.
documenta[edit]
Now in User:AllyD/ArtistsActivities#Event-based_queries.
Artists involved in instances of serial events[edit]
This indicates Documenta is more or less the only such event for which participants have been linked.
The following query uses these:
- Items: art exhibition (Q667276) , biennale (Q19823984) , exhibition (Q464980) , Gijsbert van Bronckhorst (Q1527519)
- Properties: instance of (P31) , part of (P361) , start time (P580) , performer (P175) , participant (P710)
#defaultView:Timeline SELECT DISTINCT ?eventStart ?event ?eventLabel (COUNT(?artist) AS ?count) WHERE { { ?eventbroad wdt:P31 wd:Q667276.} UNION { ?eventbroad wdt:P31 wd:Q19823984.} UNION { { ?eventbroad wdt:P31 wd:Q464980.} UNION { ?eventbroad wdt:P31 wd:Q1527519.} } { ?event wdt:P31 ?eventbroad. } UNION { ?event wdt:P361 ?eventbroad. }. #event instance ?event rdfs:label ?eventLabel. FILTER((LANG(?eventLabel)) = "en"). OPTIONAL { ?event wdt:P580 ?eventStart.} OPTIONAL { {?event wdt:P175 ?artist. } UNION {?event wdt:P710 ?artist. } } #usually P710 participants but P175 catches at least one event } GROUP BY ?eventStart ?event ?eventLabel
Artists societies[edit]
Q12160242 is poorly populated but adding Q4502119 art group gives too broad a mass of cases and Q1400264 catches all joint endeavours
The following query uses these:
- Items: art society (Q12160242)
- Properties: instance of (P31) , image (P18) , located in the administrative territorial entity (P131) , location (P276) , country (P17)
#defaultView:Table SELECT DISTINCT ?socLabel ?soc ?socURI ?socLoc WHERE { { {?soc wdt:P31 wd:Q12160242 } } . optional {?soc rdfs:label ?socLabel. FILTER(LANG(?socLabel) = "en").}. optional { ?soc wdt:P18 ?socURI } . optional { ?soc wdt:P131 ?socLocAQ. ?socLocAQ rdfs:label ?socLocA. FILTER(LANG(?socLocA) = "en"). } . optional { ?soc wdt:P276 ?socLocPQ. ?socLocPQ rdfs:label ?socLocP. FILTER(LANG(?socLocP) = "en"). } . optional { ?soc wdt:P17 ?socCountryQ. ?socCountryQ rdfs:label ?socCountry. FILTER(LANG(?socCountry) = "en"). } . BIND(IF(BOUND(?socLocP),?socLocP,?socLocA) AS ?socLoc). BIND(IF(BOUND(?socLoc),?socLoc,?socCountry) AS ?socLoc). } LIMIT 3000
Developing enhanced map query:
The following query uses these:
- Properties: instance of (P31) , inception (P571) , image (P18) , located in the administrative territorial entity (P131) , coordinate location (P625) , location of formation (P740) , location (P276) , work location (P937) , country (P17)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?foundingEra as ?layer) ?socLabel ?soc ?coord ?socBegan ?socURI ?socLoc WHERE {
{ {?soc wdt:P31 wd:Q12160242 } UNION { ?soc wdt:P31 wd:Q1797187 } } .
{ ?soc wdt:P571 ?socBegan; BIND(IF(BOUND(?socBegan),year(?socBegan),1945) AS ?socBeganYr). }.
BIND( IF (?socBeganYr < 1800, "1 pre-1800",
IF (?socBeganYr < 1850, "2 pre-1850",
IF (?socBeganYr < 1900, "3 pre-1900",
IF (?socBeganYr < 1915, "4 pre-WW1",
IF (?socBeganYr < 1946, "5 inter-war",
IF (?socBeganYr < 1990, "6 Post WW2", "7 Recent"))))))
AS ?foundingEra).
optional { ?soc wdt:P18 ?socURI } .
optional { ?soc wdt:P131 ?socLocAQ.
?socLocAQ rdfs:label ?socLocA. FILTER(LANG(?socLocA) = "en").
?socLocAQ wdt:P625 ?coord. } .
optional { ?soc wdt:P740 ?socLocFQ.
?socLocFQ rdfs:label ?socLocF. FILTER(LANG(?socLocF) = "en").
?socLocFQ wdt:P625 ?coord. } .
optional { ?soc wdt:P276 ?socLocPQ.
?socLocPQ rdfs:label ?socLocP. FILTER(LANG(?socLocP) = "en").
?socLocPQ wdt:P625 ?coord.} .
optional { ?soc wdt:P937 ?socLocWLQ.
?socLocWLQ rdfs:label ?socLocWL. FILTER(LANG(?socLocWL) = "en").
?socLocWLQ wdt:P625 ?coord. } .
optional { ?soc wdt:P17 ?socCountryQ.
?socCountryQ rdfs:label ?socCountry. FILTER(LANG(?socCountry) = "en").
?socCountryQ wdt:P625 ?coord. } .
BIND(IF(BOUND(?socLocP),?socLocP,?socLocA) AS ?socLoc).
BIND(IF(BOUND(?socLoc),?socLoc,?socLocF) AS ?socLoc).
BIND(IF(BOUND(?socLoc),?socLoc,?socLocWL) AS ?socLoc).
BIND(IF(BOUND(?socLoc),?socLoc,?socCountry) AS ?socLoc).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?foundingEra ?socLabel LIMIT 3000
Truncated version to squeeze into the URL shortener:
The following query uses these:
- Properties: instance of (P31) , inception (P571) , located in the administrative territorial entity (P131) , coordinate location (P625) , location of formation (P740) , location (P276) , work location (P937) , country (P17)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?foundingEra as ?layer) ?socLabel ?soc ?coord ?socBegan ?socLocQ WHERE {
{ {?soc wdt:P31 wd:Q12160242 } UNION { ?soc wdt:P31 wd:Q1797187 } } .
{ ?soc wdt:P571 ?socBegan; BIND(IF(BOUND(?socBegan),year(?socBegan),1945) AS ?socBeganYr). }.
optional {?soc rdfs:label ?socLabel. FILTER(LANG(?socLabel) = "en").}.
BIND( IF (?socBeganYr < 1800, "1 pre-1800", IF (?socBeganYr < 1850, "2 pre-1850", IF (?socBeganYr < 1900, "3 pre-1900", IF (?socBeganYr < 1915, "4 pre-WW1",
IF (?socBeganYr < 1946, "5 inter-war", IF (?socBeganYr < 1990, "6 Post WW2", "7 Recent")))))) AS ?foundingEra).
optional { ?soc wdt:P131 ?socLocAQ. ?socLocAQ wdt:P625 ?coord. } .
optional { ?soc wdt:P740 ?socLocFQ. ?socLocFQ wdt:P625 ?coord. } .
optional { ?soc wdt:P276 ?socLocPQ. ?socLocPQ wdt:P625 ?coord.} .
optional { ?soc wdt:P937 ?socLocWLQ. ?socLocWLQ wdt:P625 ?coord. } .
optional { ?soc wdt:P17 ?socCountryQ. ?socCountryQ wdt:P625 ?coord. } .
BIND(IF(BOUND(?socLocPQ),?socLocPQ,?socLocAQ) AS ?socLocQ).
BIND(IF(BOUND(?socLocQ),?socLocQ,?socLocFQ) AS ?socLocQ).
BIND(IF(BOUND(?socLocQ),?socLocQ,?socLocWLQ) AS ?socLocQ).
BIND(IF(BOUND(?socLocQ),?socLocQ,?socCountryQ) AS ?socLocQ).
} LIMIT 900
Map query on ancient locations in Scotland[edit]
Forts (filtered by map location)
The following query uses these:
- Properties: instance of (P31) , subclass of (P279) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT (?typeLabel AS ?layer) ?label ?loc ?subj
WHERE
{
?subj wdt:P31/wdt:P279* wd:Q839954 ; # site or subtype
wdt:P625 ?loc ; # location to plot on map
p:P625/psv:P625 ?coord; # coordinate-location statement
rdfs:label ?label filter (lang(?label) = "en"). #Place name
?type wdt:P279? wd:Q744099 ; rdfs:label ?typeLabel filter (lang(?typeLabel) = "en"). #Type of fort (Q744099)
?coord wikibase:geoLatitude ?lat .
?coord wikibase:geoLongitude ?long .
FILTER (?lat > 54.7) FILTER (?lat < 63)
FILTER (?long > -10.5) FILTER (?long < 2.02)
}
Pict stones
The following query uses these:
- Items: Pictish stone (Q1666255) , cross slab (Q1141208) , cup and ring mark (Q373661) , Scottish council area (Q15060255)
- Properties: instance of (P31) , located in the administrative territorial entity (P131) , coordinate location (P625) , Canmore ID (P718) , Historic Environment Scotland ID (P709) , image (P18)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?typeLabel AS ?layer) ?label ?loc ?stone ?picURI ?extURI ?tDesc
WHERE
{
{ { ?stone wdt:P31 wd:Q1666255 .}
UNION
{ ?stone wdt:P31 wd:Q1141208 .}
UNION
{ ?stone wdt:P31 wd:Q373661 .
?stone wdt:P131/wdt:P31 ?where . FILTER (?where = wd:Q15060255 ). }
}. #Obtain Pictish stones plus earlier cup and ring marked stones
?stone wdt:P31 ?tLabel. ?tLabel rdfs:label ?tDesc filter (lang(?tDesc) = "en"). #Place name
?stone
wdt:P625 ?loc ; # location to plot on map
p:P625/psv:P625 ?coord; # coordinate-location statement
rdfs:label ?label filter (lang(?label) = "en"). #Place name
OPTIONAL { ?stone wdt:P718 ?_canmoreID } .
OPTIONAL { ?stone wdt:P709 ?_HSID } .
BIND(IF(BOUND(?_canmoreID),(URI (CONCAT ("https://canmore.org.uk/site/", ?_canmoreID) ) ),
IF(BOUND(?_HSID),(URI (CONCAT ("https://portal.historicenvironment.scot/designation/", ?_HSID) ) ), ?_HSID ) ) AS ?extURI).
OPTIONAL { ?stone wdt:P18 ?picURI } .
#BIND(IF(str(?tDesc) = "Pictish stone", "Pictish stone", "Cup and ring stone") AS ?typeLabel). # alt for summary map
BIND(IF(BOUND(?picURI),?tDesc,(CONCAT (?tDesc, " without image") ) ) AS ?typeLabel).
}
Pict, Gaelic and Norse origin place names
The following query uses these:
- Properties: instance of (P31) , located in the administrative territorial entity (P131) , coordinate location (P625) , image (P18)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?typeLabel AS ?layer) ?label ?loc ?place ?picURI ?extURI ?tDesc
WHERE
{
{ { ?place wdt:P31 wd:Q532 .} UNION { ?place wdt:P31 wd:Q3957 .}
?place wdt:P131/wdt:P31 ?where . FILTER (?where = wd:Q15060255 )
}.
?place wdt:P31 ?tLabel. ?tLabel rdfs:label ?tDesc filter (lang(?tDesc) = "en"). #Place name
?place
wdt:P625 ?loc ; # location to plot on map
p:P625/psv:P625 ?coord; # coordinate-location statement
rdfs:label ?label filter (lang(?label) = "en"). #Place name
OPTIONAL { ?place wdt:P18 ?picURI } .
BIND(IF( regex(?label, "^Pit.*") , "Pict",
IF( regex(?label, "^Aber.*") , "Pict",
IF( regex(?label, "^*.cardin.*") , "Pict",
IF( regex(?label, "^*.carden") , "Pict",
IF( regex(?label, "^Inver.*") , "Gael",
IF( regex(?label, "^Dun.*") , "Gael",
IF( regex(?label, "^Bal.*") , "Gael",
IF( regex(?label, "^Glen.*") , "Gael",
IF( regex(?label, "^Strath.*") , "Gael",
IF( regex(?label, "^Stran.*") , "Gael",
IF( regex(?label, "^Stron.*") , "Gael",
IF( regex(?label, "^Tigh.*") , "Gael",
IF( regex(?label, "^Kil.*") , "Gael",
IF( regex(?label, "^*.dale") , "Norse",
IF( regex(?label, "^*.dair") , "Norse",
IF( regex(?label, "^*.firth") , "Norse",
IF( regex(?label, "^*.forth") , "Norse",
"Scot" ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
) AS ?typeLabel).
FILTER(?typeLabel != "Scot").
}
Commercial locations in Scotland[edit]
Search and update queries[edit]
The following query uses these:
- Items: business (Q4830453) , enterprise (Q6881511) , company (Q783794) , bank (Q22687) , public company (Q891723) , shipbuilding company (Q16274795) , shipbuilding (Q474200) , Scotland (Q22) , Scottish council area (Q15060255)
- Properties: instance of (P31) , subclass of (P279) , industry (P452) , located in the administrative territorial entity (P131) , headquarters location (P159) , inception (P571) , coordinate location (P625) , dissolved, abolished or demolished date (P576) , product or material produced or service provided (P1056)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT ?loc ?subj ?subjLabel ?startdt ?enddt ?linebusLabel ?didwhatLabel ?hplaceLabel ?adminLabel
WHERE
{
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?bustypes {
wd:Q4830453 wd:Q6881511
wd:Q783794
wd:Q22687
wd:Q891723
wd:Q16274795 wd:Q474200
}
{?subj wdt:P31/wdt:P279* ?bustypes} UNION {?subj wdt:P452 ?bustypes}.
###Scotland filter begins:
VALUES ?scotmarks {wd:Q22 wd:Q15060255 }
{?subj wdt:P131 ?scotmarks.}
UNION {?subj wdt:P131 ?orgloc1. ?orgloc1 wdt:P31/wdt:P131 ?scotmarks.}
UNION {?subj wdt:P159 ?orgpl. { ?orgpl wdt:P31/wdt:P131 ?scotmarks.} UNION {?orgpl wdt:P131 ?orgl2. ?orgl2 wdt:P31/wdt:P131 ?scotmarks.}.}.
###Scotland filter ends
?subj wdt:P571 ?startdt.
FILTER (YEAR(?startdt) < 1920 && YEAR(?startdt) > 1300).
###Map locator begins:
OPTIONAL {?subj wdt:P625 ?loc1}.
OPTIONAL {?subj wdt:P159 ?orghq. ?orghq wdt:P625 ?hloc.}.
OPTIONAL {?subj wdt:P131 ?orgwhere. ?orgwhere wdt:P625 ?aloc.}.
BIND (IF(BOUND(?loc1),?loc1,IF(BOUND(?hloc),?hloc,IF (BOUND(?aloc),?aloc,?NULL))) AS ?loc).
###Map locator ends
?subj wdt:P31 ?linebus.
OPTIONAL {?subj wdt:P576 ?enddt.}
OPTIONAL {?subj wdt:P1056 ?didwhat.}
}
Graph view of banks[edit]
The following query uses these:
- Items: bank (Q22687) , Scotland (Q22) , Clydesdale Bank (Q971680)
- Properties: instance of (P31) , subclass of (P279) , located in the administrative territorial entity (P131) , headquarters location (P159) , inception (P571) , dissolved, abolished or demolished date (P576) , product or material produced or service provided (P1056) , followed by (P156) , merged into (P7888) , point in time (P585) , start time (P580) , end time (P582)
Features: Graph (Q24515287)
#defaultView:Graph
SELECT DISTINCT ?subj ?subjLabel (YEAR(?startdt) AS ?from) (YEAR(?enddt) AS ?to) ?rgb ?hplaceLabel ?successor ?successorLabel ?succbegin ?succstop
WHERE
{
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?bustypes {
wd:Q22687
}
?subj wdt:P31/wdt:P279* ?bustypes .
?subj wdt:P131 ?admin.
?admin wdt:P131 ?adminup.
{?subj wdt:P131 wd:Q22.}.
OPTIONAL {?subj wdt:P159 ?hplace. }.
?subj wdt:P571 ?startdt.
FILTER (YEAR(?startdt) < 1990 && YEAR(?startdt) > 1300).
FILTER (?subj != wd:Q971680).#ugly Clydesdale
OPTIONAL {?subj wdt:P131 ?admin. }.
OPTIONAL {?subj wdt:P576 ?enddt.}
OPTIONAL {?subj wdt:P1056 ?didwhat.}
OPTIONAL {?subj wdt:P156 ?successor}. OPTIONAL {?subj p:P156 ?sid.
OPTIONAL {?sid pq:P585 ?succbegin.}. OPTIONAL {?sid pq:P580 ?succbegin.}.
OPTIONAL { ?sid pq:P582 ?succstop}.}.
OPTIONAL {?subj wdt:P7888 ?successor}. OPTIONAL {?subj p:P7888 ?sid.
OPTIONAL {?sid pq:P585 ?succbegin.}. OPTIONAL {?sid pq:P580 ?succbegin.}.
OPTIONAL { ?sid pq:P582 ?succstop}.}.
BIND(IF(BOUND(?successor), "faf082", IF(BOUND(?enddt),"fca9af","a8f777")) AS ?rgb).
#BIND(IF(YEAR(?startdt)<1800,"121212","00FF00") AS ?rgb).
}
Stone circle positions across UK[edit]
The following query uses these:
- Properties: instance of (P31) , subclass of (P279) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT (?typeLabel AS ?layer) ?label ?loc ?subj
WHERE
{
?subj wdt:P31/wdt:P279* wd:Q1935728 ; # site or subtype
wdt:P625 ?loc ; # location to plot on map
p:P625/psv:P625 ?coord; # coordinate-location statement
rdfs:label ?label filter (lang(?label) = "en"). #Place name
?type wdt:P279? wd:Q8818437 ;
rdfs:label ?typeLabel filter (lang(?typeLabel) = "en"). #Type of fort (Q744099)
?coord wikibase:geoLatitude ?lat .
?coord wikibase:geoLongitude ?long .
FILTER (?lat > 50.103) FILTER (?lat < 60.154)
FILTER (?long > -7.64) FILTER (?long < 1.75)
}
Art Nouveau / Jugendstil buildings[edit]
The following query uses these:
- Items: Art Nouveau (Q34636)
- Properties: architectural style (P149) , located in the administrative territorial entity (P131) , image (P18) , inception (P571) , date of official opening (P1619) , heritage designation (P1435) , instance of (P31) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?mapcolour AS ?layer) ?towndescLabel ?monmntLabel ?monmnt ?placedescLabel ?statloc ?built ?herdesLabel ?gotimg WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
{?monmnt wdt:P149 wd:Q34636}.
?monmnt wdt:P131 ?towndesc.
optional {?monmnt wdt:P18 ?gotimg.}.
optional {{?monmnt wdt:P571 ?built.} UNION {?monmnt wdt:P1619 ?built.}}.
?monmnt wdt:P1435 ?herdes.
?monmnt wdt:P31 ?placedesc.
?monmnt wdt:P625 ?statloc.
BIND (IF (BOUND(?built), year(?built), 1800) AS ?dyr).
BIND( IF (?dyr < 1801, "0 Unknown", IF (?dyr < 1900, "1 C19", IF (?dyr < 1915, "2 Pre WW1", IF (?dyr < 1940, "3 Interwar", IF (?dyr < 2000, "4 Post WW2",
"5 Recent"))))) AS ?mapcolour).
}
ORDER BY ?mapcolour ?monmntLabel
[1] and quick result query.
Fires and other disasters in Glasgow area[edit]
The following query uses these:
- Items: structure fire (Q7625093) , conflagration (Q168983) , explosion (Q179057) , industrial disaster (Q68800046) , gas explosion (Q1362483) , stampede (Q2165983)
- Properties: instance of (P31) , significant event (P793) , coordinate location (P625) , located in the administrative territorial entity (P131)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT ?loc ?subj ?subjLabel
WHERE
{
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?disaster {
wd:Q7625093
wd:Q168983
wd:Q179057
wd:Q68800046
wd:Q1362483
wd:Q2165983
}.
{{?subj wdt:P31 ?disaster} UNION {?subj wdt:P793 ?disaster}}
?subj wdt:P625 ?loc;
p:P625/psv:P625 ?coord.
#OPTIONAL {?subj wdt:P131 ?adminPlace.}
?coord wikibase:geoLatitude ?lat .
?coord wikibase:geoLongitude ?long .
FILTER (?lat > 55.6) FILTER (?lat < 55.9)
FILTER (?long > -4.5) FILTER (?long < -3)
}
Literary societies[edit]
The following query uses these:
- Items: Edinburgh Cape Club (Q5338157) , The Poker Club (Q7757623) , The Select Society (Q10369531) , Maitland Club (Q6737150) , Bannatyne Club (Q4856871) , The Hunterian Club (Q103500126) , Society of Antiquaries of Scotland (Q7552374) , Scottish History Society (Q7437779) , human (Q5)
- Properties: member of (P463) , instance of (P31)
Features: Graph (Q24515287)
#defaultView:Graph
#defaultView:Graph
SELECT DISTINCT ?subj ?subjLabel ?whatsoc ?whatsocLabel
WHERE
{
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?thesesocs {
#wd:Q5338157 wd:Q7757623 wd:Q10369531 #C18
wd:Q6737150 wd:Q4856871 wd:Q103500126 wd:Q7552374 wd:Q7437779 #C19
}
?subj wdt:P463 ?thesesocs .
?subj wdt:P31 wd:Q5.
?subj wdt:P463 ?whatsoc.
}
Scottish newspapers queried by town[edit]
Query by known towns:
The following query uses these:
- Items: newspaper (Q11032) , Stirling (Q182923) , Aberdeen (Q36405) , Glasgow (Q4093) , Edinburgh (Q23436) , Perth (Q203000) , Dundee (Q123709) , Kilmarnock (Q576562) , Paisley (Q211870) , Inverness (Q160493) , Ayr (Q654216) , Falkirk (Q623687) , Alloa (Q1009331)
- Properties: instance of (P31) , subclass of (P279) , headquarters location (P159) , place of publication (P291) , inception (P571)
#defaultView:Table SELECT DISTINCT ?subj ?subjLabel ?pubplace1Label ?pubplace2Label ?startdt WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } VALUES ?bustypes { wd:Q11032 } VALUES ?scotCities { wd:Q182923 wd:Q36405 wd:Q4093 wd:Q23436 wd:Q203000 wd:Q123709 wd:Q576562 wd:Q211870 wd:Q160493 wd:Q654216 wd:Q623687 wd:Q1009331 } ?subj wdt:P31/wdt:P279* ?bustypes . {?subj wdt:P159 ?scotCities.} UNION {?subj wdt:P291 ?scotCities.}. OPTIONAL {?subj wdt:P159 ?pubplace1.} OPTIONAL {?subj wdt:P291 ?pubplace2.} OPTIONAL {?subj wdt:P571 ?startdt.}. }
Or query outwards from Council->Town->paper:
The following query uses these:
- Items: newspaper (Q11032) , Sunday newspaper (Q2302208) , periodical (Q1002697) , town (Q3957) , city (Q515) , village (Q532) , small burgh (Q7543008) , locality (Q3257686) , Scottish council area (Q15060255)
- Properties: instance of (P31) , subclass of (P279) , headquarters location (P159) , place of publication (P291) , located in the administrative territorial entity (P131) , population (P1082) , inception (P571) , P573
#defaultView:Timeline SELECT DISTINCT ?subj ?subjLabel ?pubplace1Label ?pubplace2Label ?startdt WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } VALUES ?bustypes { wd:Q11032 #wd:Q2302208 #wd:Q1002697 # } ?subj wdt:P31/wdt:P279* ?bustypes . OPTIONAL {?subj wdt:P159 ?pubplace1.} OPTIONAL {?subj wdt:P291 ?pubplace2.} { SELECT DISTINCT ?town WHERE { VALUES ?typesOfPlaces { wd:Q3957 wd:Q515 wd:Q532 wd:Q7543008 wd:Q3257686 } ?town (wdt:P31/(wdt:P279*)) ?typesOfPlaces. ?town wdt:P131 ?cooncil. { SELECT DISTINCT ?cooncil WHERE { ?cooncil wdt:P31 wd:Q15060255. } } ?town wdt:P1082 ?population. FILTER (?population >3000). } } { ?subj wdt:P159 ?town} UNION { ?subj wdt:P291 ?town}. OPTIONAL {?subj wdt:P571 ?startdt.}. #OPTIONAL {?subj wdt:P573 ?enddt.}. } ORDER BY ?subjLabel
Mapping Bot returns[edit]
The following query uses these:
- Items: Allan Lawder (Q43396168) , Kilmorie Stone (Q1612113) , Glasgow Central station (Q800825) , Kininvie House (Q10314411) , Clackmannan F.C. (Q5124894) , Galston F.C. (Q5519335) , Patrick Andersone (Q43393601) , Clach Biorach (Q5124855) , Midhope Castle (Q6842247) , Bonnyrigg railway station (Q30624440) , Law Castle (Q6502991) , Carscreugh Castle (Q17792014) , Raith Rovers F.C. (Q1046939) , Issobell Gowdie (Q276382) , Ballochroy standing stones (Q15849096) , St Columba's Cathedral (Q723359) , Auchengray railway station (Q4819399) , Quina Scord chambered cairn (Q25384171) , Bekka Hill chambered cairn (Q56667183) , Beith Juniors F.C. (Q4881486) , Callander railway station (Q5021768) , Tullich Churchyard and symbol stones (Q17771263) , Cockenzie House, Southern Gates (Q17572099) , Westcraigs railway station (Q101003894) , Issobell Miller (Q43389980) , Loch Tay railway station (Q6665021) , Katherine Mosse (Q43390004) , Wishaw United F.C. (Q116788697) , Castle Douglas railway station (Q67913321) , Baldowrie Symbol Stone (Q17844144) , Prestwick, Market Cross (Q17124680) , association football club (Q476028) , railway station (Q55488) , human (Q5)
- Properties: instance of (P31) , coordinate location (P625) , residence (P551) , headquarters location (P159) , image (P18) , home venue (P115)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT (?itemdesc AS ?layer) ?loc ?item ?itemLabel ?gotimg ?itemtypeLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?item { wd:Q43396168 wd:Q1612113 wd:Q800825 wd:Q10314411 wd:Q5124894 wd:Q5519335 wd:Q43393601 wd:Q5124855 wd:Q6842247 wd:Q30624440 wd:Q6502991 wd:Q17792014 wd:Q1046939 wd:Q276382 wd:Q15849096 wd:Q723359 wd:Q4819399 wd:Q25384171 wd:Q56667183 wd:Q4881486 wd:Q5021768 wd:Q17771263 wd:Q17572099 wd:Q101003894 wd:Q43389980 wd:Q6665021 wd:Q43390004 wd:Q116788697 wd:Q67913321 wd:Q17844144 wd:Q17124680 }
?item wdt:P31 ?itemtype.
OPTIONAL {?item wdt:P625 ?iloc.}.
OPTIONAL {?item p:P115 ?tpark. ?tpark ps:P115 ?teampark. optional {?teampark wdt:P625 ?teamparkloc.}.}.
OPTIONAL {?item wdt:P551 ?home. ?home wdt:P625 ?homeloc.}.
OPTIONAL {?item wdt:P159 ?hq. ?hq wdt:P625 ?hqloc.}.
optional {?item wdt:P18 ?gotimg.}.
BIND (IF (BOUND(?iloc), ?iloc, (IF (BOUND(?teamparkloc), ?teamparkloc, (IF (BOUND(?homeloc), ?homeloc,(IF (BOUND(?hqloc), ?hq,?null))))) )) AS ?loc).
BIND (IF(?itemtype = wd:Q476028, "Football club",
IF(?itemtype = wd:Q55488, "Station",
IF(?itemtype = wd:Q5, "Person", "Site"))) AS ?itemdesc).
}
Mastodon accounts in Scotland[edit]
The following query uses these:
- Properties: Mastodon address (P4033) , instance of (P31) , located in the administrative territorial entity (P131) , headquarters location (P159) , country (P17) , coordinate location (P625)
Features: map (Q24515275)
#defaultView:Map
SELECT DISTINCT #(?orgTypeLabel AS ?layer)
?loc ?org ?orgLabel
?tmp17Label ?tmp131Label ?tmp159Label
WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?scotmarks {wd:Q22 wd:Q15060255 }
?org wdt:P4033 ?MastName.
?org wdt:P31 ?orgType.
FILTER (?orgType != wd:Q5). #ignore individuals
{?org wdt:P131 ?scotmarks.}
UNION {?org wdt:P131 ?orgloc1. ?orgloc1 wdt:P31/wdt:P131 ?scotmarks.}
UNION {?org wdt:P159 ?orgpl. { ?orgpl wdt:P31/wdt:P131 ?scotmarks.} UNION {?orgpl wdt:P131 ?orgl2. ?orgl2 wdt:P31/wdt:P131 ?scotmarks.}.}.
OPTIONAL {?org wdt:P17 ?tmp17}. OPTIONAL {?org wdt:P131 ?tmp131}. OPTIONAL {?org wdt:P159 ?tmp159}.
BIND (strafter(?MastName,"@") AS ?hostAt).
OPTIONAL {?org wdt:P625 ?loc1}.
OPTIONAL {?org wdt:P159 ?orghq. ?orghq wdt:P625 ?hloc.}.
OPTIONAL {?org wdt:P131 ?orgwhere. ?orgwhere wdt:P625 ?aloc.}.
BIND (IF(BOUND(?loc1),?loc1,IF(BOUND(?hloc),?hloc,IF (BOUND(?aloc),?aloc,?NULL))) AS ?loc).
?orgType rdfs:label ?orgTypeLabel filter (lang(?orgTypeLabel) = "en"). #P279 to level up?
}