query-e7f91bf0321b466742ccb7e24b6a8bea
TEMPLATE={ "template": { "en": "Creative works 'from' ?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:P170 ?creator. { ?creator wdt:P19 ?birth. ?birth wdt:P17 ?country. } UNION { ?creator wdt:P27 ?country. } FILTER(EXISTS { VALUES ?type { wd:Q3305213 wd:Q93184 wd:Q860861 wd:Q4989906 wd:Q179700 } ?item wdt:P31 ?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": "Creative works 'from' ?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:P170 ?creator.
{
?creator wdt:P19 ?birth.
?birth wdt:P17 ?country.
}
UNION
{ ?creator wdt:P27 ?country. }
FILTER(EXISTS {
VALUES ?type {
wd:Q3305213
wd:Q93184
wd:Q860861
wd:Q4989906
wd:Q179700
}
?item wdt:P31 ?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;
v5("?birth")
v3("?country")
v4("?creator")
v2("?item"):::projected
v1("?type")
f0[[" "]]
subgraph f0e0["Exists Clause"]
bind0[/VALUES ?type/]
bind0-->e0v1
bind00(["wd:Q3305213"])
bind00 --> bind0
bind01(["wd:Q93184"])
bind01 --> bind0
bind02(["wd:Q860861"])
bind02 --> bind0
bind03(["wd:Q4989906"])
bind03 --> bind0
bind04(["wd:Q179700"])
bind04 --> bind0
e0v2 --"wdt:P31"--> e0v1
e0v2("?item"):::projected
e0v1("?type"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v1
bind1[/VALUES ?type/]
bind1-->v1
bind10(["wd:Q3305213"])
bind10 --> bind1
bind11(["wd:Q93184"])
bind11 --> bind1
bind12(["wd:Q860861"])
bind12 --> bind1
bind13(["wd:Q4989906"])
bind13 --> bind1
bind14(["wd:Q179700"])
bind14 --> bind1
v2 --"wdt:P31"--> v1
bind2[/VALUES ?country/]
bind2-->v3
bind20(["wd:Q40"])
bind20 --> bind2
bind21(["wd:Q39"])
bind21 --> bind2
bind22(["wd:Q183"])
bind22 --> bind2
v2 --"wdt:P170"--> v4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P27"--> v3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P19"--> v5
v5 --"wdt:P17"--> v3
end
union0r <== or ==> union0l
end