query-d800f334951045f24fe3ecaf369bb8e8
ImageGrid with a default picture? : (P18)image Hello, I am trying to build an imageGrid for a list of people but all the entries don't have a
Use at
- https://query.wikidata.org/sparql
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#>
SELECT distinct ?person ?personLabel (YEAR(?date) as ?year) (SAMPLE(?picture) as ?picture)
WHERE
{
?person p:P166 ?distinction.
?distinction ps:P166 wd:Q55455135 .
?distinction pq:P585 ?date .
optional {?person wdt:P18 ?picture }
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;
v4("?date"):::projected
v3("?distinction")
v2("?person"):::projected
v6("?picture"):::projected
v6("?year")
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q55455135"]):::iri
v2 --"p:P166"--> v3
v3 --"p:statement/P166"--> c3
v3 --"p:qualifier/P585"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P18".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind1[/"year-from-dateTime(?date)"/]
v4 --o bind1
bind1 --as--o v6
bind2[/"sample(?picture)"/]
v6 --o bind2
bind2 --as--o v6