query-dc56189bb8b38904db6fc3ec28f6f4a7
(11) Graph of patrilineal ancestors/descendants: Kublai KhanNo.11 (2019.11.07T1157 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#>
# find patrilineal ancestors and patrilineal descendants of Kublai Khan
#defaultView:Graph
SELECT DISTINCT ?paternal ?paternalLabel ?birthdate ?image ?father ?fatherLabel ?edgeLabel
WHERE {
# define ?paternal as Kublai Khan (Q7523)'s patrilineal ancestors (any father (P22)'s father's...),
{wd:Q7523 wdt:P22* ?paternal}
# OR patrilineal descendants (those whose any father (P22)'s father's... is Kublai Khan (Q7523))
UNION {?paternal wdt:P22* wd:Q7523;
# and gender (P21) is male (Q6581097)
wdt:P21 wd:Q6581097}
# optional: define ?paternal's father (P22) as ?father
OPTIONAL {?paternal wdt:P22 ?father.
# show father (P22) on graph edges
?edge wikibase:directClaim wdt:P22;
a wikibase:Property}
# optional: show ?paternal's birthdate (P569), which only appears in table, not graph
OPTIONAL {?paternal wdt:P569 ?birthdate}
# optional: show ?paternal's image (P18), which appears directly in graph, and as link in table
OPTIONAL {?paternal wdt:P18 ?image}
# show label in simplified Chinese (zh-hans) as default, and English when no default label exists
SERVICE wikibase:label { bd:serviceParam wikibase:language "zh-hans,en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?birthdate"):::projected
v3("?edge")
v2("?father"):::projected
v5("?image"):::projected
v1("?paternal"):::projected
c7(["wikibase:Property"]):::iri
c4(["wd:Q6581097"]):::iri
c13(["zh-hans,en"]):::literal
c2(["wdt:P22"]):::iri
c11(["bd:serviceParam"]):::iri
c1(["wd:Q7523"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 -->c2--> c1
v1 --"wdt:P21"--> c4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
c1 -->c2--> v1
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -->c2--> v2
v3 -."wikibase:directClaim".-> c2
v3 --"a"--> c7
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P569".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P18".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end