query-6bdd30f70bb24391ad521fcefa6a09b1

rq turtle/ttl

Canton du Québec SELECT ?item ?itemLabel ?itemDescription ?alias ?dtFondation ?km2 ?locLabel ?coord WHERE { { ?item wdt:P31/wdt:P279 wd:Q23019040 }
OPTIONAL {?item skos:altLabel ?alias filter (lang(?alias) = "fr,en")} . OPTIONAL {?item wdt:P571 ?dtFondation} . OPTIONAL {?item p:P2046 ?area_statement . ?area_statement psv:P2046 ?area_node . ?area_node wikibase:quantityAmount ?area .
?area_node wikibase:quantityUnit ?unit . ?unit wdt:P2370 ?conversionSI . BIND(?area
?conversionSI/1000000 AS ?km2)} . OPTIONAL {?item wdt:P131 ?loc} . FILTER NOT EXISTS { ?item wdt:P571 ?dtFondation } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" . } } ORDER BY (?regionLabel) LIMIT 1800

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Canton du Québec
SELECT ?item ?itemLabel ?itemDescription ?alias ?dtFondation ?km2 ?locLabel ?coord
WHERE {
    { ?item wdt:P31/wdt:P279* wd:Q23019040 }  
    OPTIONAL {?item skos:altLabel ?alias filter (lang(?alias) = "fr,en")} .
    OPTIONAL {?item wdt:P571 ?dtFondation} .
    OPTIONAL {?item p:P2046 ?area_statement .
              ?area_statement psv:P2046 ?area_node .
              ?area_node wikibase:quantityAmount ?area .  
              ?area_node wikibase:quantityUnit ?unit .
              ?unit wdt:P2370 ?conversionSI . 
              BIND(?area*?conversionSI/1000000 AS ?km2)} .
    OPTIONAL {?item wdt:P131 ?loc} .
    FILTER NOT EXISTS { ?item wdt:P571 ?dtFondation }
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "fr,en" .
    }
} 
ORDER BY (?regionLabel) 
LIMIT 1800

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?alias"):::projected v7("?area") v6("?area_node") v5("?area_statement") v9("?conversionSI") v3("?dtFondation"):::projected v2("?item"):::projected v10("?km2"):::projected v11("?loc") v1("?regionLabel") v8("?unit") a1((" ")) c5(["wd:Q23019040"]):::iri c14(["bd:serviceParam"]):::iri c2(["fr,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:direct/P571"--> e0v2 e0v2("?dtFondation"):::projected e0v1("?item"):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> v3 v2 --"p:direct/P571"--> v3 v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."skos:altLabel".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P571".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P2046".-> v5 v5 --"p:statement/value/P2046"--> v6 v6 --"wikibase:quantityAmount"--> v7 v6 --"wikibase:quantityUnit"--> v8 v8 --"p:direct/P2370"--> v9 bind1[/"?area * ?conversionSI / '1000000^^xsd:integer'"/] v7 --o bind1 v9 --o bind1 bind1 --as--o v10 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P131".-> v11 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c2 end