query-b1d8d853c10811c416753c3a5174fad7
TEMPLATE={ "template": { "en": "Musical works '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} VALUES ?type { wd:Q2188189 } ?item (wdt:P175/(wdt:P495|wdt:P27)) wd:Q183; (wdt:P31/(wdt:P279*)) ?type. }
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": "Musical works '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}
VALUES ?type {
wd:Q2188189
}
?item (wdt:P175/(wdt:P495|wdt:P27)) wd:Q183;
(wdt:P31/(wdt:P279*)) ?type.
}
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
v2("?type")
a1((" "))
a2((" "))
c3(["wd:Q183"]):::iri
bind0[/VALUES ?country/]
bind0-->v1
bind00(["wd:Q40"])
bind00 --> bind0
bind01(["wd:Q39"])
bind01 --> bind0
bind02(["wd:Q183"])
bind02 --> bind0
bind1[/VALUES ?type/]
bind1-->v2
bind10(["wd:Q2188189"])
bind10 --> bind1
v3 --"wdt:P175"--> a1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a1 --"wdt:P27"--> c3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
a1 --"wdt:P495"--> c3
end
union0r <== or ==> union0l
end
v3 --"wdt:P31"--> a2
a2 --"wdt:P279"--> v2