query-a7d7864f844648474dec78f1fc68f5b2

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)headquarters location (P159)place of publication (P291)inception (P571)

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:Table
SELECT DISTINCT ?subj ?subjLabel  ?pubplace1Label ?pubplace2Label ?startdt
WHERE
{
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
  VALUES ?bustypes {
    wd:Q11032
  }
  VALUES ?scotCities {
    wd:Q182923 wd:Q36405 wd:Q4093 wd:Q23436 wd:Q203000 wd:Q123709 wd:Q576562 wd:Q211870 wd:Q160493 wd:Q654216 wd:Q623687 wd:Q1009331
  }
  ?subj wdt:P31/wdt:P279* ?bustypes .
  {?subj wdt:P159 ?scotCities.} UNION {?subj wdt:P291 ?scotCities.}.
  OPTIONAL {?subj wdt:P159 ?pubplace1.}
  OPTIONAL {?subj wdt:P291 ?pubplace2.}
  OPTIONAL {?subj wdt:P571 ?startdt.}.
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?bustypes") v4("?pubplace1") v5("?pubplace2") v2("?scotCities") v6("?startdt"):::projected v3("?subj"):::projected a1((" ")) c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end bind0[/VALUES ?bustypes/] bind0-->v1 bind00(["wd:Q11032"]) bind00 --> bind0 bind1[/VALUES ?scotCities/] bind1-->v2 bind10(["wd:Q182923"]) bind10 --> bind1 bind11(["wd:Q36405"]) bind11 --> bind1 bind12(["wd:Q4093"]) bind12 --> bind1 bind13(["wd:Q23436"]) bind13 --> bind1 bind14(["wd:Q203000"]) bind14 --> bind1 bind15(["wd:Q123709"]) bind15 --> bind1 bind16(["wd:Q576562"]) bind16 --> bind1 bind17(["wd:Q211870"]) bind17 --> bind1 bind18(["wd:Q160493"]) bind18 --> bind1 bind19(["wd:Q654216"]) bind19 --> bind1 bind110(["wd:Q623687"]) bind110 --> bind1 bind111(["wd:Q1009331"]) bind111 --> bind1 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> v1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P291"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P159"--> v2 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P159".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P291".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P571".-> v6 end