query-e4df1d5ca1635a3301309d7dec5db46e

rq turtle/ttl

(66) Dream of the Red Chamber: graph of the Four Great Families' membersNo.66 (2021.11.25T1803 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 the Four Great Families' members in Dream of the Red Chamber
# also viewable as table
#defaultView:Graph
SELECT DISTINCT ?member ?memberLabel ?member_image ?family ?familyLabel ?family_image ?edgeLabel
WHERE {
  # ?family is instance of (P31) "subclass of (P279)" [ZeroOrMorePath (*)] fictional family (Q15331236)
  ?family wdt:P31/wdt:P279* wd:Q15331236;
          # ?family is part of (P361) the Four Great Families of Jinling (Q10564066)
          wdt:P361 wd:Q10564066.
  # ?member's family (P53) is ?family
  ?member wdt:P53 ?family.
  # get P53 (family)'s property label and allow it to appear on graph edge
  ?edge wikibase:directClaim wdt:P53;
        a wikibase:Property
  # optional: show ?member's image (P18) as ?member_image, which appears directly in graph, and as link in table
  OPTIONAL {?member wdt:P18 ?member_image}
  # optional: show ?family's image (P18) as ?family_image, which appears directly in graph, and as link in table
  OPTIONAL {?family wdt:P18 ?family_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; v3("?edge") v1("?family"):::projected v5("?family_image"):::projected v2("?member"):::projected v4("?member_image"):::projected a1((" ")) c5(["wd:Q10564066"]):::iri c9(["wikibase:Property"]):::iri c6(["wdt:P53"]):::iri c12(["bd:serviceParam"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q15331236"]):::iri v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P361"--> c5 v2 -->c6--> v1 v3 --"wikibase:directClaim"--> c6 v3 --"a"--> c9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P18".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P18".-> v5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end