query-d3e3c5c83bf620eb8a57802df4fb1a7d

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 ?insee ?commune ?communeLabel
WHERE {
  ?commune p:P374 ?P374node .                 # existence code INSEE
    ?P374node ps:P374 ?insee .                  # valeur code INSEE
    FILTER NOT EXISTS {?P374node pq:P582 [] .}  # retrait anciens codes insee
  ?commune wdt:P31 wd:Q484170.                # commune de France
    FILTER NOT EXISTS { ?commune wdt:P576 []. }   # retrait anciennes communes
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } # noms des communes
}
ORDER BY (?insee)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?P374node") v2("?commune"):::projected v1("?insee"):::projected a2((" ")) a1((" ")) c8(["bd:serviceParam"]):::iri c10(["fr"]):::literal c6(["wd:Q484170"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:direct/P576"--> e0a1 e0v1("?commune"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> a1 v2 --"p:direct/P576"--> a1 f1[["not "]] subgraph f1e1["Exists Clause"] e1v1 --"p:qualifier/P582"--> e1a1 e1v1("?P374node"):::projected e1a1((" ")):::projected end f1--EXISTS--> f1e1 f1 --> v3 f1 --> c2 f1 --> a2 v3 --"p:qualifier/P582"--> a2 v2 --"p:P374"--> v3 v3 --"p:statement/P374"--> v1 v2 --"p:direct/P31"--> c6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end