query-d3ab8b828dceb3c88aeb0d792f65e037

rq turtle/ttl

PropertiesPM20 folder ID (P4293)PM20 film section ID (P11822)inception (P571)dissolved, abolished or demolished date (P576)headquarters location (P159)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?wd ?wdLabel ?inFunction (group_concat(?hqLabel; separator='; ') as ?headquarter) ?pm20 ?hint
where {
  select ?wd ?wdLabel ?inFunction ?hqLabel ?pm20 ?hint
  where {
    {
      ?wd wdt:P4293 ?pm20Id .
      filter(isLiteral(?pm20Id))
      filter(strstarts(?pm20Id, 'co'))
    } union {
      ?wd wdt:P11822 ?sectionId .
      filter(isLiteral(?sectionId))
      filter(contains(?sectionId, '/co/'))
    }
    optional {
      ?wd wdt:P571 ?start .
    }
    optional {
      ?wd wdt:P576 ?end .
    }
    optional {
      ?wd wdt:P159 ?hq .
    }
    bind(concat(coalesce(str(year(?start)), ''), coalesce(concat(' - ', str(year(?end))), '')) as ?inFunction)
    #
    bind(if(bound(?pm20Id), uri(concat('https://pm20.zbw.eu/folder/', ?pm20Id)), uri(concat('https://pm20.zbw.eu/film/', ?sectionId))) as ?pm20)
    bind(if(bound(?pm20Id), 'PM20 folder', 'PM20 microfilm (on premises only)') as ?hint)
    #
    service wikibase:label { bd:serviceParam wikibase:language "en,de,fr,es,it,nl,pt,pl,cs,sv" . }
  }
}
group by ?wd ?wdLabel ?inFunction ?pm20 ?hint
order by ?wdLabel
# query times out without limit
# as of 2023-07, there are 12755 results
limit 25000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?end") v12("?headquarter") v10("?hint"):::projected v7("?hq") v11("?hqLabel"):::projected v8("?inFunction"):::projected v9("?pm20"):::projected v2("?pm20Id") v4("?sectionId") v5("?start") v3("?wd"):::projected v1("?wdLabel"):::projected c9(["bd:serviceParam"]):::iri c11(["en,de,fr,es,it,nl,pt,pl,cs,sv"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["contains(?sectionId,'/co/')"]] f0 --> v4 f1[["isLiteral(?sectionId)"]] f1 --> v4 v3 --"wdt:P11822"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f2[["starts-with(?pm20Id,'co')"]] f2 --> v2 f3[["isLiteral(?pm20Id)"]] f3 --> v2 v3 --"wdt:P4293"--> v2 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P571".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P576".-> v6 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P159".-> v7 end bind4[/"concat(str(year-from-dateTime(?start))'',concat(' - ',str(year-from-dateTime(?end)))'')"/] v5 --o bind4 v6 --o bind4 bind4 --as--o v8 bind5[/"if(bound(?pm20Id),concat('https://pm20.zbw.eu/folder/',?pm20Id),concat('https://pm20.zbw.eu/film/',?sectionId))"/] v2 --o bind5 v4 --o bind5 bind5 --as--o v9 bind6[/"if(bound(?pm20Id),'PM20 folder','PM20 microfilm (on premises only)')"/] v2 --o bind6 bind6 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind8[/"?hqLabel"/] v11 --o bind8 bind8 --as--o v12