query-7c3bd3697145eb3f950332ebf1e1acf0
title:Major eras of Japanese history SELECT ?era ?eraLabel (YEAR(?start_time) AS ?start) (YEAR(?end_time) AS ?end) ?namedLabel ?namedDescription WHERE { ?era wdt:P31 wd:Q11514315; wdt:P361 wd:Q130436; # eras of the history of Japan wdt:P580 ?start_time. FILTER (?era NOT IN (wd:Q11358452, wd:Q11509224, wd:Q1145058) ) # Exclude ancient times, modern times
MINUS { ?era wdt:P2348/wdt:P361 wd:Q130436 wd:Q1145058} # exclude sub-eras
MINUS {?era wdt:P2348 []} OPTIONAL { ?era wdt:P582 ?end_time } OPTIONAL { ?era wdt:P138 ?named } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ?start DESC(?end)
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#>
#title:Major eras of Japanese history
SELECT ?era ?eraLabel (YEAR(?start_time) AS ?start) (YEAR(?end_time) AS ?end) ?namedLabel ?namedDescription WHERE {
?era wdt:P31 wd:Q11514315; wdt:P361 wd:Q130436; # eras of the history of Japan
wdt:P580 ?start_time. FILTER (?era NOT IN (wd:Q11358452, wd:Q11509224, wd:Q1145058) ) # Exclude ancient times, modern times
#MINUS { ?era wdt:P2348/wdt:P361 wd:Q130436 wd:Q1145058} # exclude sub-eras
MINUS {?era wdt:P2348 []}
OPTIONAL { ?era wdt:P582 ?end_time }
OPTIONAL { ?era wdt:P138 ?named }
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;
v7("?end")
v5("?end_time"):::projected
v3("?era"):::projected
v6("?named")
v7("?start")
v4("?start_time"):::projected
a1((" "))
c7(["wd:Q130436"]):::iri
c5(["wd:Q11514315"]):::iri
c13(["bd:serviceParam"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?era != 'wd:Q11358452'?era != 'wd:Q11509224'?era != 'wd:Q1145058'"]]
f0 --> v3
v3 --"wdt:P31"--> c5
v3 --"wdt:P361"--> c7
v3 --"wdt:P580"--> v4
subgraph minus1["MINUS"]
style minus1 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;
v3 -."wdt:P138".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end
bind2[/"year-from-dateTime(?start_time)"/]
v4 --o bind2
bind2 --as--o v7
bind3[/"year-from-dateTime(?end_time)"/]
v5 --o bind3
bind3 --as--o v7