query-d7ff1e102e02c7661833c4db58d1a6c0
10:19, 18 May 2020 (UTC) Jura: I found this most helpful to identify items to merge (varying some of the criteria or chosing year precision for birth or death date). Above an addition to do a 2-click merge. --- Dipsacus fullonum, Epìdosis@: Maybe it will make sense to create a separate page for sharing queries that can detect duplicate Q5 elements? I searched for pairs of persons that have the same date of birth AND share a place of birth with population lower than a certain threshold. Here is the query for Brazil (in reality I use a bit more complex queries): Jura1, Dipsacus fullonum, Epìdosis@
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?person1 ?person1Label ?person2 ?person2Label ?date_of_birth ?place_of_birth WHERE {
?place_of_birth wdt:P17 wd:Q155; #in Brazil
wdt:P1082 ?population.
FILTER(?population < 100000 ) # for places with huge population, use additional constraints for person1/person2 pair
?person1 wdt:P31 wd:Q5; #human
wdt:P19 ?place_of_birth;
wdt:P569 ?date_of_birth.
?person2 wdt:P31 wd:Q5; #human, empty P31 is also useful here
wdt:P19 ?place_of_birth;
wdt:P569 ?date_of_birth.
FILTER(!(((DAY(?date_of_birth)) = 1 ) && ((MONTH(?date_of_birth)) = 1 ))) # I usually exclude January 1, too many false positives even with 1 day precision
FILTER( ?person1 != ?person2)
SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,es,[AUTO_LANGUAGE]". }
}
ORDER BY DESC(?date_of_birth)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?date_of_birth"):::projected
v2("?person1"):::projected
v3("?person2"):::projected
v5("?place_of_birth"):::projected
v4("?population")
c13(["pt,es,#91;AUTO_LANGUAGE#93;"]):::literal
c11(["bd:serviceParam"]):::iri
c7(["wd:Q5"]):::iri
c4(["wd:Q155"]):::iri
f0[["?person1 != ?person2"]]
f0 --> v2
f0 --> v3
f1[["not day-from-dateTime(?date_of_birth) = '1^^xsd:integer'month-from-dateTime(?date_of_birth) = '1^^xsd:integer'"]]
f1 --> v1
f2[["?population < '100000^^xsd:integer'"]]
f2 --> v4
v5 --"wdt:P17"--> c4
v5 --"wdt:P1082"--> v4
v2 --"wdt:P31"--> c7
v2 --"wdt:P19"--> v5
v2 --"wdt:P569"--> v1
v3 --"wdt:P31"--> c7
v3 --"wdt:P19"--> v5
v3 --"wdt:P569"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end