query-78efc74b91a40c4da46d494fd8796296

rq turtle/ttl

Propertiesdate of death (P570)publication date (P577)notable work (P800)image (P18)

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#>
#title: Timeline of François Arago
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

#defaultView:Timeline
SELECT DISTINCT ?timestamp ?entity ?relationLabel ?entityLabel (SAMPLE(?image) AS ?img) WHERE {
  BIND(wd:Q154353 AS ?person)
  {
    ?person ?property ?timestamp.
    ?entity wikibase:directClaim ?property.
    FILTER((DATATYPE(?timestamp)) = xsd:dateTime)
  }
  UNION
  {
    ?person ?entityToStatement ?statement.
    OPTIONAL {?person wdt:P570 ?dDate.}
    ?statement ?statementToQualifier ?timestamp.
    ?statement ?statementToValue ?entity.
    ?relation wikibase:statementProperty ?statementToValue.
    FILTER(REGEX(STR(?entityToStatement), "prop/P"))
    FILTER(REGEX(STR(?statementToQualifier), "prop/qualifier/P"))
    FILTER((DATATYPE(?timestamp)) = xsd:dateTime)
    BIND (IF(!BOUND(?dDate), now(), ?dDate) AS ?deathDate)
    FILTER(?timestamp <= ?deathDate)
  }
  UNION
  {
    BIND(wd:P50 AS ?relation)
    ?relation wikibase:directClaim ?property.
    ?entity ?property ?person.
    ?entity wdt:P577 ?timestamp.
    FILTER(NOT EXISTS { ?person wdt:P800 ?entity })
  }
  UNION
  {
    BIND(wd:P800 AS ?relation)
    ?relation wikibase:directClaim ?property.
    ?person ?property ?entity.
    ?entity wdt:P577 ?timestamp.
  }
  OPTIONAL { ?entity wdt:P18 ?image }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr" }
}
GROUP BY ?timestamp ?entity ?relationLabel ?entityLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?dDate") v12("?deathDate") v4("?entity"):::projected v7("?entityToStatement") v12("?image"):::projected v13("?img") v1("?person") v3("?property") v12("?relation") v8("?statement") v6("?statementToQualifier") v10("?statementToValue") v2("?timestamp"):::projected c11(["bd:serviceParam"]):::iri c13(["en,de,fr"]):::literal bind0[/"'wd:Q154353'"/] bind0 --as--o v1 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; bind1[/"'wd:P800'"/] bind1 --as--o v12 v12 --"wikibase:directClaim"--> v3 v1 -->v3--> v4 v4 --"wdt:P577"--> v2 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; f2[["not "]] subgraph f2e0["Exists Clause"] e0v1 --"wdt:P800"--> e0v2 e0v2("?entity"):::projected e0v1("?person"):::projected end f2--EXISTS--> f2e0 f2 --> v1 f2 --> c7 f2 --> v4 v1 --"wdt:P800"--> v4 bind3[/"'wd:P50'"/] bind3 --as--o v12 v12 --"wikibase:directClaim"--> v3 v4 -->v3--> v1 v4 --"wdt:P577"--> v2 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; f4[["?timestamp <= ?deathDate"]] f4 --> v2 f4 --> v12 f5[["?timestamp = 'xsd:dateTime'"]] f5 --> v2 f6[["regex(str(?statementToQualifier),'prop/qualifier/P')"]] f6 --> v6 f7[["regex(str(?entityToStatement),'prop/P')"]] f7 --> v7 v1 -->v7--> v8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P570".-> v9 end v8 -->v6--> v2 v8 -->v10--> v4 v12 --"wikibase:statementProperty"--> v10 bind8[/"if(not bound(?dDate),NOW(),?dDate)"/] v9 --o bind8 bind8 --as--o v12 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f9[["?timestamp = 'xsd:dateTime'"]] f9 --> v2 v1 -->v3--> v2 v4 --"wikibase:directClaim"--> v3 end union0r <== or ==> union0l end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P18".-> v12 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind11[/"sample(?image)"/] v12 --o bind11 bind11 --as--o v13