query-5e6c47f572365bf62af1e810e6cdd282
Once working, no longer working queryHello, what's wrong with that query ? It is supposed to show a count of countries per year (not sure if it's the list or the count). Many thanks,
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?country (group_concat(?NatureLabelFr;separator=" ,") as ?NatureLabelFr) ?countryLabel ?creationDate ?dissolutionDate
where {
{
select ?country (coalesce(?countryLabelFr, ?countryLabelEn, ?country) as ?countryLabel) ?creationDate ?dissolutionDate{
?country wdt:P31/wdt:P279* wd:Q3624078 # sovereign states, I don’t know if it’s the right item
MINUS { ?country (wdt:P31/wdt:P279*) wd:Q1790360. }#empires coloniaux
MINUS { ?country (wdt:P31/wdt:P279*) wd:Q1371288. } #états vassals
optional { ?country rdfs:label ?countryLabelFr filter(lang(?countryLabelFr)= "fr")} .
optional { ?country rdfs:label ?countryLabelEn filter(lang(?countryLabelEn)= "en")}
optional { ?country wdt:P571 ?creationDate }
optional { ?country wdt:P576 ?dissolutionDate }
} order by ?countryLabel
}.
optional{
?country wdt:P31/rdfs:label ?NatureLabelFr filter(lang(?NatureLabelFr)= "fr") .
}
} group by ?country ?countryLabel ?creationDate ?dissolutionDate
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?NatureLabelFr"):::projected
v5("?country"):::projected
v8("?countryLabel"):::projected
v3("?countryLabelEn")
v4("?countryLabelFr")
v6("?creationDate"):::projected
v7("?dissolutionDate"):::projected
a1((" "))
a2((" "))
a3((" "))
a4((" "))
c5(["wd:Q3624078"]):::iri
c7(["wd:Q1371288"]):::iri
c6(["wd:Q1790360"]):::iri
v5 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v5 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c6
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v5 --"wdt:P31"--> a3
a3 --"wdt:P279"--> c7
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."rdfs:label".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."rdfs:label".-> v3
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P571".-> v6
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P576".-> v7
end
bind2[/"?countryLabelFr?countryLabelEn?country"/]
v4 --o bind2
v3 --o bind2
v5 --o bind2
bind2 --as--o v8
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P31".-> a4
a4 --"rdfs:label"--> v8
end
bind4[/"?NatureLabelFr"/]
v8 --o bind4
bind4 --as--o v8