everypolitician / compare_with_wikidata

Library for diffing Wikidata and CSVs
MIT License
2 stars 0 forks source link

Handle schema rows returned from daff #59

Closed tmtmtmtm closed 7 years ago

tmtmtmtm commented 7 years ago

Refreshing the newly created prompt at https://www.wikidata.org/wiki/User:Oravrattas/prompts/Riigikogu gives me a

Error: Unknown change type:
tmtmtmtm commented 7 years ago

I suspect this was because the two sources had only a single column each, and that was named differently in each. (Going the long-winded way of fetching the label in SPARQL solved the problem.)

But it would be good to handle errors like this better.

chrismytton commented 7 years ago

Ah yes, different schemas will generate a "schema row" which we're not handling currently.

From the tabular diff format spec:

A schema row that is needed when the column structure differs between tables. This row can be recognized since it will have the tag ! in the action column.

and

NOTE: If writing a rule to “sniff” a file to see if it is a highlighter diff, the @@ tag is a handy tell-tale. But watch out for that schema row! Also, to allow for future evolution of this format, please try to be robust to a few extra rows or columns appearing before the @@.