query-7125a9cf85d5b847137e95510eaa5953
(38) Graph of extended parent/child countries: the Qin dynastyNo.38 (2020.07.14T0939 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#>
# graph of the Qin dynasty's extended parent/child countries (also viewable as table)
# a country's parent and child countries are those that this country replaces and is replaced by
# a country's extended parent/child countries are all the ones on this country's parent/child lines
#defaultView:Graph
SELECT DISTINCT ?country ?countryLabel ?successor ?successorLabel ?edgeLabel
WHERE {
# define ?country as the Qin dynasty (Q7183)'s extended parent/child countries, i.e., Q7183's any replaces (P1365) or replaced by (P1366)'s replaces or replaced by...
wd:Q7183 (wdt:P1365|wdt:P1366)* ?country.
# ?country is instance of (P31) any subclass of (/wdt:P279*) ?x
?country wdt:P31/wdt:P279* ?x
# define ?x as country (Q6256) and historical country (Q3024240)
VALUES ?x {wd:Q6256 wd:Q3024240}
# optional: show ?country's replaced by (P1366) as ?successor
OPTIONAL {?country wdt:P1366 ?successor.
# ?successor is instance of (P31) any subclass of (/wdt:P279*) ?x
?successor wdt:P31/wdt:P279* ?x.
# get P1366 (replaced by)'s property label and allow it to appear on graph edge
?edge wikibase:directClaim wdt:P1366;
a wikibase:Property}
# show label in auto language as default, and English when no default label exists
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?country"):::projected
v4("?edge")
v3("?successor"):::projected
v3("?x")
a1((" "))
a2((" "))
c1(["wd:Q7183"]):::iri
c10(["bd:serviceParam"]):::iri
c8(["wikibase:Property"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wdt:P1366"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
c1 -->c3--> v1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
c1 --"wdt:P1365"--> v1
end
union0r <== or ==> union0l
end
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> v3
bind0[/VALUES ?x/]
bind0-->v3
bind00(["wd:Q6256"])
bind00 --> bind0
bind01(["wd:Q3024240"])
bind01 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -->c3--> v3
v3 -."wdt:P31".-> a2
a2 --"wdt:P279"--> v3
v4 --"wikibase:directClaim"--> c3
v4 --"a"--> c8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end