query-a57f816c2dbb71e859e1498d32d2c636
Propertiesinstance of (P31)followed by (P156)point in time (P585)subclass of (P279)inception (P571)country (P17)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:BarChart
SELECT ?yearLabel (COUNT(?country) AS ?count) (SAMPLE(?cLabel) AS ?cLabel) WHERE {
?year wdt:P31 wd:Q577;
wdt:P156/wdt:P585 ?next_year_point;
wdt:P585 ?year_point.
FILTER("1950-01-01"^^xsd:date <= ?year_point && ?year_point < "2000-01-01"^^xsd:dat).
OPTIONAL { ?object (wdt:P31/wdt:P279*) wd:Q134447.
?object wdt:P571 ?_inception.
?object wdt:P17 ?country.
?country rdfs:label ?countryLabel. FILTER((LANG(?countryLabel)) = "en")
FILTER(?year_point <= ?_inception && ?_inception < ?next_year_point)
}
BIND(IF(BOUND(?country),?countryLabel,"none") AS ?cLabel)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} GROUP BY ?yearLabel ?country
ORDER BY ?yearLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?_inception")
v11("?cLabel"):::projected
v10("?count")
v8("?country"):::projected
v3("?countryLabel")
v5("?next_year_point")
v7("?object")
v6("?year")
v1("?yearLabel"):::projected
v2("?year_point")
a1((" "))
a2((" "))
c9(["wd:Q134447"]):::iri
c5(["wd:Q577"]):::iri
c14(["bd:serviceParam"]):::iri
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["'1950-01-01^^xsd:date' <= ?year_point?year_point < s2000-01-01^^<http://www.w3.org/2001/XMLSchema#dat>'"]]
f0 --> v2
v6 --"wdt:P31"--> c5
v6 --"wdt:P156"--> a1
a1 --"wdt:P585"--> v5
v6 --"wdt:P585"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."wdt:P31".-> a2
a2 --"wdt:P279"--> c9
v7 --"wdt:P571"--> v4
v7 --"wdt:P17"--> v8
v8 --"rdfs:label"--> v3
end
bind1[/"if(bound(?country),?countryLabel,'none')"/]
v8 --o bind1
v3 --o bind1
bind1 --as--o v11
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end
bind4[/"count(?country)"/]
v8 --o bind4
bind4 --as--o v10
bind5[/"sample(?cLabel)"/]
v11 --o bind5
bind5 --as--o v11