query-7acc5a41592c65e4d2c38cc9c498d14b

rq turtle/ttl

(16) Graph of gene pool (extended blood relatives) by only parent/child relation (no siblings): Jia BaoyuNo.16 (2019.11.08T2147 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#>
# for comparison, this query is same as the above one except that sibling relation is removed. 
#defaultView:Graph
SELECT ?gene ?geneLabel ?birthdate ?image ?relative ?relativeLabel ?edgeLabel
WHERE {
  # define ?gene as Jia Baoyu (Q8428650)'s any father (P22) or mother (P25) or child (P40)'s father or mother or child's...
  wd:Q8428650 (wdt:P22|wdt:P25|wdt:P40)* ?gene
  # optional: define ?gene's father (P22) or mother (P25) or child (P40) as ?relative
  optional {?gene (wdt:P22|wdt:P25|wdt:P40) ?relative
            # To avoid showing any other relation than relative relation
            # define ?relation as only father (P22) or mother (P25) or child (P40)
            VALUES ?relation {wdt:P22 wdt:P25 wdt:P40}
            # ?relation is from ?gene to ?relative
            ?gene ?relation ?relative.
            # show ?relation on graph edges
            ?edge wikibase:directClaim ?relation;
               a wikibase:Property}
  # optional: show ?gene's birthdate (P569), which only appears in table, not graph
  optional {?gene wdt:P569 ?birthdate}
  # optional: show ?gene's image (P18), which appears directly in graph, and as link in table
  optional {?gene 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 v4("?edge") v1("?gene"):::projected v6("?image"):::projected v3("?relation") v2("?relative"):::projected c7(["wikibase:Property"]):::iri c13(["zh-hans,en"]):::literal c1(["wd:Q8428650"]):::iri c11(["bd:serviceParam"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; c1 --"wdt:P40"--> v1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; c1 --"wdt:P25"--> v1 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; c1 --"wdt:P22"--> v1 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; v1 -."wdt:P40".-> v2 end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P25"--> v2 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P22"--> v2 end union2r <== or ==> union2l end bind0[/VALUES ?relation/] bind0-->v3 bind00(["wdt:P22"]) bind00 --> bind0 bind01(["wdt:P25"]) bind01 --> bind0 bind02(["wdt:P40"]) bind02 --> 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