query-ff39ccc2542331b6e9544f3a02a80ac2

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 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 (CONCAT(STR(ROUND((IF(?_withCoord > ?depCount, ?depCount, ?_withCoord) / ?depCount) * 100 * 100) / 100), "%") AS ?withCoord)
WHERE {
  {
    SELECT ?item (COUNT(DISTINCT ?item2) AS ?depCount) (COUNT(DISTINCT ?coord) AS ?_withCoord) WHERE {

      ?item2 wdt:P131+ wd:Q142;
             wdt:P31/wdt:P279* wd:Q16970;
             wdt:P131 ?commune .
      ?commune p:P131 ?stmt .
      ?stmt ps:P131 ?item .
      MINUS { ?stmt pq:P582 [] } .
      ?item wdt:P2586 [] .
      OPTIONAL { ?item2 wdt:P625 ?coord } .
    } GROUP BY ?item
  } .
  ?item wdt:P2586 ?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 v9("?LIEN") v8("?_withCoord"):::projected v3("?commune") v6("?coord") v7("?depCount"):::projected v5("?item"):::projected v2("?item2") v4("?stmt") v10("?withCoord") a2((" ")) a3((" ")) a1((" ")) c14(["fr"]):::literal c12(["bd:serviceParam"]):::iri c5(["wd:Q16970"]):::iri c2(["wd:Q142"]):::iri v2 --"p:direct/P131"--> c2 v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 v2 --"p:direct/P131"--> v3 v3 --"p:P131"--> v4 v4 --"p:statement/P131"--> v5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v4 --"p:qualifier/P582"--> a2 end v5 --"p:direct/P2586"--> a3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P625".-> v6 end bind3[/"count(?item2)"/] v2 --o bind3 bind3 --as--o v7 bind4[/"count(?coord)"/] v6 --o bind4 bind4 --as--o v8 v5 --"p:direct/P2586"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind5[/"concat('#91;#91;Wikidata:WikiProject France/Églises/',?INSEE,'|',?itemLabel,'#93;#93;')"/] v1 --o bind5 null --o bind5 bind5 --as--o v9 bind6[/"concat(str(numeric-round(if(?_withCoord > ?depCount,?depCount,?_withCoord) / ?depCount * '100^^xsd:integer' * '100^^xsd:integer') / '100^^xsd:integer'),'%')"/] v8 --o bind6 v7 --o bind6 bind6 --as--o v10