query-3e045913d6299968555a305b42766931
Town that have changed of name in the past ]reply[20:56, 7 June 2020 (UTC)) talk (Bouzinac (P1448)official name with its (Q190118)La Roche-sur-Yon Hello, I'd like to list towns/cities that have changed at least 3 times in the past, with their dates ? See for instance : This query will list cities etc. with more than 3 officiel names. It doesn't distinguish between names at different times and names in different languages at the same time.Bouzinac@
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?name ?language_tag ?rank ?start ?end
WHERE
{
{
# Select items with more than 3 official names, i.e. it has changed at least 3 times.
SELECT ?item
WHERE
{
?item p:P1448 []. # Officiel name
}
GROUP BY ?item
HAVING (COUNT(?item) > 3)
} ?item wdt:P31 / wdt:P279 wd:Q486972. # ?item is a settelement
?item p:P1448 ?name_statement.
?name_statement wikibase:rank ?rank.
?name_statement ps:P1448 ?name.
BIND (LANG(?name) AS ?language_tag).
OPTIONAL { ?name_statement pq:P580 ?start. }
OPTIONAL { ?name_statement pq:P582 ?end. }
}
ORDER By ?item ?start
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?_anon_42b5416610844a34809f33a099ae9de164270")
v8("?end"):::projected
v1("?item"):::projected
v7("?language_tag"):::projected
v6("?name"):::projected
v4("?name_statement")
v5("?rank"):::projected
v2("?start"):::projected
a2((" "))
a1((" "))
a3((" "))
c5(["wd:Q486972"]):::iri
f0[[" > '3^^xsd:integer'"]]
f0 --> a1
v1 --"p:P1448"--> a2
bind2[/"count(?item)"/]
v1 --o bind2
bind2 --as--o v3
v1 --"p:direct/P31"--> a3
a3 --"p:direct/P279"--> c5
v1 --"p:P1448"--> v4
v4 --"wikibase:rank"--> v5
v4 --"p:statement/P1448"--> v6
bind3[/"?name"/]
v6 --o bind3
bind3 --as--o v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P580".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P582".-> v8
end