query-ae1d8ddf7960886d00e24f71ae4358c4
TEMPLATE={ "template": { "en": "Cultural events and festivals 'from' country ?country" }, "variables": { "?country": { "query": "SELECT ?id WHERE { ?id wdt:P31 wd:Q6256. }" } } } SELECT DISTINCT ?item WHERE { BIND(wd:Q40 AS ?country) VALUES ?type { wd:Q58687420 wd:Q132241 } ?item (wdt:P31/(wdt:P279*)) ?type. { ?item wdt:P17 ?country. } UNION { ?item wdt:P276 ?place. ?place wdt:P17 ?country. } }
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#TEMPLATE={ "template": { "en": "Cultural events and festivals 'from' country ?country" }, "variables": { "?country": { "query": "SELECT ?id WHERE { ?id wdt:P31 wd:Q6256. }" } } }
SELECT DISTINCT ?item WHERE {
BIND(wd:Q40 AS ?country)
VALUES ?type {
wd:Q58687420
wd:Q132241
}
?item (wdt:P31/(wdt:P279*)) ?type.
{ ?item wdt:P17 ?country. }
UNION
{
?item wdt:P276 ?place.
?place wdt:P17 ?country.
}
}
Query found at
- https://www.wikidata.org/wiki/User:Jean-Fr%C3%A9d%C3%A9ric/Austria_contest_ideas_bis
- https://www.wikidata.org/wiki/Wikidata:Tenth_Birthday/DACH_Culture_Contest/queries
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?country")
v3("?item"):::projected
v4("?place")
v2("?type")
a1((" "))
bind0[/"'wd:Q40'"/]
bind0 --as--o v1
bind1[/VALUES ?type/]
bind1-->v2
bind10(["wd:Q58687420"])
bind10 --> bind1
bind11(["wd:Q132241"])
bind11 --> bind1
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P276"--> v4
v4 --"wdt:P17"--> v1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P17"--> v1
end
union0r <== or ==> union0l
end