query-2ad4eb548beb0e02f2b1f97bd302a7ce

rq turtle/ttl

located in or next to body of water (P206)

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT (STRAFTER(STR(?item), STR(wd:)) AS ?qid) ('P206' AS ?p) (STRAFTER(STR(?river), STR(wd:)) AS ?what)
('S3452' AS ?source) (STRAFTER(STR(SAMPLE(?bridge)), STR(wd:)) AS ?from)
{
  ?bridge wdt:P31/wdt:P279* wd:Q12280;
          wdt:P177 ?river;
          wdt:P131 ?item .
  ?river wdt:P31/wdt:P279* wd:Q355304 .
  MINUS { ?item wdt:P206 ?river } .
  ?item wdt:P31/wdt:P279* wd:Q486972 .
} GROUP BY ?item ?river

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?_anon_42b5416610844a34809f33a099ae9de188526"):::projected v1("?bridge") v9("?from") v3("?item"):::projected v6("?p") v5("?qid") v2("?river"):::projected v8("?source") v7("?what") a1((" ")) a2((" ")) a3((" ")) c8(["wd:Q486972"]):::iri c6(["wd:Q355304"]):::iri c3(["wd:Q12280"]):::iri v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P177"--> v2 v1 --"wdt:P131"--> v3 v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c6 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v3 --"wdt:P206"--> v2 end v3 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c8 bind2[/"sample(?bridge)"/] v1 --o bind2 bind2 --as--o v4 bind3[/"substring-after(str(?item),str('wd:'))"/] v3 --o bind3 bind3 --as--o v5 bind4[/"'P206'"/] bind4 --as--o v6 bind5[/"substring-after(str(?river),str('wd:'))"/] v2 --o bind5 bind5 --as--o v7 bind6[/"'S3452'"/] bind6 --as--o v8 bind7[/"substring-after(str(),str('wd:'))"/] null --o bind7 bind7 --as--o v9