query-fd2140e4e1d9fc08a54644f28baa98df

rq turtle/ttl

TEMPLATE={ "template": { "en": "Performing art groups from country ?country" }, "variables": { "?country": { "query": "SELECT ?id WHERE { ?id wdt:P31 wd:Q6256. }" } } } SELECT DISTINCT ?item WHERE { VALUES ?country {wd:Q40 wd:Q39 wd:Q183} { ?item wdt:P495 ?country. } UNION { ?item wdt:P740 ?formation. ?formation wdt:P17 ?country. } FILTER(EXISTS { ?item (wdt:P31/(wdt:P279*)) wd:Q105815710. hint:Prior hint:gearing "forward". }) }

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#TEMPLATE={ "template": { "en": "Performing art groups from country ?country" }, "variables": { "?country": { "query": "SELECT ?id WHERE { ?id wdt:P31 wd:Q6256. }" } } }
SELECT DISTINCT ?item WHERE {
  VALUES ?country {wd:Q40 wd:Q39 wd:Q183}
  { ?item wdt:P495 ?country. }
  UNION
  {
    ?item wdt:P740 ?formation.
    ?formation wdt:P17 ?country.
  }
  FILTER(EXISTS {
    ?item (wdt:P31/(wdt:P279*)) wd:Q105815710.

  })
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?country") v3("?formation") v1("?item"):::projected a1((" ")) c3(["wd:Q105815710"]):::iri f0[[" "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0a1 e0a1 --"wdt:P279"--> e0c3 e0v1("?item"):::projected e0a1((" ")):::projected e0c3(["wd:Q105815710"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 f0 --> c2 f0 --> c3 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 bind1[/VALUES ?country/] bind1-->v2 bind10(["wd:Q40"]) bind10 --> bind1 bind11(["wd:Q39"]) bind11 --> bind1 bind12(["wd:Q183"]) bind12 --> bind1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P740"--> v3 v3 --"wdt:P17"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P495"--> v2 end union0r <== or ==> union0l end