mysociety / verification-pages

Tool to generate and push verification pages to Wikidata
https://www.wikidata.org/wiki/Template:Verification_page
2 stars 1 forks source link

"Invalid Date" error on Micronesia-19 set-up #669

Open tmtmtmtm opened 5 years ago

tmtmtmtm commented 5 years ago

Trying to set up https://www.wikidata.org/wiki/Wikidata:WikiProject_every_politician/Micronesia/verification/Congress/19th, I get an error:

ArgumentError in WikidataPage#setup
Showing /data/project/verification-pages/verification-pages/app/views/wiki/verification.mediawiki.erb where line #10 raised:

invalid date
gbp commented 5 years ago

Looks to be due to the previous term not existing, but the previous term end date is still being returned EG 1 January 4901 BCE which isn't being parsed correctly.

@tmtmtmtm how could improve this query to not return the end date?

tmtmtmtm commented 5 years ago

@gbp The problem with that SPARQL seems to be that you're asking for the start/end dates for an element that has already been declared as OPTIONAL. To work around that you'll need to nest the OPTIONAL parts [NB There may be better ways to construct that with alternation, but that depends on how well the code copes with something returning more than one start or end date]