query-7a6984594c16ffbc3eeaed718ebd4184

rq turtle/ttl

Display geoshapes with color scale based on a calculated percentage but it is definitely above my competencies. Could someone help me please? this query, I'd like to display a map with a color scale based on this percentage. I tried to adapt (P3896)geoshape The following query returns (when there is no time out) the percentage of geolocated churches by department in France. 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 ?dep ?INSEE ?depLabel ?itemCount(ROUND((IF(?_withCoord > ?itemCount, ?itemCount, ?_withCoord) / ?itemCount) * 100 * 100) / 100 AS ?withCoord) 
WHERE {
  {
    SELECT ?dep (COUNT(DISTINCT ?item) AS ?itemCount) (COUNT(DISTINCT ?coord) AS ?_withCoord) WHERE {

      ?item wdt:P131+ wd:Q142;
             wdt:P31/wdt:P279* wd:Q16970;
             wdt:P131 ?commune .
      ?commune p:P131 ?stmt .
      ?stmt ps:P131 ?dep .
      MINUS { ?stmt pq:P582 [] } .
      ?dep wdt:P2586 [] .
      OPTIONAL { ?item wdt:P625 ?coord } .
    } GROUP BY ?dep
  } .
  ?dep wdt:P2586 ?INSEE .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } .
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?INSEE"):::projected v7("?_withCoord"):::projected v2("?commune") v5("?coord") v4("?dep"):::projected v1("?item") v6("?itemCount"):::projected v3("?stmt") v9("?withCoord") a2((" ")) a3((" ")) a1((" ")) c14(["fr"]):::literal c12(["bd:serviceParam"]):::iri c5(["wd:Q16970"]):::iri c2(["wd:Q142"]):::iri v1 --"p:direct/P131"--> c2 v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 v1 --"p:direct/P131"--> v2 v2 --"p:P131"--> v3 v3 --"p:statement/P131"--> v4 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v3 --"p:qualifier/P582"--> a2 end v4 --"p:direct/P2586"--> a3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P625".-> v5 end bind3[/"count(?item)"/] v1 --o bind3 bind3 --as--o v6 bind4[/"count(?coord)"/] v5 --o bind4 bind4 --as--o v7 v4 --"p:direct/P2586"--> v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind5[/"numeric-round(if(?_withCoord > ?itemCount,?itemCount,?_withCoord) / ?itemCount * '100^^xsd:integer' * '100^^xsd:integer') / '100^^xsd:integer'"/] v7 --o bind5 v6 --o bind5 bind5 --as--o v9