query-bf7494a242445a18d6f89b890d814a29
Periods of Japanese history and calendar eras within them
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#>
SELECT ?era ?eraLabel (YEAR(?start_time) AS ?start) (YEAR(?end_time) AS ?end) ?subera ?suberaLabel
(YEAR(?sub_start_time) AS ?sub_start) (YEAR(?sub_end_time) AS ?sub_end) WHERE {
?era wdt:P31 wd:Q11514315; wdt:P361 wd:Q130436; # eras of the history of Japan
wdt:P580 ?start_time.
MINUS { ?era wdt:P2348 []} # exclude sub-eras
OPTIONAL { ?era wdt:P582 ?end_time }
OPTIONAL { ?subera wdt:P2348 ?era; wdt:P361 wd:Q130436; wdt:P580 ?sub_start_time;
wdt:P582 ?sub_end_time }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} ORDER BY ?start DESC(?end)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?end")
v5("?end_time"):::projected
v3("?era"):::projected
v9("?start")
v4("?start_time"):::projected
v10("?sub_end")
v8("?sub_end_time"):::projected
v9("?sub_start")
v7("?sub_start_time"):::projected
v6("?subera"):::projected
a1((" "))
c4(["wd:Q130436"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q11514315"]):::iri
v3 --"wdt:P31"--> c2
v3 --"wdt:P361"--> c4
v3 --"wdt:P580"--> v4
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P2348"--> a1
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P582".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."wdt:P2348".-> v3
v6 --"wdt:P361"--> c4
v6 --"wdt:P580"--> v7
v6 --"wdt:P582"--> v8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind1[/"year-from-dateTime(?start_time)"/]
v4 --o bind1
bind1 --as--o v9
bind2[/"year-from-dateTime(?end_time)"/]
v5 --o bind2
bind2 --as--o v9
bind3[/"year-from-dateTime(?sub_start_time)"/]
v7 --o bind3
bind3 --as--o v9
bind4[/"year-from-dateTime(?sub_end_time)"/]
v8 --o bind4
bind4 --as--o v10