query-a71a185bcc44351d1906ddef5cf26eb4
Issues with the data As hinted at above there are still a number of entries with overlapping terms. These need to be teased out one way or another. Suggestions welcome. (Perhaps DBPedia??) Here is a query to collect all the overlapping terms since 1913.
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT * WHERE {
{
SELECT DISTINCT (COUNT(?stmt) AS ?cnt) ?district ?start WHERE {
?sen p:P39 ?stmt;
wdt:P31 wd:Q5.
?stmt ps:P39 wd:Q4416090;
pq:P2937 ?term;
pq:P580 ?start;
pq:P768 ?district.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?district ?start
}
FILTER(?cnt > 1)
FILTER(?start > "1913-01-01T00:00:00Z"^^xsd:dateTime)
?sen2 p:P39 ?stmt2;
wdt:P31 wd:Q5.
?stmt2 ps:P39 wd:Q4416090;
pq:P2937 ?term;
pq:P580 ?start;
pq:P768 ?district.
OPTIONAL { ?nextterm wdt:P155 ?term. ?sen2 p:P39 [ pq:P2937 ?nextterm ]. }
}
ORDER BY (?district) (?start)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?cnt"):::projected
v1("?district"):::projected
v9("?nextterm"):::projected
v4("?sen")
v7("?sen2"):::projected
v2("?start"):::projected
v5("?stmt")
v8("?stmt2"):::projected
v6("?term"):::projected
a1((" "))
c12(["bd:serviceParam"]):::iri
c7(["wd:Q4416090"]):::iri
c5(["wd:Q5"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?start > '1913-01-01T00:00:00Z^^xsd:dateTime'"]]
f0 --> v2
f1[["?cnt > '1^^xsd:integer'"]]
f1 --> v7
v4 --"p:P39"--> v5
v4 --"p:direct/P31"--> c5
v5 --"p:statement/P39"--> c7
v5 --"p:qualifier/P2937"--> v6
v5 --"p:qualifier/P580"--> v2
v5 --"p:qualifier/P768"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind3[/"count(?stmt)"/]
v5 --o bind3
bind3 --as--o v7
v7 --"p:P39"--> v8
v7 --"p:direct/P31"--> c5
v8 --"p:statement/P39"--> c7
v8 --"p:qualifier/P2937"--> v6
v8 --"p:qualifier/P580"--> v2
v8 --"p:qualifier/P768"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v9 -."p:direct/P155".-> v6
a1 --"p:qualifier/P2937"--> v9
v7 --"p:P39"--> a1
end