query-910635f01d6070a3b1024f05620ae1c6

rq turtle/ttl

dams in Inia by place SELECT DISTINCT ?dam ?damLabel ?loc1 ?loc1Label WHERE { ?dam wdt:P31/wdt:P279 wd:Q12323; wdt:P17 wd:Q668; wdt:P131 ?loc0. ?loc0 wdt:P131 ?loc1. OPTIONAL {?loc0 wdt:P31 wd:Q12443800. } {OPTIONAL {?loc1 wdt:P31 wd:Q12443800. } } UNION {OPTIONAL {?loc1 wdt:P31 wd:Q467745.} } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } LIMIT 1000

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#dams in Inia by place
SELECT DISTINCT ?dam ?damLabel ?loc1 ?loc1Label
WHERE {
  ?dam wdt:P31/wdt:P279* wd:Q12323;
       wdt:P17 wd:Q668;
       wdt:P131 ?loc0.
  ?loc0 wdt:P131* ?loc1.
  OPTIONAL {?loc0 wdt:P31 wd:Q12443800. }
  {OPTIONAL {?loc1 wdt:P31 wd:Q12443800. } }
    UNION
  {OPTIONAL {?loc1 wdt:P31 wd:Q467745.} }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 1000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?dam"):::projected v2("?loc0") v3("?loc1"):::projected a1((" ")) c10(["bd:serviceParam"]):::iri c5(["wd:Q668"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q12323"]):::iri c7(["wd:Q12443800"]):::iri c8(["wd:Q467745"]):::iri v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P17"--> c5 v1 --"wdt:P131"--> v2 v2 --"wdt:P131"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P31".-> c7 end subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> c8 end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> c7 end end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end