query-7432e0813d7fcc40358166389ce63dfd
Number of countries in the time Hello, I saw this 17:05, 24 April 2019 (UTC)) talk (Bouzinac and I wonder if there would be a sparql query reflecting this graph ? Thanks ! : A little spoiler of what I have for now : Bouzinac@
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
select ?bound (count(?country) as ?count)
where {
{
select distinct ?bound {
?country (wdt:P571|wdt:P576) ?bound.
{
select ?country {
?country wdt:P31/wdt:P279* wd:Q3624078 # sovereign states, I don’t know if it’s the right item
}
}.
filter (year(?bound) > 1800)
}
}.
{
select ?country {
?country wdt:P31/wdt:P279* wd:Q3624078 # sovereign states, I don’t know if it’s the right item
}
}.
?country wdt:P571 ?creation .
optional { ?country wdt:P576 ?dest_maybe . }
bind (coalesce(?dest_maybe, now()) as ?destruction)
filter ( ?creation <= ?bound && ?destruction > ?bound )
} group by ?bound order by ?bound
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?bound"):::projected
v6("?count")
v4("?country"):::projected
v2("?creation")
v5("?dest_maybe")
v6("?destruction")
a1((" "))
a2((" "))
c6(["wd:Q3624078"]):::iri
f0[["?creation <= ?bound?destruction > ?bound"]]
f0 --> v2
f0 --> v1
f0 --> v6
f1[["year-from-dateTime(?bound) > '1800^^xsd:integer'"]]
f1 --> v1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P576"--> v1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P571"--> v1
end
union0r <== or ==> union0l
end
v4 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c6
v4 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c6
v4 --"wdt:P571"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P576".-> v5
end
bind2[/"?dest_maybeNOW()"/]
v5 --o bind2
bind2 --as--o v6
bind4[/"count(?country)"/]
v4 --o bind4
bind4 --as--o v6