query-1172b4afc911bf6eedc538e2fcc6d579

rq turtle/ttl

SWIB20 institution map participants from these institutions. SWIB20Federated query, using a custom set of instition items with the number of

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
#
# SWIB20 participants' institutions, mapped to Wikidata and enriched from there
#
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
#
# from possibly multi-valued fields, use an arbitrary value
select distinct ?item ?itemLabel (sample(?logo1) as ?logo) (sample(?img) as ?image) (sample(?pos) as ?coord) ?participants
where {
  # institutions' items and count of participants from custom WDQS-enabled endpoint
  service <http://zbw.eu/beta/sparql/econ_corp/query> {
    ?item zbwext:swib20participants ?count .
    bind(concat(str(?count), ' participant', if(?count > 1, 's', '')) as ?participants)
  }
  optional { ?item wdt:P18 ?img . }
  optional { ?item wdt:P154 ?logo1 . }
  optional { ?item wdt:P625 ?pos1 . }
  optional { ?item wdt:P159/wdt:P625 ?pos2 . }
  optional { ?item wdt:P131/wdt:P625 ?pos3 . }
  optional { ?item wdt:P17/wdt:P625 ?pos4 . }
  # use the most precise position
  bind(coalesce(?pos1, ?pos2, ?pos3, ?pos4) as ?pos)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE],de,fr,es". }
}
group by ?item ?itemLabel ?participants

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v13("?coord") v2("?count") v12("?image") v4("?img"):::projected v1("?item"):::projected v11("?logo") v5("?logo1"):::projected v3("?participants"):::projected v10("?pos"):::projected v6("?pos1") v7("?pos2") v8("?pos3") v9("?pos4") a1((" ")) a2((" ")) a3((" ")) c10(["bd:serviceParam"]):::iri c12(["en,#91;AUTO_LANGUAGE#93;,de,fr,es"]):::literal subgraph s1["http://zbw.eu/beta/sparql/econ_corp/query"] style s1 stroke-width:4px; v1 --http://zbw.eu/namespaces/zbw-extensions/swib20participants--> v2 bind0[/"concat(str(?count),' participant',if(?count > '1^^xsd:integer','s',''))"/] v2 --o bind0 bind0 --as--o v3 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P18".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P154".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P625".-> v6 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P159".-> a1 a1 --"wdt:P625"--> v7 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> a2 a2 --"wdt:P625"--> v8 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P17".-> a3 a3 --"wdt:P625"--> v9 end bind1[/"?pos1?pos2?pos3?pos4"/] v6 --o bind1 v7 --o bind1 v8 --o bind1 v9 --o bind1 bind1 --as--o v10 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind5[/"sample(?logo1)"/] v5 --o bind5 bind5 --as--o v11 bind6[/"sample(?img)"/] v4 --o bind6 bind6 --as--o v12 bind7[/"sample(?pos)"/] v10 --o bind7 bind7 --as--o v13