query-f68cdfba9eea9486fc125b6162bcabac
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Graph
SELECT DISTINCT ?genre ?genreLabel ?rgb ?OLAC ?_subclass_of ?_subclass_ofLabel WHERE {
?genre wdt:P31 wd:Q659563.
VALUES ?gametype { wd:Q659563 wd:Q2249149 }
OPTIONAL {
?genre wdt:P279 ?_subclass_of.
{ ?_subclass_of wdt:P31 wd:Q659563. } UNION {?_subclass_of wdt:P279 wd:Q2249149.}
}
OPTIONAL { ?genre wdt:P6352 ?OLAC. }
BIND(IF(BOUND(?OLAC), "FFA500", "7FFF00") AS ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?OLAC"):::projected
v3("?_subclass_of"):::projected
v2("?gametype")
v1("?genre"):::projected
v5("?rgb"):::projected
c4(["wd:Q2249149"]):::iri
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q659563"]):::iri
v1 --"wdt:P31"--> c2
bind0[/VALUES ?gametype/]
bind0-->v2
bind00(["wd:Q659563"])
bind00 --> bind0
bind01(["wd:Q2249149"])
bind01 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P279".-> v3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P279"--> c4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> c2
end
union0r <== or ==> union0l
end
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P6352".-> v4
end
bind1[/"if(bound(?OLAC),'FFA500','7FFF00')"/]
v4 --o bind1
bind1 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end