query-9a03cd79aedcc4c37b1816087294c907

rq turtle/ttl

Get data about people based on items connected through Commons sitelinksI don't expect to reuse this query much, or maybe ever, but the pattern for "get the person, either directly or through their category" is useful on Commons generally. Also, while I didn't think of this earlier, it wouldn't be that hard to directly input sitelinks.

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?subject ?birth ?death ?commonscat ?creatorpage


WHERE {
   { 
  SELECT ?subject WHERE {  
    VALUES ?item {wd:Q332331 wd:Q449885 wd:Q6264333}
    {
      ?item wdt:P31 wd:Q5.
      BIND (?item AS ?subject).
    } UNION {
      ?item wdt:P301 ?subject.
    }
  }
}
  OPTIONAL {?subject wdt:P569 ?birth.}
  OPTIONAL {?subject wdt:P570 ?death.}
  OPTIONAL {?subject wdt:P373 ?commonscat.}
  OPTIONAL {?subject wdt:P1472 ?creatorpage.}
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?birth"):::projected v5("?commonscat"):::projected v6("?creatorpage"):::projected v4("?death"):::projected v1("?item") v2("?subject"):::projected c2(["wd:Q5"]):::iri bind0[/VALUES ?item/] bind0-->v1 bind00(["wd:Q332331"]) bind00 --> bind0 bind01(["wd:Q449885"]) bind01 --> bind0 bind02(["wd:Q6264333"]) bind02 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P301"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c2 bind1[/"?item"/] v1 --o bind1 bind1 --as--o v2 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P569".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P570".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P373".-> v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P1472".-> v6 end