query-69b790ab6a49c6893b56aa4d0223bafd

rq turtle/ttl

Rivers and canals in Lithuania

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Rivers and canals in Lithuania.
#defaultView:Map{"hide":["?coord"],"layer":"?canalLabel"}
SELECT DISTINCT ?item ?label ?canal ?canalLabel ?coord WHERE { 
  {SELECT * {
    {SELECT * { 
    ?item wdt:P17 wd:Q37 ;
          wdt:P625 ?coord ;
          rdfs:label ?label .
    FILTER(LANG(?label) = "lt").  
    } }
    { ?item p:P177 [ ps:P177 ?canal ] } UNION { ?item p:P2505 [ ps:P2505 ?canal ] } UNION { ?item p:P206 [ ps:P206 ?canal ] }    
    } } 
  VALUES ?watercourse { wd:Q4022 wd:Q12284 }  
  FILTER EXISTS { ?canal wdt:P31/wdt:P279* ?watercourse }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }
GROUP BY ?item ?label ?canal ?canalLabel ?coord
ORDER BY ?canalLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?canal"):::projected v1("?canalLabel"):::projected v6("?coord"):::projected v5("?item"):::projected v4("?label"):::projected v7("?watercourse") a2((" ")) a3((" ")) a4((" ")) a1((" ")) c5(["wd:Q37"]):::iri c15(["bd:serviceParam"]):::iri c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[[" "]] subgraph f0e0["Exists Clause"] e0v1 --"p:direct/P31"--> e0a1 e0a1 --"p:direct/P279"--> e0v2 e0v1("?canal"):::projected e0v2("?watercourse"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> a1 f0 --> c2 f0 --> v7 v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> v7 f1[["?label = 'lt'"]] f1 --> v4 v5 --"p:direct/P17"--> c5 v5 --"p:direct/P625"--> v6 v5 --"rdfs:label"--> v4 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; a4 --"p:statement/P206"--> v2 v5 --"p:P206"--> a4 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; a3 --"p:statement/P2505"--> v2 v5 --"p:P2505"--> a3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; a2 --"p:statement/P177"--> v2 v5 --"p:P177"--> a2 end union0r <== or ==> union0l end bind2[/VALUES ?watercourse/] bind2-->v7 bind20(["wd:Q4022"]) bind20 --> bind2 bind21(["wd:Q12284"]) bind21 --> bind2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c15 --"wikibase:language"--> c17 end