query-f9c8b89704df1960de0195aaea35c0d8

rq turtle/ttl

works which were published more than 95 years ago and whose author died more than 100 years ago

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
SELECT ?item ?itemLabel ?mdod where
{
   {
select ?item (max(?dod) as ?mdod) where  
{ # look through all the authors and other creators of the work and look up their date of death, than find the latest

{ select DISTINCT ?item WHERE 
  {
    # look for items of type "work" or "data" (or children)
    ?item wdt:P31/wdt:P279* ?pq . 
    VALUES ?pq { wd:Q386724  wd:Q42848 } 
    # get date of publication and make sure is before 1924
    ?item wdt:P577 ?dop . 

    FILTER (?dop < "1925-00-00T00:00:01"^^xsd:dateTime)
    FILTER NOT EXISTS { ?item wdt:P6216 [] }  # item does not have P6216 yet
  } } 
  ?item wdt:P50|wdt:P170|wdt:P655|wdt:P84|wdt:P110|wdt:P287|wdt:P98|wdt:P86|wdt:P87|wdt:p57|wdt:P676 ?creator .
  ?creator wdt:P570 ?dod .
} group by ?item  }  
  FILTER(?mdod < "1918-00-00T00:00:00"^^xsd:dateTime) . # make sure last creator date of death is before 1918
  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; v5("?creator") v6("?dod") v3("?dop") v2("?item"):::projected v7("?mdod"):::projected v5("?pq") a1((" ")) a2((" ")) c20(["bd:serviceParam"]):::iri c22(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?mdod < '1918-00-00T00:00:00^^xsd:dateTime'"]] f0 --> v7 f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 --"wdt:P6216"--> e0a1 e0v1("?item"):::projected e0a1((" ")):::projected end f1--EXISTS--> f1e0 f1 --> v2 f1 --> c2 f1 --> a1 v2 --"wdt:P6216"--> a1 f2[["?dop < '1925-00-00T00:00:01^^xsd:dateTime'"]] f2 --> v3 v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> v5 bind3[/VALUES ?pq/] bind3-->v5 bind30(["wd:Q386724"]) bind30 --> bind3 bind31(["wd:Q42848"]) bind31 --> bind3 v2 --"wdt:P577"--> v3 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; 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; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; subgraph union5[" Union "] subgraph union5l[" "] style union5l fill:#abf,stroke-dasharray: 3 3; subgraph union6[" Union "] subgraph union6l[" "] style union6l fill:#abf,stroke-dasharray: 3 3; subgraph union7[" Union "] subgraph union7l[" "] style union7l fill:#abf,stroke-dasharray: 3 3; subgraph union8[" Union "] subgraph union8l[" "] style union8l fill:#abf,stroke-dasharray: 3 3; subgraph union9[" Union "] subgraph union9l[" "] style union9l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P676"--> v5 end subgraph union9r[" "] style union9r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:p57"--> v5 end union9r <== or ==> union9l end end subgraph union8r[" "] style union8r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P87"--> v5 end union8r <== or ==> union8l end end subgraph union7r[" "] style union7r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P86"--> v5 end union7r <== or ==> union7l end end subgraph union6r[" "] style union6r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P98"--> v5 end union6r <== or ==> union6l end end subgraph union5r[" "] style union5r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P287"--> v5 end union5r <== or ==> union5l end end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P110"--> v5 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P84"--> v5 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P655"--> v5 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P170"--> v5 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P50"--> v5 end union0r <== or ==> union0l end v5 --"wdt:P570"--> v6 bind5[/"max(?dod)"/] v6 --o bind5 bind5 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c20 --"wikibase:language"--> c22 end