query-c72a0bd59d2e88379a39c0d228f9d781

rq turtle/ttl

Heads of stateper Wikidata query. The base set is derived from a federated query to the PM20 endpoint, because the "field of activity" property is up to now not completely migrated to Wikidata.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX schema: <http://schema.org/>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
#
select distinct ?item ?itemLabel ?pm20 ?viewer ?workCount
where {
  # get the basic set of persons with "field of activity"
  # "Staatsoberhaupt" from PM20 endpoint
  service <http://zbw.eu/beta/sparql/pm20/query> {
    ?pm20 zbwext:activity/schema:about "Head of state"@en .
    bind(strafter(str(?pm20), 'http://purl.org/pressemappe20/folder/') as ?pm20Id)
  }
  ?item wdt:P4293 ?pm20Id .
  #
  # restrict to items with online accessible articles
  ?item p:P4293/pq:P5592 ?workCount .
  filter(?workCount > 0)
  # viewer link
  bind(substr(?pm20Id, 4, 4) as ?numStub)
  bind(substr(?pm20Id, 4, 6) as ?num)
  bind(uri(concat('http://dfg-viewer.de/show/?tx_dlf[id]=http://zbw.eu/beta/pm20mets/', ?numStub, 'xx/', ?num, '.xml')) as ?viewer)
  # add labels
  service wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, de, fr, es, nl, pl, ru" . }
}
order by ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?item"):::projected v1("?itemLabel"):::projected v7("?num") v6("?numStub") v3("?pm20"):::projected v4("?pm20Id") v8("?viewer"):::projected v2("?workCount"):::projected a1((" ")) a2((" ")) c5([sHead of state^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>"]):::literal c12(["#91;AUTO_LANGUAGE#93;, en, de, fr, es, nl, pl, ru"]):::literal c10(["bd:serviceParam"]):::iri f0[["?workCount > '0^^xsd:integer'"]] f0 --> v2 subgraph s1["http://zbw.eu/beta/sparql/pm20/query"] style s1 stroke-width:4px; v3 --http://zbw.eu/namespaces/zbw-extensions/activity--> a1 a1 --"schema:about"--> c5 bind1[/"substring-after(str(?pm20),'http://purl.org/pressemappe20/folder/')"/] v3 --o bind1 bind1 --as--o v4 end v5 --"p:direct/P4293"--> v4 v5 --"p:P4293"--> a2 a2 --"p:qualifier/P5592"--> v2 bind2[/"substring(?pm20Id,'4^^xsd:integer','4^^xsd:integer')"/] v4 --o bind2 bind2 --as--o v6 bind3[/"substring(?pm20Id,'4^^xsd:integer','6^^xsd:integer')"/] v4 --o bind3 bind3 --as--o v7 bind4[/"concat('http://dfg-viewer.de/show/?tx_dlf#91;id#93;=http://zbw.eu/beta/pm20mets/',?numStub,'xx/',?num,'.xml')"/] v6 --o bind4 v7 --o bind4 bind4 --as--o v8 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c10 --"wikibase:language"--> c12 end