query-492d495d686a5ccebab8188d282c78a4
Exhibitions with items from collection
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX target: <http://www.wikidata.org/entity/Q671384>
SELECT
?items
?start_date
?exhibition ?exhibitionLabel
(CONCAT("#exhibition/", SUBSTR(STR(?exhibition), 32)) AS ?exhibitionUrl)
?exhibitionDescription
?example_item ?example_itemLabel
WHERE {
{
SELECT
(COUNT(?item) AS ?items)
?exhibition
(SAMPLE(?item) AS ?example_item)
(xsd:date(MIN(?start_datetime)) AS ?start_date)
WHERE {
?item wdt:P195 target: ;
wdt:P608 ?exhibition .
OPTIONAL { ?exhibition wdt:P580 ?start_datetime }
}
GROUP BY ?exhibition
} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?items)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?_anon_42b5416610844a34809f33a099ae9de186883")
v6("?example_item"):::projected
v3("?exhibition"):::projected
v8("?exhibitionUrl")
v2("?item")
v6("?items"):::projected
v7("?start_date"):::projected
v4("?start_datetime")
c6(["bd:serviceParam"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2([http://www.wikidata.org/entity/Q671384]):::iri
v2 --"wdt:P195"--> c2
v2 --"wdt:P608"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P580".-> v4
end
bind3[/"min(?start_datetime)"/]
v4 --o bind3
bind3 --as--o v5
bind4[/"count(?item)"/]
v2 --o bind4
bind4 --as--o v6
bind5[/"sample(?item)"/]
v2 --o bind5
bind5 --as--o v6
bind6[/"http://www.w3.org/2001/XMLSchema#date()"/]
null --o bind6
bind6 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end
bind7[/"concat('#exhibition/',substring(str(?exhibition),'32^^xsd:integer'))"/]
v3 --o bind7
bind7 --as--o v8