query-f342523e1fdf7604282b2f5d286abe3c

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?institution ?institutionLabel (COUNT(?item) AS ?total) (GROUP_CONCAT(DISTINCT(?LieuLabel); separator=", ") as ?Lieux) WHERE 
{
  ?institution wdt:P31/wdt:P279* wd:Q166118;
               wdt:P17 wd:Q142.
  OPTIONAL {?institution wdt:P131 ?Lieu.
    OPTIONAL {?Lieu rdfs:label ??LieuLabel. filter(lang(?LieuLabel)="fr") }       
           }
  OPTIONAL {
      ?item wdt:P485 ?institution .
           }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}        
} group by ?institution ?institutionLabel ORDER BY DESC (?total) ?institutionLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?Lieu") v4("?LieuLabel"):::projected v7("?Lieux") v3("?institution"):::projected v2("?institutionLabel"):::projected v6("?item"):::projected v7("?total") a1((" ")) c3(["wd:Q166118"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q142"]):::iri v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v3 --"wdt:P17"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P131".-> v5 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v5 -."rdfs:label".-> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end end end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P485".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind2[/"count(?item)"/] v6 --o bind2 bind2 --as--o v7 bind3[/"?LieuLabel"/] v4 --o bind3 bind3 --as--o v7