query-b9b43db30b0b3318a4b4aed2f551daaa

rq turtle/ttl

Fictional wars Kaitary, adapted from Martin L Poulterby Fictional wars User:KaitaryBased on a query by

Use at

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 ?from ?fromLabel ?to ?toLabel ?rgb WHERE {
  {SELECT (?fictional_war AS ?from) (?universe AS ?to) ("F7FF00" as ?rgb) WHERE {
  ?fictional_war wdt:P31 wd:Q17198419. OPTIONAL{?fictional_war wdt:P1080 ?narr_universe}
    OPTIONAL {?fictional_war wdt:P8345 ?franchise }
    OPTIONAL {?fictional_war wdt:P1441 ?work }
    BIND(COALESCE(?narr_universe, ?franchise, ?work, '') AS ?universe)
  } }
UNION {SELECT (?participant AS ?from) (?fictional_war AS ?to) ("7FFF00" as ?rgb) WHERE {
   ?fictional_war wdt:P31 wd:Q17198419.
OPTIONAL { ?fictional_war wdt:P710 ?participant } } }
 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; v1("?fictional_war") v3("?franchise") v10("?from"):::projected v2("?narr_universe") v9("?participant") v10("?rgb"):::projected v10("?to"):::projected v5("?universe") v4("?work") c8(["bd:serviceParam"]):::iri c2(["wd:Q17198419"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P710".-> v9 end bind0[/"?participant"/] v9 --o bind0 bind0 --as--o v10 bind1[/"?fictional_war"/] v1 --o bind1 bind1 --as--o v10 bind2[/"'7FFF00'"/] bind2 --as--o v10 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c2 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P1080".-> v2 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P8345".-> v3 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P1441".-> v4 end bind3[/"?narr_universe?franchise?work''"/] v2 --o bind3 v3 --o bind3 v4 --o bind3 bind3 --as--o v5 bind4[/"?fictional_war"/] v1 --o bind4 bind4 --as--o v10 bind5[/"?universe"/] v5 --o bind5 bind5 --as--o v10 bind6[/"'F7FF00'"/] bind6 --as--o v10 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end