query-d397f6f081e96a56ac747b732533c1fb
pairs of persons that have the same date of birth AND share a place of birth (Brazil) with population lower than a certain threshold 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)
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#>
#pairs of persons that have the same date of birth AND share a place of birth (Brazil) with population lower than a certain threshold
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)