query-53e891324d8820750ecbba7f450ca3d9

rq turtle/ttl

Propertiesauthor (P50)instance of (P31)image (P18)publication date (P577)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?workLabel ?pubdate ?pubdatePrecision ?image ?typelabel ?english  
(URI(CONCAT("https://tools.wmflabs.org/reasonator/?q=", SUBSTR(STR(?work),32) )) as ?reasonator) #build a reasonator link
(IF(BOUND(?english), ?english, ?reasonator) as ?link) # link to English Wikipedia article, if available
WHERE {
?work wdt:P50 wd:Q9068; # author: Voltaire
   wdt:P31 ?type; # What is the work? poem, play, historical work etc.? 
   p:P577/psv:P577 ?pubdateStatementNode
MINUS {?work wdt:P31 wd:Q3331189} # exclude editions
MINUS {?work wdt:P31 wd:Q105420} # exclude anthologies
?pubdateStatementNode wikibase:timeValue ?pubdate ;
   wikibase:timePrecision ?pubdatePrecision # get precision of the publication date
OPTIONAL {?work wdt:P18 ?image}
OPTIONAL{ ?english schema:about ?work ; schema:isPartOf <https://en.wikipedia.org/> }
SERVICE wikibase:label {bd:serviceParam wikibase:language "fr,en,de"} # Prefer labels in French but fall back to English and German
?type rdfs:label ?typelabel FILTER(lang(?typelabel) ="en") # English labels for the types
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?english"):::projected v7("?image"):::projected v10("?link") v5("?pubdate"):::projected v6("?pubdatePrecision"):::projected v4("?pubdateStatementNode") v9("?reasonator"):::projected v3("?type") v1("?typelabel"):::projected v2("?work"):::projected a1((" ")) c7(["wd:Q3331189"]):::iri c8(["wd:Q105420"]):::iri c3(["wd:Q9068"]):::iri c18(["fr,en,de"]):::literal c14([https://en.wikipedia.org/]):::iri c16(["bd:serviceParam"]):::iri f0[["?typelabel = 'en'"]] f0 --> v1 v2 --"p:direct/P50"--> c3 v2 --"p:direct/P31"--> v3 v2 --"p:P577"--> a1 a1 --"p:statement/value/P577"--> v4 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> c7 end subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> c8 end v4 --"wikibase:timeValue"--> v5 v4 --"wikibase:timePrecision"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P18".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v8 -."schema:about".-> v2 v8 --"schema:isPartOf"--> c14 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c16 --"wikibase:language"--> c18 end v3 --"rdfs:label"--> v1 bind3[/"concat('https://tools.wmflabs.org/reasonator/?q=',substring(str(?work),'32^^xsd:integer'))"/] v2 --o bind3 bind3 --as--o v9 bind4[/"if(bound(?english),?english,?reasonator)"/] v8 --o bind4 v9 --o bind4 bind4 --as--o v10