query-8d1f7232ba850c0aad43bf6ead7fe440

rq turtle/ttl

(50) Timeline of periods: Twenty-Six Histories civilizationsNo.50 (2020.08.07T1914 created)

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#>
# timeline of Twenty-Six Histories civilizations (also viewable as table)
#defaultView:Timeline
SELECT DISTINCT ?civilization ?civilizationLabel ?start ?end ?book ?bookLabel
WHERE {
  # ?book is any part of (P361) part of... Twenty-Six Histories (Q11371378)
  ?book wdt:P361* wd:Q11371378;
        # ?book's genre (P136) is jizhuanti (Q1619411) so that parts of each book,
        # whose genres are benji (Q1872234), liezhuan (Q2252176), et al., are excluded
        wdt:P136 wd:Q1619411.
  # ?book should not be instance of (P31) book series (Q277759) so that groups of books,
  # e.g, Twenty-Four Histories (Q175077) and Seventeen Histories (Q9503010), are excluded
  FILTER NOT EXISTS {?book wdt:P31 wd:Q277759}
  # optional: show ?book's main subject (P921) as ?civilization
  OPTIONAL {?book wdt:P921 ?civilization.
            # ?civilization is instance of (P31) any subclass of (wdt:P279) subclass of... ?x
            ?civilization wdt:P31/wdt:P279* ?x
            # define ?x as historical country (Q3024240) or historical period (Q11514315)
            VALUES ?x {wd:Q3024240 wd:Q11514315}
            # optional: show ?civilization's inception time (P571) or start time (P580) as ?start
            OPTIONAL {?civilization (wdt:P571|wdt:P580) ?start}
            # optional: show ?civilization's dissolution time (P576) or end time (P582) as ?end
            OPTIONAL {?civilization (wdt:P576|wdt:P582) ?end}
            }
  # show label in auto language as default, and English when no default label exists
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}
}
# order table by ?start in ascending order
### Note: ORDER BY has to be used because by clicking the ascending/descending arrows in the table,
### years cannot be ordered correctly (table does not recognize the years BCE as negative numbers).
ORDER BY ?start

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?book"):::projected v3("?civilization"):::projected v5("?end"):::projected v1("?start"):::projected v5("?x") a1((" ")) c6(["wd:Q1619411"]):::iri c2(["wd:Q277759"]):::iri c14(["bd:serviceParam"]):::iri c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal c4(["wd:Q11371378"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0c2 e0v1("?book"):::projected e0c2(["wd:Q277759"]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> c2 v2 --"wdt:P31"--> c2 v2 --"wdt:P361"--> c4 v2 --"wdt:P136"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P921".-> v3 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> v5 bind1[/VALUES ?x/] bind1-->v5 bind10(["wd:Q3024240"]) bind10 --> bind1 bind11(["wd:Q11514315"]) bind11 --> bind1 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 -."wdt:P580".-> v1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P571"--> v1 end union0r <== or ==> union0l end end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 -."wdt:P582".-> v5 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P576"--> v5 end union1r <== or ==> union1l end end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end