query-6d6742dc79ee1514ae3fa0beb39f187d

rq turtle/ttl

Au 1er janvier 2005, il y avait 36 684 communes en France. SELECT ?commune WHERE { BIND ( "2005-01-01"^^xsd:dateTime as ?dateRecherche ) # Au 1er janvier 2005 { ?commune wdt:P31 wd:Q484170 . } UNION { VALUES ?commune {wd:Q90} } # nature de commune OPTIONAL { ?commune wdt:P571 ?dateCréation . } # date de création OPTIONAL { ?commune wdt:P576 ?dateDissolution . } # date de dissolution FILTER ( !BOUND(?dateCréation) || ?dateCréation <= ?dateRecherche ) # communes futures FILTER ( !BOUND(?dateDissolution) || ?dateDissolution > ?dateRecherche ) # communes passées } ORDER BY (?commune)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
# Au 1er janvier 2005, il y avait 36 684 communes en France.
SELECT ?commune 
WHERE {
  BIND ( "2005-01-01"^^xsd:date as ?dateRecherche ) # Au 1er janvier 2005
  { ?commune wdt:P31 wd:Q484170 . } UNION { VALUES ?commune {wd:Q90} } # nature de commune
    OPTIONAL { ?commune wdt:P571 ?dateCréation . } # date de création
    OPTIONAL { ?commune wdt:P576 ?dateDissolution . } # date de dissolution
    FILTER ( !BOUND(?dateCréation) || ?dateCréation <= ?dateRecherche ) # communes futures
    FILTER ( !BOUND(?dateDissolution) || ?dateDissolution > ?dateRecherche ) # communes passées
}
ORDER BY (?commune)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?commune"):::projected v4("?dateCréation") v2("?dateDissolution") v5("?dateRecherche") c2(["wd:Q484170"]):::iri f0[["(not bound(?dateDissolution) || ?dateDissolution > ?dateRecherche)"]] f0 --> v2 f0 --> v5 f1[["(not bound(?dateCréation) || ?dateCréation <= ?dateRecherche)"]] f1 --> v4 f1 --> v5 bind2[/"'2005-01-01^^xsd:date'"/] bind2 --as--o v5 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; bind3[/VALUES ?commune/] bind3-->v5 bind30(["wd:Q90"]) bind30 --> bind3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v5 --"wdt:P31"--> c2 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P571".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P576".-> v2 end