query-3a946165e4c7865ec6b40be29e179d61

rq turtle/ttl

(46) Graph of Y-chromosomal relatives through inverse path: JesusNo.46 (2020.07.20T1731 created)

Use at

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 Jesus's Y-chromosomal relatives through inverse path
# also viewable as table
### Note: In comparison with the previous query "Graph of Y-chromosomal relatives: Jesus",
### this query uses inverse path (^) of father (P22) so that one line is saved.
#defaultView:Graph
SELECT ?Y ?YLabel ?birthdate ?image ?father ?fatherLabel ?edgeLabel
WHERE {
  # define ?Y as Jesus (Q302)'s any father (P22) or father of (^P22)'s father or father of's...
  wd:Q302 (wdt:P22|^wdt:P22)* ?Y.
  # limit ?Y's gender (P21) to male (Q6581097)
  ?Y wdt:P21 wd:Q6581097
  # optional: define ?Y's father (P22) as ?father
  OPTIONAL {?Y wdt:P22 ?father.
            # get P22 (father)'s property label and allow it to appear on graph edge
            ?edge wikibase:directClaim wdt:P22;
               a wikibase:Property}
  # optional: show ?Y's birthdate (P569), which only appears in table, not graph
  OPTIONAL {?Y wdt:P569 ?birthdate}
  # optional: show ?Y's image (P18), which appears directly in graph, and as link in table
  OPTIONAL {?Y wdt:P18 ?image}
  # 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("?Y"):::projected v4("?birthdate"):::projected v3("?edge") v2("?father"):::projected v5("?image"):::projected c7(["wikibase:Property"]):::iri c4(["wd:Q6581097"]):::iri c1(["wd:Q302"]):::iri c2(["wdt:P22"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 -->c2--> c1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; c1 -->c2--> v1 end union0r <== or ==> union0l end v1 --"wdt:P21"--> c4 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