Closed nichtich closed 6 years ago
Thank you! This looks good from my first glance (I have to look closer some time later...).
BTW I think we can also use another function like this (code is untested):
formatStatement(subject, property, object, addQuotationMarks) {
if (addQuotationMarks) {
object = '"' + object + '"';
}
var elements = [subject, property, object];
return elements.join('\t');
}
What do you think @nichtich ? We then use code like
formatStatement('LAST', 'P31', typeMapping[itemType], false);
formatStatement(formatStatement('LAST', 'P2093' creatorValue, true), 'P1545', index, true);
Ok I extended the code similar to suggested and also added a unit test: see this branch: https://github.com/gbv/zotkat/tree/wqs-test
Slightly refactore the code of Wikidata QuickStatements.js to get a better testable function that maps a Zotero item to a QuickStatements string (see #55).