query-b757ec14dbdb580b269d02b9bf20b970
items with location BStGS or collection part of BStGS SELECT ?item ?itemLabel (GROUP_CONCAT(DISTINCT ?invno ; SEPARATOR=", ") AS ?invnos) ?collectionLabel ?locationLabel WHERE { { ?item wdt:P195 ?sub0 . ?sub0 wdt:P361 wd:Q812285 . } UNION { ?item wdt:P276 wd:Q812285 . } OPTIONAL { ?item wdt:P217 ?invno . } OPTIONAL { ?item wdt:P195 ?collection . } OPTIONAL { ?item wdt:P276 ?location . } FILTER NOT EXISTS { ?item wdt:P195 wd:Q812285 . } MINUS { ?item wdt:P31 wd:Q15206795 } # no exhibition rooms SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,it,es,pt,ca,la" . } } GROUP BY ?item ?itemLabel ?invnos ?collectionLabel ?locationLabel
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#>
# items with location BStGS or collection part of BStGS
SELECT
?item ?itemLabel
(GROUP_CONCAT(DISTINCT ?invno ; SEPARATOR=", ") AS ?invnos)
?collectionLabel ?locationLabel WHERE {
{
?item wdt:P195 ?sub0 .
?sub0 wdt:P361 wd:Q812285 .
} UNION {
?item wdt:P276 wd:Q812285 .
}
OPTIONAL { ?item wdt:P217 ?invno . }
OPTIONAL { ?item wdt:P195 ?collection . }
OPTIONAL { ?item wdt:P276 ?location . }
FILTER NOT EXISTS { ?item wdt:P195 wd:Q812285 . }
MINUS { ?item wdt:P31 wd:Q15206795 } # no exhibition rooms
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,it,es,pt,ca,la" . }
}
GROUP BY ?item ?itemLabel ?invnos ?collectionLabel ?locationLabel