query-efccfc4adfd61ecc1b8f646c78c7551f
University teachers with place of birth / deathHi there! So I'm trying to query all university teachers including dates / places of birth and death for a map project. This is the query I came up with:
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?subj ?bplaceLabel (REPLACE(STR(?bcoord),"Point\\((.*) (.*)\\)","$1") AS ?b_lng) (REPLACE(STR(?bcoord),"Point\\((.*) (.*)\\)","$2") AS ?b_lat)
?yob ?dplaceLabel (REPLACE(STR(?dcoord),"Point\\((.*) (.*)\\)","$1") AS ?d_lng) (REPLACE(STR(?dcoord),"Point\\((.*) (.*)\\)","$2") AS ?d_lat) ?yod WHERE {
?subj wdt:P106 wd:Q1622272;
wdt:P19 ?bplace;
wdt:P20 ?dplace;
wdt:P569 ?dob;
wdt:P570 ?dod.
?bplace wdt:P625 ?bcoord.
?dplace wdt:P625 ?dcoord.
BIND(YEAR(?dob) AS ?yob).
BIND(YEAR(?dod) AS ?yod).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
#LIMIT 10000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v11("?b_lat")
v10("?b_lng")
v6("?bcoord"):::projected
v2("?bplace")
v13("?d_lat")
v12("?d_lng")
v7("?dcoord"):::projected
v4("?dob")
v5("?dod")
v3("?dplace")
v1("?subj"):::projected
v8("?yob"):::projected
v9("?yod"):::projected
c9(["bd:serviceParam"]):::iri
c2(["wd:Q1622272"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P106"--> c2
v1 --"wdt:P19"--> v2
v1 --"wdt:P20"--> v3
v1 --"wdt:P569"--> v4
v1 --"wdt:P570"--> v5
v2 --"wdt:P625"--> v6
v3 --"wdt:P625"--> v7
bind0[/"year-from-dateTime(?dob)"/]
v4 --o bind0
bind0 --as--o v8
bind1[/"year-from-dateTime(?dod)"/]
v5 --o bind1
bind1 --as--o v9
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind2[/"replace(str(?bcoord),'Point\((.*) (.*)\)','$1')"/]
v6 --o bind2
bind2 --as--o v10
bind3[/"replace(str(?bcoord),'Point\((.*) (.*)\)','$2')"/]
v6 --o bind3
bind3 --as--o v11
bind4[/"replace(str(?dcoord),'Point\((.*) (.*)\)','$1')"/]
v7 --o bind4
bind4 --as--o v12
bind5[/"replace(str(?dcoord),'Point\((.*) (.*)\)','$2')"/]
v7 --o bind5
bind5 --as--o v13