query-26927259206877aa0c0ad40d09867493

rq turtle/ttl

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

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

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?b") v7("?birth") v5("?d") v9("?death") v6("?dob"):::projected v8("?dod"):::projected v3("?item"):::projected v2("?itemLabel"):::projected v6("?y"):::projected a1((" ")) a2((" ")) c44(["bd:serviceParam"]):::iri c36(["wd:Q5"]):::iri c46(["#91;AUTO_LANGUAGE#93;,es,en"]):::literal c38(["wd:Q717"]):::iri list0c32(["1880^^xsd:integer"]):::literal list0c1(["1833^^xsd:integer"]):::literal list0c16(["1855^^xsd:integer"]):::literal list0c29(["1877^^xsd:integer"]):::literal list0c28(["1876^^xsd:integer"]):::literal list0c15(["1853^^xsd:integer"]):::literal list0c14(["1852^^xsd:integer"]):::literal list0c27(["1874^^xsd:integer"]):::literal list0c13(["1851^^xsd:integer"]):::literal list0c12(["1850^^xsd:integer"]):::literal list0c26(["1872^^xsd:integer"]):::literal list0c25(["1871^^xsd:integer"]):::literal list0c24(["1870^^xsd:integer"]):::literal list0c4(["1839^^xsd:integer"]):::literal list0c3(["1838^^xsd:integer"]):::literal list0c18(["1857^^xsd:integer"]):::literal list0c31(["1879^^xsd:integer"]):::literal list0c2(["1834^^xsd:integer"]):::literal list0c17(["1856^^xsd:integer"]):::literal list0c30(["1878^^xsd:integer"]):::literal list0c7(["1844^^xsd:integer"]):::literal list0c20(["1866^^xsd:integer"]):::literal list0c6(["1843^^xsd:integer"]):::literal list0c19(["1865^^xsd:integer"]):::literal list0c5(["1841^^xsd:integer"]):::literal list0c33(["1882^^xsd:integer"]):::literal list0c11(["1849^^xsd:integer"]):::literal list0c10(["1847^^xsd:integer"]):::literal list0c23(["1869^^xsd:integer"]):::literal list0c9(["1846^^xsd:integer"]):::literal list0c22(["1868^^xsd:integer"]):::literal list0c8(["1845^^xsd:integer"]):::literal list0c21(["1867^^xsd:integer"]):::literal list0c1 --o f0 list0c2 --o f0 list0c3 --o f0 list0c4 --o f0 list0c5 --o f0 list0c6 --o f0 list0c7 --o f0 list0c8 --o f0 list0c9 --o f0 list0c10 --o f0 list0c11 --o f0 list0c12 --o f0 list0c13 --o f0 list0c14 --o f0 list0c15 --o f0 list0c16 --o f0 list0c17 --o f0 list0c18 --o f0 list0c19 --o f0 list0c20 --o f0 list0c21 --o f0 list0c22 --o f0 list0c23 --o f0 list0c24 --o f0 list0c25 --o f0 list0c26 --o f0 list0c27 --o f0 list0c28 --o f0 list0c29 --o f0 list0c30 --o f0 list0c31 --o f0 list0c32 --o f0 list0c33 --o f0 f0[[" in "]] f0 --> v6 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P570"--> v5 bind1[/"year-from-dateTime(?d)"/] v5 --o bind1 bind1 --as--o v6 v3 --"wdt:P31"--> c36 v3 --"wdt:P27"--> c38 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P569"--> v4 bind2[/"year-from-dateTime(?b)"/] v4 --o bind2 bind2 --as--o v6 v3 --"wdt:P31"--> c36 v3 --"wdt:P27"--> c38 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P570"--> v5 bind3[/"year-from-dateTime(?d)"/] v5 --o bind3 bind3 --as--o v6 v3 --"wdt:P31"--> c36 a2 --"wdt:P131"--> c38 v3 --"wdt:P20"--> a2 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P569"--> v4 bind4[/"year-from-dateTime(?b)"/] v4 --o bind4 bind4 --as--o v6 v3 --"wdt:P31"--> c36 a1 --"wdt:P131"--> c38 v3 --"wdt:P19"--> a1 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P569".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P19".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P570".-> v8 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P20".-> v9 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c44 --"wikibase:language"--> c46 end