query-6c2b3b79454bedd514f80c4d54e5c18f

rq turtle/ttl

Cours d'eau alimentant la Ottawa River (Q60974).

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?riveLabel ?confluentLabel ?locationLabel ?locationCoord ?sourceLabel ?sourceLocationLabel ?sourceCoord ?longueur ?regionLabel
  WHERE { {?item (wdt:P403)* wd:Q60974 }     # affluents et sous-affluents de la rivière des outaouais 
    OPTIONAL {?item p:P403 [ pq:P31 ?rive ] }              # qualificatif rive de la confluence
    OPTIONAL {?item wdt:P403 ?confluent }
    OPTIONAL {?item p:P403 [ pq:P131 ?location ] }         # qualificatif unité administrative   
    OPTIONAL {?item p:P403 [ pq:P625 ?locationCoord ] }    # qualificatif coordonnés de la confluence 
    OPTIONAL {?item wdt:P885 ?source }
    OPTIONAL {?item p:P885 [ pq:P131 ?sourceLocation ] }              
    OPTIONAL {?item p:P885 [ pq:P625 ?sourceCoord ] }                
    OPTIONAL {?item wdt:P885 ?tempCo .                     # Chercher les coordonnées de la source
              ?tempCo wdt:P625 ?sourceCoord }              
    OPTIONAL {?item wdt:P885 ?tempLoc .                    # Chercher la localisation de la source
              ?tempLoc wdt:P131 ?sourceLocation }
    OPTIONAL {?item wdt:P131 ?temp .                       # Chercher la région niveau 3
              {?temp wdt:P31/wdt:P279* wd:Q3327873}        #  municipalité
              ?temp wdt:P131 ?temp3 . ?temp3 wdt:P31 wd:Q204613 . # a une MRC
              ?temp3 wdt:P131 ?region }
    OPTIONAL {?item wdt:P131 ?temp2 .                      # Chercher la région niveau 2
              {?temp2 wdt:P31 wd:Q204613}                  #  municipalité régionale de comté 
              union {?temp2 wdt:P31 wd:Q3518817 . ?temp2 wdt:P31 wd:Q27676416} # ville et territoire équivalent
              union {?temp2 wdt:P31 wd:Q2826814} .         #  agglomération du Québec
              ?temp2 wdt:P131 ?region } 
    OPTIONAL {?item wdt:P131 ?temp1 .                      # Chercher région niveau 1
              {?temp1 wdt:P31 wd:Q1989278}                 #  région administrative du Québec
              union {?temp1 wdt:P31 wd:Q16295254}          #  municipalité supérieur Ontario 
              union {?temp1 wdt:P31 wd:Q14763130}          #  district Ontario
              union {?temp1 wdt:P31 wd:Q14763041}          #  comté de l'Ontario
              union {?temp1 wdt:P31 wd:Q17344046} .        #  territoire non organisé de l'Ontario
              ?item wdt:P131 ?region }    
    OPTIONAL {?item wdt:P131 ?location }
    OPTIONAL {?item wdt:P131 ?sourceLocation } 
    OPTIONAL {?item wdt:P625 ?locationCoord } 
    OPTIONAL {?item wdt:P2043 ?longueur } .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" . }  # français sinon anglais
}
ORDER BY (?itemLabel) 
LIMIT 500

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?confluent") v2("?item"):::projected v1("?itemLabel"):::projected v5("?location") v6("?locationCoord"):::projected v17("?longueur"):::projected v14("?region") v3("?rive") v7("?source") v9("?sourceCoord"):::projected v8("?sourceLocation") v12("?temp") v16("?temp1") v15("?temp2") v13("?temp3") v10("?tempCo") v11("?tempLoc") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) c16(["wd:Q27676416"]):::iri c19(["wd:Q16295254"]):::iri c14(["wd:Q204613"]):::iri c20(["wd:Q14763130"]):::iri c17(["wd:Q2826814"]):::iri c25(["bd:serviceParam"]):::iri c27(["fr,en"]):::literal c21(["wd:Q14763041"]):::iri c18(["wd:Q1989278"]):::iri c2(["wd:Q60974"]):::iri c13(["wd:Q3327873"]):::iri c22(["wd:Q17344046"]):::iri c15(["wd:Q3518817"]):::iri v2 --"p:direct/P403"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; a1 -."p:qualifier/P31".-> v3 v2 --"p:P403"--> a1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P403".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; a2 -."p:qualifier/P131".-> v5 v2 --"p:P403"--> a2 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; a3 -."p:qualifier/P625".-> v6 v2 --"p:P403"--> a3 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P885".-> v7 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; a4 -."p:qualifier/P131".-> v8 v2 --"p:P885"--> a4 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; a5 -."p:qualifier/P625".-> v9 v2 --"p:P885"--> a5 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P885".-> v10 v10 --"p:direct/P625"--> v9 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P885".-> v11 v11 --"p:direct/P131"--> v8 end subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P131".-> v12 v12 --"p:direct/P31"--> a6 a6 --"p:direct/P279"--> c13 v12 --"p:direct/P131"--> v13 v13 --"p:direct/P31"--> c14 v13 --"p:direct/P131"--> v14 end subgraph optional10["(optional)"] style optional10 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P131".-> v15 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v15 --"p:direct/P31"--> c17 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v15 --"p:direct/P31"--> c15 v15 --"p:direct/P31"--> c16 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v15 --"p:direct/P31"--> c14 end union0r <== or ==> union0l end v15 --"p:direct/P131"--> v14 end subgraph optional11["(optional)"] style optional11 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P131".-> v16 subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; subgraph union5[" Union "] subgraph union5l[" "] style union5l fill:#abf,stroke-dasharray: 3 3; v16 --"p:direct/P31"--> c22 end subgraph union5r[" "] style union5r fill:#abf,stroke-dasharray: 3 3; v16 --"p:direct/P31"--> c21 end union5r <== or ==> union5l end end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v16 --"p:direct/P31"--> c20 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v16 --"p:direct/P31"--> c19 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v16 --"p:direct/P31"--> c18 end union2r <== or ==> union2l end v2 --"p:direct/P131"--> v14 end subgraph optional12["(optional)"] style optional12 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P131".-> v5 end subgraph optional13["(optional)"] style optional13 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P131".-> v8 end subgraph optional14["(optional)"] style optional14 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P625".-> v6 end subgraph optional15["(optional)"] style optional15 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P2043".-> v17 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c25 --"wikibase:language"--> c27 end