query-9a4fdb91c0f4b6f6825946f5d67d7d6a

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?dob ?precision
WHERE 
{ ?item wdt:P27 wd:Q20.               # country of citizenship=Norway
  ?item p:P569 ?p569stm .
  ?p569stm ps:P569 ?dob .             # must have dob
  ?p569stm psv:P569 [wikibase:timePrecision ?dp] . # find out time precision
  BIND(IF(?dp=11,'day',IF(?dp=10,'month',IF(?dp=9,'year',IF(?dp=8,'decade',IF(?dp=7,'century','other'))))) AS ?precision) # convert code for time precision to English
  BIND (year(?dob) as ?year)          # convert dob to years
  FILTER (?year >= 1710)              # filter for dob later than or equal to 1710
  FILTER (?year <= 1911)              # filter for dob prior to or equal to 1911
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],no,en". } # get labels
} ORDER BY ?dob

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?dob"):::projected v5("?dp") v3("?item"):::projected v4("?p569stm") v6("?precision"):::projected v7("?year") a1((" ")) c10(["bd:serviceParam"]):::iri c4(["wd:Q20"]):::iri c12(["#91;AUTO_LANGUAGE#93;,no,en"]):::literal f0[["?year <= '1911^^xsd:integer'"]] f0 --> v7 f1[["?year >= '1710^^xsd:integer'"]] f1 --> v7 v3 --"p:direct/P27"--> c4 v3 --"p:P569"--> v4 v4 --"p:statement/P569"--> v1 a1 --"wikibase:timePrecision"--> v5 v4 --"p:statement/value/P569"--> a1 bind2[/"if(?dp = '11^^xsd:integer','day',if(?dp = '10^^xsd:integer','month',if(?dp = '9^^xsd:integer','year',if(?dp = '8^^xsd:integer','decade',if(?dp = '7^^xsd:integer','century','other')))))"/] v5 --o bind2 bind2 --as--o v6 bind3[/"year-from-dateTime(?dob)"/] v1 --o bind3 bind3 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end