query-bc7185a3ee4e30177ccb5f25658ab575
TEMPLATE={ "template": { "en": "Video game companies 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:P159 ?hq. ?hq wdt:P17 ?country. } { VALUES ?type { wd:Q210167 wd:Q1137109 } ?item wdt:P31 ?type. } UNION { ?item wdt:P452 wd:Q941594. } }
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": "Video game companies 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:P159 ?hq.
?hq wdt:P17 ?country.
}
{
VALUES ?type { wd:Q210167 wd:Q1137109 }
?item wdt:P31 ?type. }
UNION
{ ?item wdt:P452 wd:Q941594. }
}
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("?hq")
v2("?item"):::projected
v4("?type")
c6(["wd:Q941594"]):::iri
bind0[/VALUES ?country/]
bind0-->v1
bind00(["wd:Q40"])
bind00 --> bind0
bind01(["wd:Q39"])
bind01 --> bind0
bind02(["wd:Q183"])
bind02 --> bind0
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P159"--> v3
v3 --"wdt:P17"--> v1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P495"--> v1
end
union0r <== or ==> union0l
end
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P452"--> c6
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
bind1[/VALUES ?type/]
bind1-->v4
bind10(["wd:Q210167"])
bind10 --> bind1
bind11(["wd:Q1137109"])
bind11 --> bind1
v2 --"wdt:P31"--> v4
end
union1r <== or ==> union1l
end