query-2957f1dc32bc6a50955386ffe4de9aae

rq turtle/ttl

Canton du Québec SELECT ?item ?itemLabel ?itemDescription ?alias ?dtFondation ?km2 ?locationLabel ?coord WHERE { { ?item wdt:P31/wdt:P279 wd:Q23019040 }
?item wdt:P131
?location . ?location wdt:P31 wd:Q55998242 . OPTIONAL {?item skos:altLabel ?alias filter (lang(?alias) = "fr")} . 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:P625 ?coord} SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . } } 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 ?locationLabel ?coord 
WHERE {
    { ?item wdt:P31/wdt:P279* wd:Q23019040 }  
    ?item wdt:P131* ?location .
    ?location wdt:P31 wd:Q55998242 .
    OPTIONAL {?item skos:altLabel ?alias filter (lang(?alias) = "fr")} .
    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:P625 ?coord}
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "fr" .
    }
} 
ORDER BY (?regionLabel) 
LIMIT 1800

Query found at

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