query-38910d605c8a5937db48bcd6471143bc

rq turtle/ttl

Calculate percentage. (P625)coordinate location This query displays the number of churches by region in France. I'd like to add another column with the percentage of churches with

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?INSEE ?itemLabel (CONCAT("[[Wikidata:WikiProject France/Églises/",?INSEE,"\u007C",?itemLabel,"]]") AS ?LIEN) ?depCount
WHERE { {
SELECT ?item ?INSEE (COUNT(?item) AS ?depCount)
WHERE 
{
SELECT DISTINCT ?item2 ?item ?INSEE
WHERE {

  ?item2 wdt:P131+ wd:Q142.
  ?item2 (wdt:P31/wdt:P279*) wd:Q16970.
  ?item2 wdt:P131 ?commune.
  ?commune p:P131 ?stmt . ?stmt ps:P131 ?item . OPTIONAL { ?stmt pq:P582 ?end } FILTER (!BOUND(?end)) .
  ?item wdt:P2586 ?INSEE
       }
}
  GROUP BY ?item ?INSEE
}         
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". } }       
ORDER BY ?INSEE

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?INSEE"):::projected v8("?LIEN") v4("?commune") v7("?depCount"):::projected v2("?end") v6("?item"):::projected v3("?item2") v5("?stmt") a1((" ")) c13(["fr"]):::literal c11(["bd:serviceParam"]):::iri c5(["wd:Q16970"]):::iri c2(["wd:Q142"]):::iri f0[["not bound(?end)"]] f0 --> v2 v3 --"p:direct/P131"--> c2 v3 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 v3 --"p:direct/P131"--> v4 v4 --"p:P131"--> v5 v5 --"p:statement/P131"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P582".-> v2 end v6 --"p:direct/P2586"--> v1 bind2[/"count(?item)"/] v6 --o bind2 bind2 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind3[/"concat('#91;#91;Wikidata:WikiProject France/Églises/',?INSEE,'|',?itemLabel,'#93;#93;')"/] v1 --o bind3 null --o bind3 bind3 --as--o v8