query-c8e437d223b6d1c18f1bb49db8f7f0d1
.on Mastodon and on TwitterOriginally posted
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?cartoon ?cartoonLabel (SAMPLE(?image_) AS ?image) (MAX(?date_) AS ?date) WHERE {
?cartoon wdt:P31/wdt:P279* wd:Q2916094.
OPTIONAL { ?cartoon wdt:P18 ?image_. }
OPTIONAL { ?cartoon wdt:P571|wdt:P577 ?date_. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?cartoon ?cartoonLabel
ORDER BY ?date
Query found at
- https://www.wikidata.org/wiki/User:TweetsFactsAndQueries/Queries/editorial_cartoons
- https://www.wikidata.org/wiki/Wikidata:Project_chat/Archive/2019/11
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?cartoon"):::projected
v6("?date")
v4("?date_"):::projected
v5("?image")
v3("?image_"):::projected
a1((" "))
c8(["bd:serviceParam"]):::iri
c3(["wd:Q2916094"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P18".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 -."wdt:P577".-> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P571"--> v4
end
union0r <== or ==> union0l
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
bind2[/"sample(?image_)"/]
v3 --o bind2
bind2 --as--o v5
bind3[/"max(?date_)"/]
v4 --o bind3
bind3 --as--o v6