query-6139781df7fb3281b7ee72dcaaf12126
PlacesMSPs born outwith Scotland
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?person ?personLabel ?born ?bornLabel ?coord {
?position wdt:P279* wd:Q1711695 . # 1. find all the MSP positions
?person p:P39 ?ps . ?ps ps:P39 ?position . # 2. did they hold any MSP position
?person wdt:P31 wd:Q5 . # 2a. check they were actually people (in case we have any fictional MSPs)
?person wdt:P19 ?born . # 3. where were they born
MINUS { ?born wdt:P131* wd:Q22 . } # 4. this bit filters down to just "not in Scotland"
OPTIONAL { ?born wdt:P625 ?coord . } # 5. coordinates if available
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
#defaultView:Map
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?born"):::projected
v5("?coord"):::projected
v2("?person"):::projected
v1("?position")
v3("?ps")
c14(["en"]):::literal
c2(["wd:Q1711695"]):::iri
c9(["wd:Q22"]):::iri
c12(["bd:serviceParam"]):::iri
c6(["wd:Q5"]):::iri
v1 --"p:direct/P279"--> c2
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> v1
v2 --"p:direct/P31"--> c6
v2 --"p:direct/P19"--> v4
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v4 --"p:direct/P131"--> c9
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P625".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end