query-26927259206877aa0c0ad40d09867493
Venezuelan people 19:01, 4 January 2018 (UTC)) talk (Jamez42Hi! I'm still learning how to use the Query Service and my computer is currently very slow. I'm working on creating lists in the Spanish Wikipedia about years in Venezuela, so I wanted to search Venezuelan persons that were either born or have died in the following years: 1833, 1834, 1838, 1839, 1841, 1843, 1844, 1845, 1846, 1847, 1849, 1850, 1851, 1852, 1853, 1855, 1856, 1857, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1874, 1876, 1877, 1878, 1879, 1880 and 1882. Many thanks in advance! -- ?itemLabel ?y ORDER BY } } ."[AUTO_LANGUAGE],es,en" language:wikibase serviceParam:bd { label:wikibase SERVICE } ?dod P570:wdt ?item { OPTIONAL } ?dob P569:wdt ?item { OPTIONAL . Q5:wd P31:wdt ?item ) ) 1882 ,1880 ,1879 ,1878 ,1877 ,1876 ,1874 ,1872 ,1871 ,1870 ,1869 ,1868 ,1867 ,1866 ,1865 ,1857 ,1856 ,1855 ,1853 ,1852 ,1851 ,1850 ,1849 ,1847 ,1846 ,1845 ,1844 ,1843 ,1841 ,1839 ,1838 ,1834 ,1833 ( IN ?y ( FILTER } )?y as )?d(YEAR(BIND . ?d P570:wdt ?item { UNION } )?y as )?d(YEAR(BIND . ?d P569:wdt ?item { . Q717:wd P27:wdt ?item { ?dod ?dob ?itemDescription ?itemLabel ?item ?y SELECT 19:36, 4 January 2018 (UTC) Jura--- Maybe like the above. 07:04, 6 January 2018 (UTC)) talk (Jamez42: This is perfect, thank you so much for the soon response! --Jura1@ 21:22, 16 January 2018 (UTC)) talk (Andrew Gray might be dual citizens where we've only listed one nationality. (Q330882)Gregor MacGregor : The FILTER on years is really elegant - I didn't know you could do that! Here's an adapted query, which also finds anyone who was born or died in Venezuela in those years, even if they're not listed as Venezuelan. There's about 24 extra names - I think some are missing the country and others like Jamez42, Jura1@
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 DISTINCT ?y ?item ?itemLabel ?itemDescription ?dob ?birthLabel ?dod ?deathLabel
{
{ ?item wdt:P569 ?b . BIND(YEAR(?b) as ?y) . # year of birth known
?item wdt:P31 wd:Q5 . # was a human
?item wdt:P19 [wdt:P131* wd:Q717] . } # born somewhere in Venezuela
UNION
{ ?item wdt:P570 ?d . BIND(YEAR(?d) as ?y) . # year of death known
?item wdt:P31 wd:Q5 . # was a human
?item wdt:P20 [wdt:P131* wd:Q717] . } # died somewhere in Venezuela
UNION
{ ?item wdt:P569 ?b . BIND(YEAR(?b) as ?y) . # year of birth known
?item wdt:P31 wd:Q5 . # was a human
?item wdt:P27 wd:Q717 . } # nationality was Venezuelan
UNION
{ ?item wdt:P570 ?d . BIND(YEAR(?d) as ?y) . # year of death known
?item wdt:P31 wd:Q5 . # was a human
?item wdt:P27 wd:Q717 . } # nationality was Venezuelan
# the UNION sections above mean we get any person who satisfies one or more of the four searches
FILTER ( ?y IN ( 1833, 1834, 1838, 1839, 1841, 1843, 1844, 1845, 1846, 1847, 1849, 1850, 1851, 1852, 1853, 1855, 1856, 1857, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1874, 1876, 1877, 1878, 1879, 1880, 1882 ) )
# filter so the year of birth/death was one of the ones we're interested in
OPTIONAL { ?item wdt:P569 ?dob } # date of birth if known
OPTIONAL { ?item wdt:P19 ?birth } # place of birth if known
OPTIONAL { ?item wdt:P570 ?dod } # date of death if known
OPTIONAL { ?item wdt:P20 ?death } # place of death if known
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es,en". }
}
ORDER BY ?y ?itemLabel