query-cb3762e47b1fbac20c43224cdda4f0dc

rq turtle/ttl

Graph of relationships between video game databases

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#>
#title: Graph of relationships between video game databases 
#defaultView:Graph
SELECT DISTINCT ?item ?itemLabel ?rgb ?link ?linkLabel ?rgb2 WHERE {
  {
    ?item wdt:P31/wdt:P279* wd:Q55341040; # ?item is a video games database
      wdt:P10568 ?link.                    # which is linked to ?link
  }
  UNION
  {
    ?item ^wdt:P10568 ?vgd.                 # item is linked to from ?vgd
    ?vgd wdt:P31/wdt:P279* wd:Q55341040.    # ?vgd is a video games database
    OPTIONAL {
               ?item wdt:P10568 ?link.      # item might be linked to ?link
             }
  }
  UNION
  {
    ?item99 ^wdt:P10568 ?vgd.                 # item99 is linked to from ?vgd
    ?vgd wdt:P31/wdt:P279* wd:Q55341040.    # ?vgd is a video games database
    ?item99 wdt:P10568 ?item.      # item99 is linked to ?item
  }
  OPTIONAL {
    ?item wdt:P1687 ?property.
  }
  BIND(IF(BOUND(?property),"FFA500","") 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; v1("?item"):::projected v4("?item99") v2("?link"):::projected v5("?property") v6("?rgb"):::projected v3("?vgd") a1((" ")) a2((" ")) a3((" ")) c7(["bd:serviceParam"]):::iri c3(["wd:Q55341040"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P10568"--> v4 v3 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c3 v4 --"wdt:P10568"--> v1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P10568"--> v1 v3 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P10568".-> v2 end end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P10568"--> v2 end union0r <== or ==> union0l end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P1687".-> v5 end bind0[/"if(bound(?property),'FFA500','')"/] v5 --o bind0 bind0 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end