query-17b07cc56f03d1d37bf8a6d4c219b556
(53) Twenty-Six Histories: map of residences and birth/death placesNo.53 (2020.10.09T1521 created)
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#>
# residences and birth/death places in the Twenty-Six Histories
# viewed as map, layered by ?edgeLabel (replaceable by ?bookLabel or ?genreLabel)
#defaultView:Map{"layer":"?edgeLabel"}
# also viewable as table, graph, and image grid
SELECT DISTINCT ?person ?personLabel ?personDescription ?image ?bookLabel ?volume ?partLabel ?genreLabel ?birth_date ?death_date ?place ?placeLabel ?coord ?edgeLabel
WHERE {
# define ?book specifically as:
### Note: Certain books can be removed from the list so that a map for one or some specific books can be generated.
# Records of the Grand Historian (Q272530), Book of Han (Q846905), Book of the Later Han (Q430428), Records of the Three Kingdoms (Q247318), Book of Jin (Q1154753)
# Book of Song (Q1143142), Book of Southern Qi (Q1192857), Book of Liang (Q1285767), Book of Chen (Q1275744), Book of Wei (Q1269357)
VALUES ?book {wd:Q272530 wd:Q846905 wd:Q430428 wd:Q247318 wd:Q1154753 wd:Q1143142 wd:Q1192857 wd:Q1285767 wd:Q1275744 wd:Q1269357
# Book of Northern Qi (Q1247505), Book of Zhou (Q1285731), Book of Sui (Q1156924), History of Southern Dynasties (Q1137686), History of Northern Dynasties (Q1188548)
# Old Book of Tang (Q1146980), New Book of Tang (Q386073), Old History of the Five Dynasties (Q1333316), New History of the Five Dynasties (Q919488), History of Song (Q1147260)
wd:Q1247505 wd:Q1285731 wd:Q1156924 wd:Q1137686 wd:Q1188548 wd:Q1146980 wd:Q386073 wd:Q1333316 wd:Q919488 wd:Q1147260
# History of Liao (Q1188539), History of Jin (Q637035), History of Yuan (Q1345223), History of Ming (Q28763)
# New History of Yuan (Q1053256), Draft History of Qing (Q1374339)
wd:Q1188539 wd:Q637035 wd:Q1345223 wd:Q28763 wd:Q1053256 wd:Q1374339}
# optional: show ?part, which is part of (P361) or published in (P1433) [OneOrMorePath (+)] ?book
OPTIONAL {?part (wdt:P361|wdt:P1433)+ ?book;
# ?part's genre (P136) is ?genre
wdt:P136 ?genre;
# ?part's main subject (P921) is ?person
wdt:P921 ?person
# define ?genre as benji (Q1872234), liezhuan (Q2252176) and shijia (Q14333796)
VALUES ?genre {wd:Q1872234 wd:Q2252176 wd:Q14333796}
# ?person is instance of (P31) human (Q5)
?person wdt:P31 wd:Q5
# optional: show ?part's volume (P478) as ?volume
OPTIONAL {?part wdt:P478 ?volume}
# optional: show ?person's image (P18) as ?image
OPTIONAL {?person wdt:P18 ?image}
# optional: show ?person's birth date (P569) as ?birth_date
OPTIONAL {?person wdt:P569 ?birth_date}
# optional: show ?person's death date (P570) as ?death_date
OPTIONAL {?person wdt:P570 ?death_date}
# optional: show ?person's birth place (P19) or death place (P20) or residence (Q699405) as ?place
### Note: Certain properties can be removed so that a map for a specific property can be generated when layered by ?bookLabel or ?genreLabel.
OPTIONAL {?person (wdt:P19|wdt:P20|wd:Q699405) ?place
# to avoid showing any other relation
# define ?relation as birth place (P19) or death place (P20) or residence (Q699405)
VALUES ?relation {wdt:P19 wdt:P20 wd:Q699405}
# ?relation is from ?person to ?place
?person ?relation ?place.
# get ?relation's property label and allow it to appear on graph edge
?edge wikibase:directClaim ?relation;
a wikibase:Property
# optional: show ?place's coordinate location (P625) as ?coord
OPTIONAL {?place wdt:P625 ?coord} } }
# show label in auto language as default, and English when no default label exists
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}
}
# order layer by ?edgeLabel (replaceable by ?bookLabel or ?genreLabel)
ORDER BY ?edgeLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?birth_date"):::projected
v2("?book")
v13("?coord"):::projected
v9("?death_date"):::projected
v12("?edge")
v1("?edgeLabel"):::projected
v6("?genre")
v7("?image"):::projected
v3("?part")
v5("?person"):::projected
v10("?place"):::projected
v11("?relation")
v6("?volume"):::projected
c16(["wikibase:Property"]):::iri
c19(["bd:serviceParam"]):::iri
c6(["wd:Q5"]):::iri
c21(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?book/]
bind0-->v2
bind00(["wd:Q272530"])
bind00 --> bind0
bind01(["wd:Q846905"])
bind01 --> bind0
bind02(["wd:Q430428"])
bind02 --> bind0
bind03(["wd:Q247318"])
bind03 --> bind0
bind04(["wd:Q1154753"])
bind04 --> bind0
bind05(["wd:Q1143142"])
bind05 --> bind0
bind06(["wd:Q1192857"])
bind06 --> bind0
bind07(["wd:Q1285767"])
bind07 --> bind0
bind08(["wd:Q1275744"])
bind08 --> bind0
bind09(["wd:Q1269357"])
bind09 --> bind0
bind010(["wd:Q1247505"])
bind010 --> bind0
bind011(["wd:Q1285731"])
bind011 --> bind0
bind012(["wd:Q1156924"])
bind012 --> bind0
bind013(["wd:Q1137686"])
bind013 --> bind0
bind014(["wd:Q1188548"])
bind014 --> bind0
bind015(["wd:Q1146980"])
bind015 --> bind0
bind016(["wd:Q386073"])
bind016 --> bind0
bind017(["wd:Q1333316"])
bind017 --> bind0
bind018(["wd:Q919488"])
bind018 --> bind0
bind019(["wd:Q1147260"])
bind019 --> bind0
bind020(["wd:Q1188539"])
bind020 --> bind0
bind021(["wd:Q637035"])
bind021 --> bind0
bind022(["wd:Q1345223"])
bind022 --> bind0
bind023(["wd:Q28763"])
bind023 --> bind0
bind024(["wd:Q1053256"])
bind024 --> bind0
bind025(["wd:Q1374339"])
bind025 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 -."wdt:P1433".-> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P361"--> v2
end
union0r <== or ==> union0l
end
v3 --"wdt:P136"--> v6
v3 --"wdt:P921"--> v5
bind1[/VALUES ?genre/]
bind1-->v6
bind10(["wd:Q1872234"])
bind10 --> bind1
bind11(["wd:Q2252176"])
bind11 --> bind1
bind12(["wd:Q14333796"])
bind12 --> bind1
v5 --"wdt:P31"--> c6
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P478".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P18".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P569".-> v8
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P570".-> v9
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v5 -."wd:Q699405".-> v10
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P20"--> v10
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P19"--> v10
end
union1r <== or ==> union1l
end
bind2[/VALUES ?relation/]
bind2-->v11
bind20(["wdt:P19"])
bind20 --> bind2
bind21(["wdt:P20"])
bind21 --> bind2
bind22(["wd:Q699405"])
bind22 --> bind2
v5 -->v11--> v10
v12 --"wikibase:directClaim"--> v11
v12 --"a"--> c16
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v10 -."wdt:P625".-> v13
end
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c19 --"wikibase:language"--> c21
end