query-e485c4e0b1364a98e4423ddbc8115670

rq turtle/ttl

Citizens of Finland before Finland existedPeople who died before Finland became independent country, but who are marked as citizens of Finland.

Use at

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 ?item ?itemLabel ?dod
WHERE 
{
  ?item wdt:P27 wd:Q33;
        wdt:P570 ?dod;
        wdt:P31 wd:Q5.
  wd:Q33 p:P31 ?statement.
  ?statement ps:P31 wd:Q3624078;
             pq:P580 ?independence.
  BIND (YEAR(?dod) AS ?dod_year)
  FILTER( ( ?dod_year < YEAR(?independence) ) ||
          ( (?dod_year = YEAR(?independence) ) && (MONTH(?dod) < MONTH(?independence)) ) ||
          ( (?dod_year = YEAR(?independence) ) && (MONTH(?dod) = MONTH(?independence)) && (DAY(?dod) < DAY(?independence)) ) )
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fi,en". }
}
ORDER BY DESC(?dod)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?dod"):::projected v6("?dod_year") v3("?independence") v4("?item"):::projected v5("?statement") c2(["wd:Q33"]):::iri c8(["wd:Q3624078"]):::iri c11(["bd:serviceParam"]):::iri c5(["wd:Q5"]):::iri c13(["fi,en"]):::literal f0[["(?dod_year < year-from-dateTime(?independence) || (?dod_year = year-from-dateTime(?independence)month-from-dateTime(?dod) < month-from-dateTime(?independence) || ?dod_year = year-from-dateTime(?independence)month-from-dateTime(?dod) = month-from-dateTime(?independence)day-from-dateTime(?dod) < day-from-dateTime(?independence)))"]] f0 --> v6 f0 --> v3 f0 --> v1 v4 --"p:direct/P27"--> c2 v4 --"p:direct/P570"--> v1 v4 --"p:direct/P31"--> c5 c2 --"p:P31"--> v5 v5 --"p:statement/P31"--> c8 v5 --"p:qualifier/P580"--> v3 bind1[/"year-from-dateTime(?dod)"/] v1 --o bind1 bind1 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end