query-a237639de387b60e0374d015f8dd1ed1

rq turtle/ttl

(14) Graph of lineal descendants: Jupiter (ancient Roman deity)No.14 (2019.11.08T0002 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#>
# find lineal descendants of Jupiter (ancient Roman deity)
#defaultView:Graph
SELECT DISTINCT ?descendant ?descendantLabel ?birthdate ?image ?parent ?parentLabel ?edgeLabel
WHERE {
  # define ?descendant as Jupiter (Q4649)'s any child (P40)'s child's...
  wd:Q4649 wdt:P40* ?descendant
  # optional: define ?descendant's father (P22) or mother (P25) as ?parent
  OPTIONAL {?descendant (wdt:P22|wdt:P25) ?parent.
           # To eliminate lineal descendant's parent who is not Jupiter's lineal descendant,
           # require that ?parent's any father (P22) or mother (P25)'s father or mother's... is Jupiter (Q4649)
           ?parent (wdt:P22|wdt:P25)* wd:Q4649
           # To avoid showing any other relation than P22 (father) and P25 (mother),
           # define ?relation as P22 or P25
           VALUES ?relation {wdt:P22 wdt:P25}
           # and ?relation is from ?descendant to ?parent,
           ?descendant ?relation ?parent.
           # then show ?relation on graph edges
           ?edge wikibase:directClaim ?relation;
               a wikibase:Property}
  # optional: show ?descendant's birthdate (P569), which only appears in table, not graph 
  OPTIONAL {?descendant wdt:P569 ?birthdate}
  # optional: show ?descendant's image (P18), which appears directly in graph, and as link in table
  OPTIONAL {?descendant 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; v5("?birthdate"):::projected v1("?descendant"):::projected v4("?edge") v6("?image"):::projected v2("?parent"):::projected v3("?relation") c1(["wd:Q4649"]):::iri c7(["wikibase:Property"]):::iri c13(["zh-hans,en"]):::literal c11(["bd:serviceParam"]):::iri c1 --"wdt:P40"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 -."wdt:P25".-> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P22"--> v2 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P25"--> c1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P22"--> c1 end union1r <== or ==> union1l end bind0[/VALUES ?relation/] bind0-->v3 bind00(["wdt:P22"]) bind00 --> bind0 bind01(["wdt:P25"]) bind01 --> bind0 v1 -->v3--> v2 v4 --"wikibase:directClaim"--> v3 v4 --"a"--> c7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P569".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P18".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end