I've the following query

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?item ?itemLabel ?dod ?dob WHERE {
  ?item wdt:P570 ?dod.
  ?item wdt:P31 wd:Q5.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "es,en,it,fr,de,cs,[AUTO_LANGUAGE]". }
  OPTIONAL { ?item wdt:P569 ?dob. }
    FILTER(?dod < (NOW()))
FILTER (?item IN (wd:Q4173012))
ORDER BY DESC(?modified) DESC(?dod) ?item

that in the example provided (Q4173012) returns four multiple values because has date with incomplete data, for example "2019" for date of death, that returns 2019-01-01. I need to filter these cases, I could do it if only get the 2019 so I can know that is an incomplete data, in order to not confuse those records that actually born or death on 01-01

There is some way to convert this query to get the specific data as is shown in wikidata or filter this behavior? Because for incomplete data in wikidata is shown good:

enter image description here

I hope I can be clear, my english is not so good. Thanks in advance and sorry for my english.

1 Answer 1

SELECT ?item ?itemLabel ?dob ?precision_int ?precision_word WHERE {
  VALUES (?precision_int ?precision_word) { (6 "millenia") (7 "century") (8 "decade")
                                            (9 "year")     (10 "month")  (11 "day")
                                            (12 "hour")    (13 "minute") (14 "second") }

  ?item p:P569 [ a wikibase:BestRank ;
                 psv:P569 [ wikibase:timeValue ?dob;
                            wikibase:timePrecision ?precision_int ] ]

#   ?item p:P569 [ a wikibase:BestRank ;
#                  psv:P569 [ wikibase:timeValue ?dob_;
#                             wikibase:timePrecision ?precision_int_ ] ]
#   FILTER (?precision_int < ?precision_int_)
# }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "es,[AUTO_LANGUAGE]". }

} VALUES (?item) {(wd:Q4173012)}

Try it!

  • thanks! I have to study this! :D Nice work, as always! Jan 22, 2019 at 20:40
  • nice! this works perfect for filter pourposes. Thanks a lot. Jan 22, 2019 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.