query-aefb082a6e913aa33ff70795f9d3c4f5

rq turtle/ttl

Communes françaises sans département

Cette requête ne doit renvoyer aucun résultat.

SELECT DISTINCT ?commune ?communeLabel ?communeDescription ?departementLabel ?insee { ?commune p:P31 ?statement . # Les éléments qui ont pour nature... ?statement ps:P31 ?type . # ...un des types autorisés ci-dessous VALUES ?type { wd:Q484170 # commune française wd:Q2989454 # commune nouvelle wd:Q22927616 # commune française à statut particulier } FILTER NOT EXISTS { ?statement pq:P582 ?fin_com } . # La commune n'a pas de date de fin

?commune wdt:P374 ?insee .

# Il n'y a pas de département sans date de fin FILTER NOT EXISTS { ?commune p:P131 ?departementStatement . ?departementStatement ps:P131 ?directdepartement . ?directdepartement wdt:P31 ?typeDep . VALUES ?typeDep { wd:Q6465 # département wd:Q202216 # département d'Outre-mer wd:Q719487 # collectivité d'Outre-mer wd:Q3408484 # Province de la Nouvelle-Calédonie } FILTER NOT EXISTS { ?departementStatement pq:P582 ?fin_dep } . }

# Il reste à ignorer Paris et les communes de la métropole lyonnaise FILTER NOT EXISTS { ?commune wdt:P131 wd:Q16665897 . } # Métropole lyonnaise FILTER ( ?commune != wd:Q90 ) . # Paris

SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . } } ORDER BY ?communeLabel

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#>
# Communes françaises sans département
# Cette requête ne doit renvoyer aucun résultat.
SELECT DISTINCT ?commune ?communeLabel ?communeDescription ?departementLabel ?insee {
  ?commune p:P31 ?statement .   # Les éléments qui ont pour nature...
  ?statement ps:P31 ?type . # ...un des types autorisés ci-dessous
  VALUES ?type {
     wd:Q484170 # commune française
     wd:Q2989454 # commune nouvelle
     wd:Q22927616 # commune française à statut particulier
    }
  FILTER NOT EXISTS { ?statement pq:P582 ?fin_com } . # La commune n'a pas de date de fin

  ?commune wdt:P374 ?insee . 

  # Il n'y a pas de département sans date de fin
  FILTER NOT EXISTS { ?commune p:P131 ?departementStatement .
            ?departementStatement ps:P131 ?directdepartement .
            ?directdepartement wdt:P31 ?typeDep .
            VALUES ?typeDep {
              wd:Q6465 # département
              wd:Q202216 # département d'Outre-mer
              wd:Q719487 # collectivité d'Outre-mer
              wd:Q3408484 # Province de la Nouvelle-Calédonie
            }
            FILTER NOT EXISTS { ?departementStatement pq:P582 ?fin_dep } .
           } 

  # Il reste à ignorer Paris et les communes de la métropole lyonnaise
  FILTER NOT EXISTS { ?commune wdt:P131 wd:Q16665897 . } # Métropole lyonnaise
  FILTER ( ?commune != wd:Q90 ) . # Paris

  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . }
} ORDER BY ?communeLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?commune"):::projected v1("?communeLabel"):::projected v3("?departementStatement") v5("?directdepartement") v8("?fin_com") v4("?fin_dep") v10("?insee"):::projected v7("?statement") v10("?type") v7("?typeDep") c14(["fr"]):::literal c3(["wd:Q16665897"]):::iri c12(["bd:serviceParam"]):::iri f0[["?commune != 'wd:Q90'"]] f0 --> v2 f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 --"p:direct/P131"--> e0c2 e0v1("?commune"):::projected e0c2(["wd:Q16665897"]):::iri end f1--EXISTS--> f1e0 f1 --> v2 f1 --> c2 f1 --> c3 v2 --"p:direct/P131"--> c3 f2[["not "]] subgraph f2e1["Exists Clause"] e1f0[["not "]] subgraph e1f0e1e0["Exists Clause"] e1e0v1 --"p:qualifier/P582"--> e1e0v2 e1e0v1("?departementStatement"):::projected e1e0v2("?fin_dep"):::projected end e1f0--EXISTS--> e1f0e1e0 e1f0 --> e1v1 e1f0 --> e1c1 e1f0 --> e1v2 e1v1 --"p:qualifier/P582"--> e1v2 e1v3 --"p:P131"--> e1v1 e1v1 --"p:statement/P131"--> e1v4 e1v4 --"p:direct/P31"--> e1v6 bind1[/VALUES ?typeDep/] bind1-->e1v6 bind10(["wd:Q6465"]) bind10 --> bind1 bind11(["wd:Q202216"]) bind11 --> bind1 bind12(["wd:Q719487"]) bind12 --> bind1 bind13(["wd:Q3408484"]) bind13 --> bind1 e1v3("?commune"):::projected e1v1("?departementStatement"):::projected e1v4("?directdepartement"):::projected e1v2("?fin_dep"):::projected e1v6("?typeDep"):::projected end f2--EXISTS--> f2e1 f2 --> v3 f2 --> c4 f2 --> v4 f2 --> v2 f2 --> c5 f2 --> c6 f2 --> v5 f2 --> c7 f2 --> v7 f3[["not "]] subgraph f3e2["Exists Clause"] e2v1 --"p:qualifier/P582"--> e2v2 e2v1("?departementStatement"):::projected e2v2("?fin_dep"):::projected end f3--EXISTS--> f3e2 f3 --> v3 f3 --> c4 f3 --> v4 v3 --"p:qualifier/P582"--> v4 v2 --"p:P131"--> v3 v3 --"p:statement/P131"--> v5 v5 --"p:direct/P31"--> v7 bind4[/VALUES ?typeDep/] bind4-->v7 bind40(["wd:Q6465"]) bind40 --> bind4 bind41(["wd:Q202216"]) bind41 --> bind4 bind42(["wd:Q719487"]) bind42 --> bind4 bind43(["wd:Q3408484"]) bind43 --> bind4 f5[["not "]] subgraph f5e3["Exists Clause"] e3v1 --"p:qualifier/P582"--> e3v2 e3v2("?fin_com"):::projected e3v1("?statement"):::projected end f5--EXISTS--> f5e3 f5 --> v7 f5 --> c4 f5 --> v8 v7 --"p:qualifier/P582"--> v8 v2 --"p:P31"--> v7 v7 --"p:statement/P31"--> v10 bind6[/VALUES ?type/] bind6-->v10 bind60(["wd:Q484170"]) bind60 --> bind6 bind61(["wd:Q2989454"]) bind61 --> bind6 bind62(["wd:Q22927616"]) bind62 --> bind6 v2 --"p:direct/P374"--> v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end