query-40a26f866a0f9fa1ef0bedb4559fc85b

rq turtle/ttl

Canton du Québec ayant une municipalité en P131 SELECT ?item ?itemLabel ?itemDescription ?alias ?dtFondation ?km2 ?munLabel ?mrcLabel ?regionLabel ?coord WHERE { { ?item wdt:P31/wdt:P279 wd:Q23019040 }
?item wdt:P17 wd:Q16 . ?item wdt:P131/wdt:P131
?mun . ?mun wdt:P31/wdt:P279 wd:Q3327873 . ?mun wdt:P131/wdt:P131 ?mrc . ?mrc wdt:P31/wdt:P279 wd:Q204613. ?mrc wdt:P131/wdt:P131 ?region . ?region wdt:P31/wdt:P279 wd:Q55998242 . 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:P625 ?coord} 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 ayant une municipalité en P131
SELECT ?item ?itemLabel ?itemDescription ?alias ?dtFondation ?km2 ?munLabel ?mrcLabel ?regionLabel ?coord 
WHERE {
    { ?item wdt:P31/wdt:P279* wd:Q23019040 }  
    ?item wdt:P17 wd:Q16 .
    ?item wdt:P131/wdt:P131* ?mun .
    ?mun wdt:P31/wdt:P279* wd:Q3327873 .
    ?mun wdt:P131/wdt:P131* ?mrc .
    ?mrc wdt:P31/wdt:P279* wd:Q204613.
    ?mrc wdt:P131/wdt:P131* ?region .
    ?region wdt:P31/wdt:P279* wd:Q55998242 .
    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:P625 ?coord}
    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; v2("?alias"):::projected v10("?area") v9("?area_node") v8("?area_statement") v12("?conversionSI") v14("?coord"):::projected v7("?dtFondation"):::projected v3("?item"):::projected v13("?km2"):::projected v5("?mrc") v4("?mun") v6("?region") v1("?regionLabel"):::projected v11("?unit") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) c10(["wd:Q55998242"]):::iri c4(["wd:Q23019040"]):::iri c9(["wd:Q204613"]):::iri c6(["wd:Q16"]):::iri c8(["wd:Q3327873"]):::iri c20(["bd:serviceParam"]):::iri c1(["fr,en"]):::literal v3 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c4 v3 --"p:direct/P17"--> c6 v3 --"p:direct/P131"--> a2 a2 --"p:direct/P131"--> v4 v4 --"p:direct/P31"--> a3 a3 --"p:direct/P279"--> c8 v4 --"p:direct/P131"--> a4 a4 --"p:direct/P131"--> v5 v5 --"p:direct/P31"--> a5 a5 --"p:direct/P279"--> c9 v5 --"p:direct/P131"--> a6 a6 --"p:direct/P131"--> v6 v6 --"p:direct/P31"--> a7 a7 --"p:direct/P279"--> c10 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".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:P2046".-> v8 v8 --"p:statement/value/P2046"--> v9 v9 --"wikibase:quantityAmount"--> v10 v9 --"wikibase:quantityUnit"--> v11 v11 --"p:direct/P2370"--> v12 bind0[/"?area * ?conversionSI / '1000000^^xsd:integer'"/] v10 --o bind0 v12 --o bind0 bind0 --as--o v13 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P625".-> v14 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c20 --"wikibase:language"--> c1 end