query-dc1d59f1db9849bc23b7d1f035533ac9

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:ImageGrid
SELECT distinct ?person ?personLabel (YEAR(?date) as ?year) (SAMPLE(?pic) as ?pic)
WHERE 
{
  VALUES ?any_object_with_the_default_picture { wd:Q4115189 } #using the sandbox object for this demo, wd:Q157002 is another object with an image that can be used as a "placeholder" 
  ?person p:P166 ?distinction.
  ?distinction ps:P166 wd:Q55455135 .
  ?distinction pq:P585 ?date .
  optional {?person wdt:P18 ?picture }
  ?any_object_with_the_default_picture wdt:P18 ?defaultpic .
  BIND(IF(BOUND(?picture),?picture,?defaultpic) AS ?pic)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
group by ?person ?personLabel ?date
order by ?year

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?any_object_with_the_default_picture") v5("?date"):::projected v7("?defaultpic") v4("?distinction") v3("?person"):::projected v9("?pic"):::projected v6("?picture") v9("?year") c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q55455135"]):::iri bind0[/VALUES ?any_object_with_the_default_picture/] bind0-->v2 bind00(["wd:Q4115189"]) bind00 --> bind0 v3 --"p:P166"--> v4 v4 --"p:statement/P166"--> c3 v4 --"p:qualifier/P585"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P18".-> v6 end v2 --"p:direct/P18"--> v7 bind1[/"if(bound(?picture),?picture,?defaultpic)"/] v6 --o bind1 v7 --o bind1 bind1 --as--o v9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind3[/"year-from-dateTime(?date)"/] v5 --o bind3 bind3 --as--o v9 bind4[/"sample(?pic)"/] v9 --o bind4 bind4 --as--o v9